- Removed old stuff

This commit is contained in:
Ferdi Koomen 2019-11-23 00:58:02 +01:00
parent 4bfe976eac
commit 3b3552b243
103 changed files with 1 additions and 10791 deletions

1
.gitignore vendored
View File

@ -9,6 +9,5 @@ junit.xml
.vscode
*.iml
dist
archive
coverage
test/tmp

View File

@ -45,7 +45,7 @@
"src/templates/typescript/*.hbs"
],
"scripts": {
"clean": "rimraf \"./dist\" \"./test/tmp\"",
"clean": "rimraf \"./dist\" \"./coverage\" \"./test/tmp\"",
"build": "tsc",
"start": "tsc && node ./test/index.js",
"test": "jest ./src",

View File

@ -1,4 +0,0 @@
wwwroot/*.js
node_modules
typings
dist

View File

@ -1,23 +0,0 @@
# 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

View File

@ -1,178 +0,0 @@
## @
### Building
To install the required dependencies and to build the typescript sources run:
```
npm install
npm run build
```
### publishing
First build the package than run ```npm publish```
### consuming
Navigate to the folder of your consuming project and run one of next commands.
_published:_
```
npm install @ --save
```
_without publishing (not recommended):_
```
npm install PATH_TO_GENERATED_PACKAGE --save
```
_using `npm link`:_
In PATH_TO_GENERATED_PACKAGE:
```
npm link
```
In your project:
```
npm link
```
__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
Published packages are not effected by this issue.
#### General usage
In your Angular project:
```
// without configuring providers
import { ApiModule } from '';
import { HttpClientModule } from '@angular/common/http';
@NgModule({
imports: [
ApiModule,
// make sure to import the HttpClientModule in the AppModule only,
// see https://github.com/angular/angular/issues/20575
HttpClientModule
],
declarations: [ AppComponent ],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```
```
// configuring providers
import { ApiModule, Configuration, ConfigurationParameters } from '';
export function apiConfigFactory (): Configuration => {
const params: ConfigurationParameters = {
// set configuration parameters here.
}
return new Configuration(params);
}
@NgModule({
imports: [ ApiModule.forRoot(apiConfigFactory) ],
declarations: [ AppComponent ],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```
```
import { DefaultApi } from '';
export class AppComponent {
constructor(private apiGateway: DefaultApi) { }
}
```
Note: The ApiModule is restricted to being instantiated once app wide.
This is to ensure that all services are treated as singletons.
#### Using multiple swagger files / APIs / ApiModules
In order to use multiple `ApiModules` generated from different swagger files,
you can create an alias name when importing the modules
in order to avoid naming conflicts:
```
import { ApiModule } from 'my-api-path';
import { ApiModule as OtherApiModule } from 'my-other-api-path';
import { HttpClientModule } from '@angular/common/http';
@NgModule({
imports: [
ApiModule,
OtherApiModule,
// make sure to import the HttpClientModule in the AppModule only,
// see https://github.com/angular/angular/issues/20575
HttpClientModule
]
})
export class AppModule {
}
```
### Set service base path
If different than the generated base path, during app bootstrap, you can provide the base path to your service.
```
import { BASE_PATH } from '';
bootstrap(AppComponent, [
{ provide: BASE_PATH, useValue: 'https://your-web-service.com' },
]);
```
or
```
import { BASE_PATH } from '';
@NgModule({
imports: [],
declarations: [ AppComponent ],
providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```
#### Using @angular/cli
First extend your `src/environments/*.ts` files by adding the corresponding base path:
```
export const environment = {
production: false,
API_BASE_PATH: 'http://127.0.0.1:8080'
};
```
In the src/app/app.module.ts:
```
import { BASE_PATH } from '';
import { environment } from '../environments/environment';
@NgModule({
declarations: [
AppComponent
],
imports: [ ],
providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }],
bootstrap: [ AppComponent ]
})
export class AppModule { }
```

View File

@ -1,37 +0,0 @@
import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
import { Configuration } from './configuration';
import { HttpClient } from '@angular/common/http';
import { PetService } from './api/pet.service';
import { StoreService } from './api/store.service';
import { UserService } from './api/user.service';
@NgModule({
imports: [],
declarations: [],
exports: [],
providers: [
PetService,
StoreService,
UserService ]
})
export class ApiModule {
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders {
return {
ngModule: ApiModule,
providers: [ { provide: Configuration, useFactory: configurationFactory } ]
};
}
constructor( @Optional() @SkipSelf() parentModule: ApiModule,
@Optional() http: HttpClient) {
if (parentModule) {
throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
}
if (!http) {
throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
'See also https://github.com/angular/angular/issues/20575');
}
}
}

View File

@ -1,7 +0,0 @@
export * from './pet.service';
import { PetService } from './pet.service';
export * from './store.service';
import { StoreService } from './store.service';
export * from './user.service';
import { UserService } from './user.service';
export const APIS = [PetService, StoreService, UserService];

View File

@ -1,542 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent } from '@angular/common/http';
import { CustomHttpUrlEncodingCodec } from '../encoder';
import { Observable } from 'rxjs/Observable';
import { ApiResponse } from '../model/apiResponse';
import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
@Injectable()
export class PetService {
protected basePath = 'https://petstore.swagger.io/v2';
public defaultHeaders = new HttpHeaders();
public configuration = new Configuration();
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
}
}
/**
* @param consumes string[] mime-types
* @return true: consumes contains 'multipart/form-data', false: otherwise
*/
private canConsumeForm(consumes: string[]): boolean {
const form = 'multipart/form-data';
for (const consume of consumes) {
if (form === consume) {
return true;
}
}
return false;
}
/**
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public addPet(body: Pet, observe?: 'body', reportProgress?: boolean): Observable<any>;
public addPet(body: Pet, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public addPet(body: Pet, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public addPet(body: Pet, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling addPet.');
}
let headers = this.defaultHeaders;
// authentication (petstore_auth) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
'application/json',
'application/xml'
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected != undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.basePath}/pet`,
body,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Deletes a pet
*
* @param petId Pet id to delete
* @param apiKey
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public deletePet(petId: number, apiKey?: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
public deletePet(petId: number, apiKey?: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public deletePet(petId: number, apiKey?: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public deletePet(petId: number, apiKey?: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling deletePet.');
}
let headers = this.defaultHeaders;
if (apiKey !== undefined && apiKey !== null) {
headers = headers.set('api_key', String(apiKey));
}
// authentication (petstore_auth) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.delete<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* 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
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'body', reportProgress?: boolean): Observable<Array<Pet>>;
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<Pet>>>;
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<Pet>>>;
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (status === null || status === undefined) {
throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
}
let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
if (status) {
status.forEach((element) => {
queryParameters = queryParameters.append('status', <any>element);
})
}
let headers = this.defaultHeaders;
// authentication (petstore_auth) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByStatus`,
{
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* 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
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public findPetsByTags(tags: Array<string>, observe?: 'body', reportProgress?: boolean): Observable<Array<Pet>>;
public findPetsByTags(tags: Array<string>, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<Pet>>>;
public findPetsByTags(tags: Array<string>, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<Pet>>>;
public findPetsByTags(tags: Array<string>, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (tags === null || tags === undefined) {
throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.');
}
let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
if (tags) {
tags.forEach((element) => {
queryParameters = queryParameters.append('tags', <any>element);
})
}
let headers = this.defaultHeaders;
// authentication (petstore_auth) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByTags`,
{
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getPetById(petId: number, observe?: 'body', reportProgress?: boolean): Observable<Pet>;
public getPetById(petId: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Pet>>;
public getPetById(petId: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Pet>>;
public getPetById(petId: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling getPetById.');
}
let headers = this.defaultHeaders;
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
headers = headers.set('api_key', this.configuration.apiKeys["api_key"]);
}
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.get<Pet>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Update an existing pet
*
* @param body Pet object that needs to be added to the store
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public updatePet(body: Pet, observe?: 'body', reportProgress?: boolean): Observable<any>;
public updatePet(body: Pet, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public updatePet(body: Pet, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public updatePet(body: Pet, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling updatePet.');
}
let headers = this.defaultHeaders;
// authentication (petstore_auth) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
'application/json',
'application/xml'
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected != undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.put<any>(`${this.basePath}/pet`,
body,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* 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
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public updatePetWithForm(petId: number, name?: string, status?: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.');
}
let headers = this.defaultHeaders;
// authentication (petstore_auth) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
'application/x-www-form-urlencoded'
];
const canConsumeForm = this.canConsumeForm(consumes);
let formParams: { append(param: string, value: any): void; };
let useForm = false;
let convertFormParamsToString = false;
if (useForm) {
formParams = new FormData();
} else {
formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
}
if (name !== undefined) {
formParams = formParams.append('name', <any>name) || formParams;
}
if (status !== undefined) {
formParams = formParams.append('status', <any>status) || formParams;
}
return this.httpClient.post<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
convertFormParamsToString ? formParams.toString() : formParams,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* uploads an image
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'body', reportProgress?: boolean): Observable<ApiResponse>;
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<ApiResponse>>;
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<ApiResponse>>;
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling uploadFile.');
}
let headers = this.defaultHeaders;
// authentication (petstore_auth) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
'multipart/form-data'
];
const canConsumeForm = this.canConsumeForm(consumes);
let formParams: { append(param: string, value: any): void; };
let useForm = false;
let convertFormParamsToString = false;
// use FormData to transmit files using content-type "multipart/form-data"
// see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data
useForm = canConsumeForm;
if (useForm) {
formParams = new FormData();
} else {
formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
}
if (additionalMetadata !== undefined) {
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) || formParams;
}
if (file !== undefined) {
formParams = formParams.append('file', <any>file) || formParams;
}
return this.httpClient.post<ApiResponse>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,
convertFormParamsToString ? formParams.toString() : formParams,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
}

View File

@ -1,231 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent } from '@angular/common/http';
import { CustomHttpUrlEncodingCodec } from '../encoder';
import { Observable } from 'rxjs/Observable';
import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
@Injectable()
export class StoreService {
protected basePath = 'https://petstore.swagger.io/v2';
public defaultHeaders = new HttpHeaders();
public configuration = new Configuration();
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
}
}
/**
* @param consumes string[] mime-types
* @return true: consumes contains 'multipart/form-data', false: otherwise
*/
private canConsumeForm(consumes: string[]): boolean {
const form = 'multipart/form-data';
for (const consume of consumes) {
if (form === consume) {
return true;
}
}
return false;
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors
* @param orderId ID of the order that needs to be deleted
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public deleteOrder(orderId: number, observe?: 'body', reportProgress?: boolean): Observable<any>;
public deleteOrder(orderId: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public deleteOrder(orderId: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public deleteOrder(orderId: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (orderId === null || orderId === undefined) {
throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.');
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.delete<any>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getInventory(observe?: 'body', reportProgress?: boolean): Observable<{ [key: string]: number; }>;
public getInventory(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<{ [key: string]: number; }>>;
public getInventory(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<{ [key: string]: number; }>>;
public getInventory(observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
let headers = this.defaultHeaders;
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
headers = headers.set('api_key', this.configuration.apiKeys["api_key"]);
}
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.get<{ [key: string]: number; }>(`${this.basePath}/store/inventory`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &gt;&#x3D; 1 and &lt;&#x3D; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getOrderById(orderId: number, observe?: 'body', reportProgress?: boolean): Observable<Order>;
public getOrderById(orderId: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Order>>;
public getOrderById(orderId: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Order>>;
public getOrderById(orderId: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (orderId === null || orderId === undefined) {
throw new Error('Required parameter orderId was null or undefined when calling getOrderById.');
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.get<Order>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Place an order for a pet
*
* @param body order placed for purchasing the pet
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public placeOrder(body: Order, observe?: 'body', reportProgress?: boolean): Observable<Order>;
public placeOrder(body: Order, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Order>>;
public placeOrder(body: Order, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Order>>;
public placeOrder(body: Order, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling placeOrder.');
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected != undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<Order>(`${this.basePath}/store/order`,
body,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
}

View File

@ -1,429 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent } from '@angular/common/http';
import { CustomHttpUrlEncodingCodec } from '../encoder';
import { Observable } from 'rxjs/Observable';
import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
@Injectable()
export class UserService {
protected basePath = 'https://petstore.swagger.io/v2';
public defaultHeaders = new HttpHeaders();
public configuration = new Configuration();
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
}
}
/**
* @param consumes string[] mime-types
* @return true: consumes contains 'multipart/form-data', false: otherwise
*/
private canConsumeForm(consumes: string[]): boolean {
const form = 'multipart/form-data';
for (const consume of consumes) {
if (form === consume) {
return true;
}
}
return false;
}
/**
* Create user
* This can only be done by the logged in user.
* @param body Created user object
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public createUser(body: User, observe?: 'body', reportProgress?: boolean): Observable<any>;
public createUser(body: User, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public createUser(body: User, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public createUser(body: User, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUser.');
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected != undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.basePath}/user`,
body,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Creates list of users with given input array
*
* @param body List of user object
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public createUsersWithArrayInput(body: Array<User>, observe?: 'body', reportProgress?: boolean): Observable<any>;
public createUsersWithArrayInput(body: Array<User>, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public createUsersWithArrayInput(body: Array<User>, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public createUsersWithArrayInput(body: Array<User>, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.');
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected != undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.basePath}/user/createWithArray`,
body,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Creates list of users with given input array
*
* @param body List of user object
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public createUsersWithListInput(body: Array<User>, observe?: 'body', reportProgress?: boolean): Observable<any>;
public createUsersWithListInput(body: Array<User>, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public createUsersWithListInput(body: Array<User>, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public createUsersWithListInput(body: Array<User>, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.');
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected != undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.basePath}/user/createWithList`,
body,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public deleteUser(username: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
public deleteUser(username: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public deleteUser(username: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public deleteUser(username: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling deleteUser.');
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.delete<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getUserByName(username: string, observe?: 'body', reportProgress?: boolean): Observable<User>;
public getUserByName(username: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<User>>;
public getUserByName(username: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<User>>;
public getUserByName(username: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling getUserByName.');
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.get<User>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Logs user into the system
*
* @param username The user name for login
* @param password The password for login in clear text
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public loginUser(username: string, password: string, observe?: 'body', reportProgress?: boolean): Observable<string>;
public loginUser(username: string, password: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<string>>;
public loginUser(username: string, password: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<string>>;
public loginUser(username: string, password: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling loginUser.');
}
if (password === null || password === undefined) {
throw new Error('Required parameter password was null or undefined when calling loginUser.');
}
let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
if (username !== undefined && username !== null) {
queryParameters = queryParameters.set('username', <any>username);
}
if (password !== undefined && password !== null) {
queryParameters = queryParameters.set('password', <any>password);
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.get<string>(`${this.basePath}/user/login`,
{
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Logs out current logged in user session
*
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public logoutUser(observe?: 'body', reportProgress?: boolean): Observable<any>;
public logoutUser(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public logoutUser(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public logoutUser(observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.get<any>(`${this.basePath}/user/logout`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be updated
* @param body Updated user object
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public updateUser(username: string, body: User, observe?: 'body', reportProgress?: boolean): Observable<any>;
public updateUser(username: string, body: User, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public updateUser(username: string, body: User, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public updateUser(username: string, body: User, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling updateUser.');
}
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling updateUser.');
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected != undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.put<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
body,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
}

View File

@ -1,79 +0,0 @@
export interface ConfigurationParameters {
apiKeys?: {[ key: string ]: string};
username?: string;
password?: string;
accessToken?: string | (() => string);
basePath?: string;
withCredentials?: boolean;
}
export class Configuration {
apiKeys?: {[ key: string ]: string};
username?: string;
password?: string;
accessToken?: string | (() => string);
basePath?: string;
withCredentials?: boolean;
constructor(configurationParameters: ConfigurationParameters = {}) {
this.apiKeys = configurationParameters.apiKeys;
this.username = configurationParameters.username;
this.password = configurationParameters.password;
this.accessToken = configurationParameters.accessToken;
this.basePath = configurationParameters.basePath;
this.withCredentials = configurationParameters.withCredentials;
}
/**
* Select the correct content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param contentTypes - the array of content types that are available for selection
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
*/
public selectHeaderContentType (contentTypes: string[]): string | undefined {
if (contentTypes.length == 0) {
return undefined;
}
let type = contentTypes.find(x => this.isJsonMime(x));
if (type === undefined) {
return contentTypes[0];
}
return type;
}
/**
* Select the correct accept content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param accepts - the array of content types that are available for selection.
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
*/
public selectHeaderAccept(accepts: string[]): string | undefined {
if (accepts.length == 0) {
return undefined;
}
let type = accepts.find(x => this.isJsonMime(x));
if (type === undefined) {
return accepts[0];
}
return type;
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
}

View File

@ -1,18 +0,0 @@
import { HttpUrlEncodingCodec } from '@angular/common/http';
/**
* CustomHttpUrlEncodingCodec
* Fix plus sign (+) not encoding, so sent as blank space
* See: https://github.com/angular/angular/issues/11058#issuecomment-247367318
*/
export class CustomHttpUrlEncodingCodec extends HttpUrlEncodingCodec {
encodeKey(k: string): string {
k = super.encodeKey(k);
return k.replace(/\+/gi, '%2B');
}
encodeValue(v: string): string {
v = super.encodeValue(v);
return v.replace(/\+/gi, '%2B');
}
}

View File

@ -1,52 +0,0 @@
#!/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 credential 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'

View File

@ -1,5 +0,0 @@
export * from './api/api';
export * from './model/models';
export * from './variables';
export * from './configuration';
export * from './api.module';

View File

@ -1,18 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface ApiResponse {
code?: number;
type?: string;
message?: string;
}

View File

@ -1,17 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface Category {
id?: number;
name?: string;
}

View File

@ -1,6 +0,0 @@
export * from './apiResponse';
export * from './category';
export * from './order';
export * from './pet';
export * from './tag';
export * from './user';

View File

@ -1,32 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface Order {
id?: number;
petId?: number;
quantity?: number;
shipDate?: Date;
/**
* Order Status
*/
status?: Order.StatusEnum;
complete?: boolean;
}
export namespace Order {
export type StatusEnum = 'placed' | 'approved' | 'delivered';
export const StatusEnum = {
Placed: 'placed' as StatusEnum,
Approved: 'approved' as StatusEnum,
Delivered: 'delivered' as StatusEnum
};
}

View File

@ -1,34 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { Category } from './category';
import { Tag } from './tag';
export interface Pet {
id?: number;
category?: Category;
name: string;
photoUrls: Array<string>;
tags?: Array<Tag>;
/**
* pet status in the store
*/
status?: Pet.StatusEnum;
}
export namespace Pet {
export type StatusEnum = 'available' | 'pending' | 'sold';
export const StatusEnum = {
Available: 'available' as StatusEnum,
Pending: 'pending' as StatusEnum,
Sold: 'sold' as StatusEnum
};
}

View File

@ -1,17 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface Tag {
id?: number;
name?: string;
}

View File

@ -1,26 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface User {
id?: number;
username?: string;
firstName?: string;
lastName?: string;
email?: string;
password?: string;
phone?: string;
/**
* User Status
*/
userStatus?: number;
}

View File

@ -1,9 +0,0 @@
import { InjectionToken } from '@angular/core';
export const BASE_PATH = new InjectionToken<string>('basePath');
export const COLLECTION_FORMATS = {
'csv': ',',
'tsv': ' ',
'ssv': ' ',
'pipes': '|'
}

View File

@ -1,3 +0,0 @@
wwwroot/*.js
node_modules
typings

View File

@ -1,23 +0,0 @@
# 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

View File

@ -1,9 +0,0 @@
import * as api from './api/api';
import * as angular from 'angular';
const apiModule = angular.module('api', [])
.service('PetApi', api.PetApi)
.service('StoreApi', api.StoreApi)
.service('UserApi', api.UserApi)
export default apiModule;

View File

@ -1,292 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from '../model/models';
/* tslint:disable:no-unused-variable member-ordering */
export class PetApi {
protected basePath = 'https://petstore.swagger.io/v2';
public defaultHeaders : any = {};
static $inject: string[] = ['$http', '$httpParamSerializer', 'basePath'];
constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) {
if (basePath !== undefined) {
this.basePath = basePath;
}
}
/**
*
* @summary Add a new pet to the store
* @param body Pet object that needs to be added to the store
*/
public addPet (body: models.Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const localVarPath = this.basePath + '/pet';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling addPet.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'POST',
url: localVarPath,
data: body,
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
/**
*
* @summary Deletes a pet
* @param petId Pet id to delete
* @param apiKey
*/
public deletePet (petId: number, apiKey?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const localVarPath = this.basePath + '/pet/{petId}'
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
// verify required parameter 'petId' is not null or undefined
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling deletePet.');
}
headerParams['api_key'] = apiKey;
let httpRequestParams: ng.IRequestConfig = {
method: 'DELETE',
url: localVarPath,
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
/**
* Multiple status values can be provided with comma separated strings
* @summary Finds Pets by status
* @param status Status values that need to be considered for filter
*/
public findPetsByStatus (status: Array<'available' | 'pending' | 'sold'>, extraHttpRequestParams?: any ) : ng.IHttpPromise<Array<models.Pet>> {
const localVarPath = this.basePath + '/pet/findByStatus';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
// verify required parameter 'status' is not null or undefined
if (status === null || status === undefined) {
throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
}
if (status !== undefined) {
queryParameters['status'] = status;
}
let httpRequestParams: ng.IRequestConfig = {
method: 'GET',
url: localVarPath,
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
/**
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @summary Finds Pets by tags
* @param tags Tags to filter by
*/
public findPetsByTags (tags: Array<string>, extraHttpRequestParams?: any ) : ng.IHttpPromise<Array<models.Pet>> {
const localVarPath = this.basePath + '/pet/findByTags';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
// verify required parameter 'tags' is not null or undefined
if (tags === null || tags === undefined) {
throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.');
}
if (tags !== undefined) {
queryParameters['tags'] = tags;
}
let httpRequestParams: ng.IRequestConfig = {
method: 'GET',
url: localVarPath,
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
/**
* Returns a single pet
* @summary Find pet by ID
* @param petId ID of pet to return
*/
public getPetById (petId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise<models.Pet> {
const localVarPath = this.basePath + '/pet/{petId}'
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
// verify required parameter 'petId' is not null or undefined
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling getPetById.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'GET',
url: localVarPath,
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
/**
*
* @summary Update an existing pet
* @param body Pet object that needs to be added to the store
*/
public updatePet (body: models.Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const localVarPath = this.basePath + '/pet';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling updatePet.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'PUT',
url: localVarPath,
data: body,
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
/**
*
* @summary 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: number, name?: string, status?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const localVarPath = this.basePath + '/pet/{petId}'
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {};
// verify required parameter 'petId' is not null or undefined
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.');
}
headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
formParams['name'] = name;
formParams['status'] = status;
let httpRequestParams: ng.IRequestConfig = {
method: 'POST',
url: localVarPath,
data: this.$httpParamSerializer(formParams),
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
/**
*
* @summary uploads an image
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
*/
public uploadFile (petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any ) : ng.IHttpPromise<models.ApiResponse> {
const localVarPath = this.basePath + '/pet/{petId}/uploadImage'
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {};
// verify required parameter 'petId' is not null or undefined
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling uploadFile.');
}
headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
formParams['additionalMetadata'] = additionalMetadata;
formParams['file'] = file;
let httpRequestParams: ng.IRequestConfig = {
method: 'POST',
url: localVarPath,
data: this.$httpParamSerializer(formParams),
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
}

View File

@ -1,138 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from '../model/models';
/* tslint:disable:no-unused-variable member-ordering */
export class StoreApi {
protected basePath = 'https://petstore.swagger.io/v2';
public defaultHeaders : any = {};
static $inject: string[] = ['$http', '$httpParamSerializer', 'basePath'];
constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) {
if (basePath !== undefined) {
this.basePath = basePath;
}
}
/**
* For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors
* @summary Delete purchase order by ID
* @param orderId ID of the order that needs to be deleted
*/
public deleteOrder (orderId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const localVarPath = this.basePath + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
// verify required parameter 'orderId' is not null or undefined
if (orderId === null || orderId === undefined) {
throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'DELETE',
url: localVarPath,
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
/**
* Returns a map of status codes to quantities
* @summary Returns pet inventories by status
*/
public getInventory (extraHttpRequestParams?: any ) : ng.IHttpPromise<{ [key: string]: number; }> {
const localVarPath = this.basePath + '/store/inventory';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let httpRequestParams: ng.IRequestConfig = {
method: 'GET',
url: localVarPath,
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
/**
* For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions
* @summary Find purchase order by ID
* @param orderId ID of pet that needs to be fetched
*/
public getOrderById (orderId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise<models.Order> {
const localVarPath = this.basePath + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
// verify required parameter 'orderId' is not null or undefined
if (orderId === null || orderId === undefined) {
throw new Error('Required parameter orderId was null or undefined when calling getOrderById.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'GET',
url: localVarPath,
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
/**
*
* @summary Place an order for a pet
* @param body order placed for purchasing the pet
*/
public placeOrder (body: models.Order, extraHttpRequestParams?: any ) : ng.IHttpPromise<models.Order> {
const localVarPath = this.basePath + '/store/order';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling placeOrder.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'POST',
url: localVarPath,
data: body,
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
}

View File

@ -1,274 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from '../model/models';
/* tslint:disable:no-unused-variable member-ordering */
export class UserApi {
protected basePath = 'https://petstore.swagger.io/v2';
public defaultHeaders : any = {};
static $inject: string[] = ['$http', '$httpParamSerializer', 'basePath'];
constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) {
if (basePath !== undefined) {
this.basePath = basePath;
}
}
/**
* This can only be done by the logged in user.
* @summary Create user
* @param body Created user object
*/
public createUser (body: models.User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const localVarPath = this.basePath + '/user';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUser.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'POST',
url: localVarPath,
data: body,
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
/**
*
* @summary Creates list of users with given input array
* @param body List of user object
*/
public createUsersWithArrayInput (body: Array<models.User>, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const localVarPath = this.basePath + '/user/createWithArray';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'POST',
url: localVarPath,
data: body,
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
/**
*
* @summary Creates list of users with given input array
* @param body List of user object
*/
public createUsersWithListInput (body: Array<models.User>, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const localVarPath = this.basePath + '/user/createWithList';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'POST',
url: localVarPath,
data: body,
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
/**
* This can only be done by the logged in user.
* @summary Delete user
* @param username The name that needs to be deleted
*/
public deleteUser (username: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const localVarPath = this.basePath + '/user/{username}'
.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
// verify required parameter 'username' is not null or undefined
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling deleteUser.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'DELETE',
url: localVarPath,
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
/**
*
* @summary Get user by user name
* @param username The name that needs to be fetched. Use user1 for testing.
*/
public getUserByName (username: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<models.User> {
const localVarPath = this.basePath + '/user/{username}'
.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
// verify required parameter 'username' is not null or undefined
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling getUserByName.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'GET',
url: localVarPath,
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
/**
*
* @summary Logs user into the system
* @param username The user name for login
* @param password The password for login in clear text
*/
public loginUser (username: string, password: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<string> {
const localVarPath = this.basePath + '/user/login';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
// verify required parameter 'username' is not null or undefined
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling loginUser.');
}
// verify required parameter 'password' is not null or undefined
if (password === null || password === undefined) {
throw new Error('Required parameter password was null or undefined when calling loginUser.');
}
if (username !== undefined) {
queryParameters['username'] = username;
}
if (password !== undefined) {
queryParameters['password'] = password;
}
let httpRequestParams: ng.IRequestConfig = {
method: 'GET',
url: localVarPath,
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
/**
*
* @summary Logs out current logged in user session
*/
public logoutUser (extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const localVarPath = this.basePath + '/user/logout';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let httpRequestParams: ng.IRequestConfig = {
method: 'GET',
url: localVarPath,
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
/**
* This can only be done by the logged in user.
* @summary Updated user
* @param username name that need to be updated
* @param body Updated user object
*/
public updateUser (username: string, body: models.User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const localVarPath = this.basePath + '/user/{username}'
.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
// verify required parameter 'username' is not null or undefined
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling updateUser.');
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling updateUser.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'PUT',
url: localVarPath,
data: body,
params: queryParameters,
headers: headerParams
};
if (extraHttpRequestParams) {
httpRequestParams = (<any>Object).assign(httpRequestParams, extraHttpRequestParams);
}
return this.$http(httpRequestParams);
}
}

View File

@ -1,7 +0,0 @@
export * from './PetApi';
import { PetApi } from './PetApi';
export * from './StoreApi';
import { StoreApi } from './StoreApi';
export * from './UserApi';
import { UserApi } from './UserApi';
export const APIS = [PetApi, StoreApi, UserApi];

View File

@ -1,52 +0,0 @@
#!/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 credential 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'

View File

@ -1,2 +0,0 @@
export * from './api/api';
export * from './model/models';

View File

@ -1,20 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from './models';
export interface ApiResponse {
"code"?: number;
"type"?: string;
"message"?: string;
}

View File

@ -1,19 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from './models';
export interface Category {
"id"?: number;
"name"?: string;
}

View File

@ -1,33 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from './models';
export interface Order {
"id"?: number;
"petId"?: number;
"quantity"?: number;
"shipDate"?: Date;
/**
* Order Status
*/
"status"?: Order.StatusEnum;
"complete"?: boolean;
}
export namespace Order {
export enum StatusEnum {
Placed = <any> 'placed',
Approved = <any> 'approved',
Delivered = <any> 'delivered'
}
}

View File

@ -1,33 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from './models';
export interface Pet {
"id"?: number;
"category"?: models.Category;
"name": string;
"photoUrls": Array<string>;
"tags"?: Array<models.Tag>;
/**
* pet status in the store
*/
"status"?: Pet.StatusEnum;
}
export namespace Pet {
export enum StatusEnum {
Available = <any> 'available',
Pending = <any> 'pending',
Sold = <any> 'sold'
}
}

View File

@ -1,19 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from './models';
export interface Tag {
"id"?: number;
"name"?: string;
}

View File

@ -1,28 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from './models';
export interface User {
"id"?: number;
"username"?: string;
"firstName"?: string;
"lastName"?: string;
"email"?: string;
"password"?: string;
"phone"?: string;
/**
* User Status
*/
"userStatus"?: number;
}

View File

@ -1,6 +0,0 @@
export * from './ApiResponse';
export * from './Category';
export * from './Order';
export * from './Pet';
export * from './Tag';
export * from './User';

View File

@ -1,3 +0,0 @@
wwwroot/*.js
node_modules
typings

View File

@ -1,23 +0,0 @@
# 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

View File

@ -1,76 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { HttpClient } from 'aurelia-http-client';
import { AuthStorage } from './AuthStorage';
const BASE_PATH = 'https://petstore.swagger.io/v2'.replace(/\/+$/, '');
export class Api {
basePath: string;
httpClient: HttpClient;
authStorage: AuthStorage;
constructor(httpClient: HttpClient, authStorage: AuthStorage, basePath: string = BASE_PATH) {
this.basePath = basePath;
this.httpClient = httpClient;
this.authStorage = authStorage;
}
/**
* Encodes a query string.
*
* @param params The params to encode.
* @return An encoded query string.
*/
protected queryString(params: { [key: string]: any }): string {
const queries = [];
for (let key in params) {
const value = this.toString(params[key]);
if (value != null) {
queries.push(`${key}=${encodeURIComponent(value)}`);
}
}
return queries.join('&');
}
/**
* Converts a value to string.
*
* @param value The value to convert.
*/
protected toString(value: any): string | null {
if (value === null) {
return null;
}
switch (typeof value) {
case 'undefined': return null;
case 'boolean': return value ? 'true' : 'false';
case 'string': return value;
default: return '' + value;
}
}
/**
* Ensures that a given parameter is set.
*
* @param context A name for the callee's context.
* @param params The parameters being set.
* @param paramName The required parameter to check.
*/
protected ensureParamIsSet<T>(context: string, params: T, paramName: keyof T): void {
if (null === params[paramName]) {
throw new Error(`Missing required parameter ${paramName} when calling ${context}`);
}
}
}

View File

@ -1,72 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/**
* Class to storage authentication data
*/
export class AuthStorage {
private storage: Map<string, string>;
constructor() {
this.storage = new Map();
}
/**
* Sets the api_key auth method value.
*
* @param value The new value to set for api_key.
*/
setapi_key(value: string): this {
this.storage.set('api_key', value);
return this;
}
/**
* Removes the api_key auth method value.
*/
removeapi_key(): this {
this.storage.delete('api_key');
return this;
}
/**
* Gets the api_key auth method value.
*/
getapi_key(): null | string {
return this.storage.get('api_key') || null;
}
/**
* Sets the petstore_auth auth method value.
*
* @param value The new value to set for petstore_auth.
*/
setpetstore_auth(value: string): this {
this.storage.set('petstore_auth', value);
return this;
}
/**
* Removes the petstore_auth auth method value.
*/
removepetstore_auth(): this {
this.storage.delete('petstore_auth');
return this;
}
/**
* Gets the petstore_auth auth method value.
*/
getpetstore_auth(): null | string {
return this.storage.get('petstore_auth') || null;
}
}

View File

@ -1,360 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { autoinject } from 'aurelia-framework';
import { HttpClient } from 'aurelia-http-client';
import { Api } from './Api';
import { AuthStorage } from './AuthStorage';
import {
Pet,
ApiResponse,
} from './models';
/**
* addPet - parameters interface
*/
export interface IAddPetParams {
body: Pet;
}
/**
* deletePet - parameters interface
*/
export interface IDeletePetParams {
petId: number;
apiKey?: string;
}
/**
* findPetsByStatus - parameters interface
*/
export interface IFindPetsByStatusParams {
status: Array<'available' | 'pending' | 'sold'>;
}
/**
* findPetsByTags - parameters interface
*/
export interface IFindPetsByTagsParams {
tags: Array<string>;
}
/**
* getPetById - parameters interface
*/
export interface IGetPetByIdParams {
petId: number;
}
/**
* updatePet - parameters interface
*/
export interface IUpdatePetParams {
body: Pet;
}
/**
* updatePetWithForm - parameters interface
*/
export interface IUpdatePetWithFormParams {
petId: number;
name?: string;
status?: string;
}
/**
* uploadFile - parameters interface
*/
export interface IUploadFileParams {
petId: number;
additionalMetadata?: string;
file?: any;
}
/**
* PetApi - API class
*/
@autoinject()
export class PetApi extends Api {
/**
* Creates a new PetApi class.
*
* @param httpClient The Aurelia HTTP client to be injected.
* @param authStorage A storage for authentication data.
*/
constructor(httpClient: HttpClient, authStorage: AuthStorage) {
super(httpClient, authStorage);
}
/**
* Add a new pet to the store
*
* @param params.body Pet object that needs to be added to the store
*/
async addPet(params: IAddPetParams): Promise<any> {
// Verify required parameters are set
this.ensureParamIsSet('addPet', params, 'body');
// Create URL to call
const url = `${this.basePath}/pet`;
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asPost()
// Encode body parameter
.withHeader('content-type', 'application/json')
.withContent(JSON.stringify(params['body'] || {}))
// Authentication 'petstore_auth' required
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
/**
* Deletes a pet
*
* @param params.petId Pet id to delete
* @param params.apiKey
*/
async deletePet(params: IDeletePetParams): Promise<any> {
// Verify required parameters are set
this.ensureParamIsSet('deletePet', params, 'petId');
// Create URL to call
const url = `${this.basePath}/pet/{petId}`
.replace(`{${'petId'}}`, encodeURIComponent(`${params['petId']}`));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asDelete()
.withHeader('api_key', params['apiKey'])
// Authentication 'petstore_auth' required
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param params.status Status values that need to be considered for filter
*/
async findPetsByStatus(params: IFindPetsByStatusParams): Promise<Array<Pet>> {
// Verify required parameters are set
this.ensureParamIsSet('findPetsByStatus', params, 'status');
// Create URL to call
const url = `${this.basePath}/pet/findByStatus`;
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asGet()
// Set query parameters
.withParams({
'status': params['status'],
})
// Authentication 'petstore_auth' required
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param params.tags Tags to filter by
*/
async findPetsByTags(params: IFindPetsByTagsParams): Promise<Array<Pet>> {
// Verify required parameters are set
this.ensureParamIsSet('findPetsByTags', params, 'tags');
// Create URL to call
const url = `${this.basePath}/pet/findByTags`;
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asGet()
// Set query parameters
.withParams({
'tags': params['tags'],
})
// Authentication 'petstore_auth' required
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
/**
* Find pet by ID
* Returns a single pet
* @param params.petId ID of pet to return
*/
async getPetById(params: IGetPetByIdParams): Promise<Pet> {
// Verify required parameters are set
this.ensureParamIsSet('getPetById', params, 'petId');
// Create URL to call
const url = `${this.basePath}/pet/{petId}`
.replace(`{${'petId'}}`, encodeURIComponent(`${params['petId']}`));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asGet()
// Authentication 'api_key' required
.withHeader('api_key', this.authStorage.getapi_key())
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
/**
* Update an existing pet
*
* @param params.body Pet object that needs to be added to the store
*/
async updatePet(params: IUpdatePetParams): Promise<any> {
// Verify required parameters are set
this.ensureParamIsSet('updatePet', params, 'body');
// Create URL to call
const url = `${this.basePath}/pet`;
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asPut()
// Encode body parameter
.withHeader('content-type', 'application/json')
.withContent(JSON.stringify(params['body'] || {}))
// Authentication 'petstore_auth' required
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
/**
* Updates a pet in the store with form data
*
* @param params.petId ID of pet that needs to be updated
* @param params.name Updated name of the pet
* @param params.status Updated status of the pet
*/
async updatePetWithForm(params: IUpdatePetWithFormParams): Promise<any> {
// Verify required parameters are set
this.ensureParamIsSet('updatePetWithForm', params, 'petId');
// Create URL to call
const url = `${this.basePath}/pet/{petId}`
.replace(`{${'petId'}}`, encodeURIComponent(`${params['petId']}`));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asPost()
// Encode form parameters
.withHeader('content-type', 'application/x-www-form-urlencoded')
.withContent(this.queryString({
'name': params['name'],
'status': params['status'],
}))
// Authentication 'petstore_auth' required
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
/**
* uploads an image
*
* @param params.petId ID of pet to update
* @param params.additionalMetadata Additional data to pass to server
* @param params.file file to upload
*/
async uploadFile(params: IUploadFileParams): Promise<ApiResponse> {
// Verify required parameters are set
this.ensureParamIsSet('uploadFile', params, 'petId');
// Create URL to call
const url = `${this.basePath}/pet/{petId}/uploadImage`
.replace(`{${'petId'}}`, encodeURIComponent(`${params['petId']}`));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asPost()
// Encode form parameters
.withHeader('content-type', 'application/x-www-form-urlencoded')
.withContent(this.queryString({
'additionalMetadata': params['additionalMetadata'],
'file': params['file'],
}))
// Authentication 'petstore_auth' required
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
}

View File

@ -1,55 +0,0 @@
# TypeScript-Aurelia
This generator creates TypeScript/JavaScript client that is injectable by [Aurelia](http://aurelia.io/).
The generated Node module can be used in the following environments:
Environment
* Node.js
* Webpack
* Browserify
Language level
* ES5 - you must have a Promises/A+ library installed
* ES6
Module system
* CommonJS
* ES6 module system
It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html))
### Installation ###
`swagger-codegen` does not generate JavaScript directly. The generated Node module comes with `package.json` that bundles `typescript` and `typings` so it can self-compile during `prepublish` stage. The should be run automatically during `npm install` or `npm publish`.
CAVEAT: Due to [privilege implications](https://docs.npmjs.com/misc/scripts#user), `npm` would skip all scripts if the user is `root`. You would need to manually run it with `npm run prepublish` or run `npm install --unsafe-perm`.
#### NPM ####
You may publish the module to NPM. In this case, you would be able to install the module as any other NPM module. It maybe useful to use [scoped packages](https://docs.npmjs.com/misc/scope).
You can also use `npm link` to link the module. However, this would not modify `package.json` of the installing project, as such you would need to relink every time you deploy that project.
You can also directly install the module using `npm install file_path`. If you do `npm install file_path --save`, NPM will save relative path to `package.json`. In this case, `npm install` and `npm shrinkwrap` may misbehave. You would need to manually edit `package.json` and replace it with absolute path.
Regardless of which method you deployed your NPM module, the ES6 module syntaxes are as follows:
```
import * as localName from 'npmName';
import {operationId} from 'npmName';
```
The CommonJS syntax is as follows:
```
import localName = require('npmName');
```
#### Direct copy/symlink ####
You may also simply copy or symlink the generated module into a directory under your project. The syntax of this is as follows:
With ES6 module syntax, the following syntaxes are supported:
```
import * as localName from './symlinkDir';
import {operationId} from './symlinkDir';
```
The CommonJS syntax is as follows:
```
import localName = require('./symlinkDir')';
```

View File

@ -1,178 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { autoinject } from 'aurelia-framework';
import { HttpClient } from 'aurelia-http-client';
import { Api } from './Api';
import { AuthStorage } from './AuthStorage';
import {
Order,
} from './models';
/**
* deleteOrder - parameters interface
*/
export interface IDeleteOrderParams {
orderId: number;
}
/**
* getInventory - parameters interface
*/
export interface IGetInventoryParams {
}
/**
* getOrderById - parameters interface
*/
export interface IGetOrderByIdParams {
orderId: number;
}
/**
* placeOrder - parameters interface
*/
export interface IPlaceOrderParams {
body: Order;
}
/**
* StoreApi - API class
*/
@autoinject()
export class StoreApi extends Api {
/**
* Creates a new StoreApi class.
*
* @param httpClient The Aurelia HTTP client to be injected.
* @param authStorage A storage for authentication data.
*/
constructor(httpClient: HttpClient, authStorage: AuthStorage) {
super(httpClient, authStorage);
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors
* @param params.orderId ID of the order that needs to be deleted
*/
async deleteOrder(params: IDeleteOrderParams): Promise<any> {
// Verify required parameters are set
this.ensureParamIsSet('deleteOrder', params, 'orderId');
// Create URL to call
const url = `${this.basePath}/store/order/{orderId}`
.replace(`{${'orderId'}}`, encodeURIComponent(`${params['orderId']}`));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asDelete()
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
*/
async getInventory(): Promise<{ [key: string]: number; }> {
// Verify required parameters are set
// Create URL to call
const url = `${this.basePath}/store/inventory`;
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asGet()
// Authentication 'api_key' required
.withHeader('api_key', this.authStorage.getapi_key())
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &gt;&#x3D; 1 and &lt;&#x3D; 10. Other values will generated exceptions
* @param params.orderId ID of pet that needs to be fetched
*/
async getOrderById(params: IGetOrderByIdParams): Promise<Order> {
// Verify required parameters are set
this.ensureParamIsSet('getOrderById', params, 'orderId');
// Create URL to call
const url = `${this.basePath}/store/order/{orderId}`
.replace(`{${'orderId'}}`, encodeURIComponent(`${params['orderId']}`));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asGet()
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
/**
* Place an order for a pet
*
* @param params.body order placed for purchasing the pet
*/
async placeOrder(params: IPlaceOrderParams): Promise<Order> {
// Verify required parameters are set
this.ensureParamIsSet('placeOrder', params, 'body');
// Create URL to call
const url = `${this.basePath}/store/order`;
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asPost()
// Encode body parameter
.withHeader('content-type', 'application/json')
.withContent(JSON.stringify(params['body'] || {}))
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
}

View File

@ -1,333 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { autoinject } from 'aurelia-framework';
import { HttpClient } from 'aurelia-http-client';
import { Api } from './Api';
import { AuthStorage } from './AuthStorage';
import {
User,
} from './models';
/**
* createUser - parameters interface
*/
export interface ICreateUserParams {
body: User;
}
/**
* createUsersWithArrayInput - parameters interface
*/
export interface ICreateUsersWithArrayInputParams {
body: Array<User>;
}
/**
* createUsersWithListInput - parameters interface
*/
export interface ICreateUsersWithListInputParams {
body: Array<User>;
}
/**
* deleteUser - parameters interface
*/
export interface IDeleteUserParams {
username: string;
}
/**
* getUserByName - parameters interface
*/
export interface IGetUserByNameParams {
username: string;
}
/**
* loginUser - parameters interface
*/
export interface ILoginUserParams {
username: string;
password: string;
}
/**
* logoutUser - parameters interface
*/
export interface ILogoutUserParams {
}
/**
* updateUser - parameters interface
*/
export interface IUpdateUserParams {
username: string;
body: User;
}
/**
* UserApi - API class
*/
@autoinject()
export class UserApi extends Api {
/**
* Creates a new UserApi class.
*
* @param httpClient The Aurelia HTTP client to be injected.
* @param authStorage A storage for authentication data.
*/
constructor(httpClient: HttpClient, authStorage: AuthStorage) {
super(httpClient, authStorage);
}
/**
* Create user
* This can only be done by the logged in user.
* @param params.body Created user object
*/
async createUser(params: ICreateUserParams): Promise<any> {
// Verify required parameters are set
this.ensureParamIsSet('createUser', params, 'body');
// Create URL to call
const url = `${this.basePath}/user`;
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asPost()
// Encode body parameter
.withHeader('content-type', 'application/json')
.withContent(JSON.stringify(params['body'] || {}))
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
/**
* Creates list of users with given input array
*
* @param params.body List of user object
*/
async createUsersWithArrayInput(params: ICreateUsersWithArrayInputParams): Promise<any> {
// Verify required parameters are set
this.ensureParamIsSet('createUsersWithArrayInput', params, 'body');
// Create URL to call
const url = `${this.basePath}/user/createWithArray`;
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asPost()
// Encode body parameter
.withHeader('content-type', 'application/json')
.withContent(JSON.stringify(params['body'] || {}))
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
/**
* Creates list of users with given input array
*
* @param params.body List of user object
*/
async createUsersWithListInput(params: ICreateUsersWithListInputParams): Promise<any> {
// Verify required parameters are set
this.ensureParamIsSet('createUsersWithListInput', params, 'body');
// Create URL to call
const url = `${this.basePath}/user/createWithList`;
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asPost()
// Encode body parameter
.withHeader('content-type', 'application/json')
.withContent(JSON.stringify(params['body'] || {}))
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
/**
* Delete user
* This can only be done by the logged in user.
* @param params.username The name that needs to be deleted
*/
async deleteUser(params: IDeleteUserParams): Promise<any> {
// Verify required parameters are set
this.ensureParamIsSet('deleteUser', params, 'username');
// Create URL to call
const url = `${this.basePath}/user/{username}`
.replace(`{${'username'}}`, encodeURIComponent(`${params['username']}`));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asDelete()
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
/**
* Get user by user name
*
* @param params.username The name that needs to be fetched. Use user1 for testing.
*/
async getUserByName(params: IGetUserByNameParams): Promise<User> {
// Verify required parameters are set
this.ensureParamIsSet('getUserByName', params, 'username');
// Create URL to call
const url = `${this.basePath}/user/{username}`
.replace(`{${'username'}}`, encodeURIComponent(`${params['username']}`));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asGet()
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
/**
* Logs user into the system
*
* @param params.username The user name for login
* @param params.password The password for login in clear text
*/
async loginUser(params: ILoginUserParams): Promise<string> {
// Verify required parameters are set
this.ensureParamIsSet('loginUser', params, 'username');
this.ensureParamIsSet('loginUser', params, 'password');
// Create URL to call
const url = `${this.basePath}/user/login`;
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asGet()
// Set query parameters
.withParams({
'username': params['username'],
'password': params['password'],
})
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
/**
* Logs out current logged in user session
*
*/
async logoutUser(): Promise<any> {
// Verify required parameters are set
// Create URL to call
const url = `${this.basePath}/user/logout`;
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asGet()
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
/**
* Updated user
* This can only be done by the logged in user.
* @param params.username name that need to be updated
* @param params.body Updated user object
*/
async updateUser(params: IUpdateUserParams): Promise<any> {
// Verify required parameters are set
this.ensureParamIsSet('updateUser', params, 'username');
this.ensureParamIsSet('updateUser', params, 'body');
// Create URL to call
const url = `${this.basePath}/user/{username}`
.replace(`{${'username'}}`, encodeURIComponent(`${params['username']}`));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
.asPut()
// Encode body parameter
.withHeader('content-type', 'application/json')
.withContent(JSON.stringify(params['body'] || {}))
// Send the request
.send();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw new Error(response.content);
}
// Extract the content
return response.content;
}
}

View File

@ -1,52 +0,0 @@
#!/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 credential 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'

View File

@ -1,25 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export { Api } from './Api';
export { AuthStorage } from './AuthStorage';
export { PetApi } from './PetApi';
export { StoreApi } from './StoreApi';
export { UserApi } from './UserApi';
export {
ApiResponse,
Category,
Order,
Pet,
Tag,
User,
} from './models';

View File

@ -1,76 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface ApiResponse {
code?: number;
type?: string;
message?: string;
}
export interface Category {
id?: number;
name?: string;
}
export interface Order {
id?: number;
petId?: number;
quantity?: number;
shipDate?: Date;
/**
* Order Status
*/
status?: OrderStatusEnum;
complete?: boolean;
}
/**
* Enum for the status property.
*/
export type OrderStatusEnum = 'placed' | 'approved' | 'delivered';
export interface Pet {
id?: number;
category?: Category;
name: string;
photoUrls: Array<string>;
tags?: Array<Tag>;
/**
* pet status in the store
*/
status?: PetStatusEnum;
}
/**
* Enum for the status property.
*/
export type PetStatusEnum = 'available' | 'pending' | 'sold';
export interface Tag {
id?: number;
name?: string;
}
export interface User {
id?: number;
username?: string;
firstName?: string;
lastName?: string;
email?: string;
password?: string;
phone?: string;
/**
* User Status
*/
userStatus?: number;
}

View File

@ -1,21 +0,0 @@
{
"name": "typescript-fetch-api",
"version": "0.0.0",
"license": "Unlicense",
"main": "./dist/api.js",
"browser": "./dist/api.js",
"typings": "./dist/api.d.ts",
"dependencies": {
"core-js": "^2.4.0",
"isomorphic-fetch": "^2.2.1"
},
"scripts" : {
"prepublish" : "typings install && tsc",
"test": "tslint api.ts"
},
"devDependencies": {
"tslint": "^3.15.1",
"typescript": "^1.8.10",
"typings": "^1.0.4"
}
}

View File

@ -1,14 +0,0 @@
{
"compilerOptions": {
"declaration": true,
"target": "es5",
"module": "commonjs",
"noImplicitAny": true,
"outDir": "dist",
"rootDir": "."
},
"exclude": [
"dist",
"node_modules"
]
}

View File

@ -1,101 +0,0 @@
{
"jsRules": {
"class-name": true,
"comment-format": [
true,
"check-space"
],
"indent": [
true,
"spaces"
],
"no-duplicate-variable": true,
"no-eval": true,
"no-trailing-whitespace": true,
"no-unsafe-finally": true,
"one-line": [
true,
"check-open-brace",
"check-whitespace"
],
"quotemark": [
true,
"double"
],
"semicolon": [
true,
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"variable-name": [
true,
"ban-keywords"
],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
]
},
"rules": {
"class-name": true,
"comment-format": [
true,
"check-space"
],
"indent": [
true,
"spaces"
],
"no-eval": true,
"no-internal-module": true,
"no-trailing-whitespace": true,
"no-unsafe-finally": true,
"no-var-keyword": true,
"one-line": [
true,
"check-open-brace",
"check-whitespace"
],
"quotemark": [
true,
"double"
],
"semicolon": [
true,
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"variable-name": [
true,
"ban-keywords"
],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
]
}
}

View File

@ -1,3 +0,0 @@
wwwroot/*.js
node_modules
typings

View File

@ -1,23 +0,0 @@
# 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

File diff suppressed because it is too large Load Diff

View File

@ -1,66 +0,0 @@
// tslint:disable
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface ConfigurationParameters {
apiKey?: string | ((name: string) => string);
username?: string;
password?: string;
accessToken?: string | ((name: string, scopes?: string[]) => string);
basePath?: string;
}
export class Configuration {
/**
* parameter for apiKey security
* @param name security name
* @memberof Configuration
*/
apiKey?: string | ((name: string) => string);
/**
* parameter for basic security
*
* @type {string}
* @memberof Configuration
*/
username?: string;
/**
* parameter for basic security
*
* @type {string}
* @memberof Configuration
*/
password?: string;
/**
* parameter for oauth2 security
* @param name security name
* @param scopes oauth2 scope
* @memberof Configuration
*/
accessToken?: string | ((name: string, scopes?: string[]) => string);
/**
* override base path
*
* @type {string}
* @memberof Configuration
*/
basePath?: string;
constructor(param: ConfigurationParameters = {}) {
this.apiKey = param.apiKey;
this.username = param.username;
this.password = param.password;
this.accessToken = param.accessToken;
this.basePath = param.basePath;
}
}

View File

@ -1,2 +0,0 @@
declare module 'portable-fetch';
declare module 'url';

View File

@ -1,51 +0,0 @@
#!/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 credential 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'

View File

@ -1,16 +0,0 @@
// tslint:disable
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export * from "./api";
export * from "./configuration";

View File

@ -1,23 +0,0 @@
# 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

View File

@ -1,13 +0,0 @@
import {interfaces} from "inversify";
import { PetService } from './api/pet.service';
import { StoreService } from './api/store.service';
import { UserService } from './api/user.service';
export class ApiServiceBinder {
public static with(container: interfaces.Container) {
container.bind<PetService>("PetService").to(PetService).inSingletonScope();
container.bind<StoreService>("StoreService").to(StoreService).inSingletonScope();
container.bind<UserService>("UserService").to(UserService).inSingletonScope();
}
}

View File

@ -1,3 +0,0 @@
export interface Headers {
[index:string]: string
}

View File

@ -1,63 +0,0 @@
import IHttpClient from "./IHttpClient";
import { Observable } from "rxjs/Observable";
import "whatwg-fetch";
import HttpResponse from "./HttpResponse";
import {injectable} from "inversify";
import "rxjs/add/observable/fromPromise";
import { Headers } from "./Headers";
@injectable()
class HttpClient implements IHttpClient {
get(url:string, headers?: Headers):Observable<HttpResponse> {
return this.performNetworkCall(url, "get", undefined, headers);
}
post(url: string, body: {}|FormData, headers?: Headers): Observable<HttpResponse> {
return this.performNetworkCall(url, "post", this.getJsonBody(body), this.addJsonHeaders(headers));
}
put(url: string, body: {}, headers?: Headers): Observable<HttpResponse> {
return this.performNetworkCall(url, "put", this.getJsonBody(body), this.addJsonHeaders(headers));
}
delete(url: string, headers?: Headers): Observable<HttpResponse> {
return this.performNetworkCall(url, "delete", undefined, headers);
}
private getJsonBody(body: {}|FormData) {
return !(body instanceof FormData) ? JSON.stringify(body) : body;
}
private addJsonHeaders(headers: Headers) {
return Object.assign({}, {
"Accept": "application/json",
"Content-Type": "application/json"
}, headers);
};
private performNetworkCall(url: string, method: string, body?: any, headers?: Headers): Observable<HttpResponse> {
let promise = window.fetch(url, {
method: method,
body: body,
headers: <any>headers
}).then(response => {
let headers: Headers = {};
response.headers.forEach((value, name) => {
headers[name.toString().toLowerCase()] = value;
});
return response.text().then(text => {
let contentType = headers["content-type"] || "";
let payload = contentType.match("application/json") ? JSON.parse(text) : text;
let httpResponse = new HttpResponse(payload, response.status, headers);
if (response.status >= 400)
throw httpResponse;
return httpResponse;
});
});
return Observable.fromPromise(promise);
}
}
export default HttpClient

View File

@ -1,8 +0,0 @@
import { Headers } from "./Headers"
class HttpResponse<T = any> {
constructor(public response: T, public status:number, public headers?: Headers) {
}
}
export default HttpResponse

View File

@ -1,8 +0,0 @@
export interface IAPIConfiguration {
apiKeys?: {[ key: string ]: string};
username?: string;
password?: string;
accessToken?: string | (() => string);
basePath?: string;
withCredentials?: boolean;
}

View File

@ -1,12 +0,0 @@
import { Observable } from "rxjs/Observable";
import HttpResponse from "./HttpResponse";
import { Headers } from "./Headers";
interface IHttpClient {
get(url:string, headers?: Headers):Observable<HttpResponse>
post(url:string, body:{}|FormData, headers?: Headers):Observable<HttpResponse>
put(url:string, body:{}, headers?: Headers):Observable<HttpResponse>
delete(url:string, headers?: Headers):Observable<HttpResponse>
}
export default IHttpClient

View File

@ -1,319 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
import { Observable } from "rxjs/Observable";
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import IHttpClient from "../IHttpClient";
import { inject, injectable } from "inversify";
import { IAPIConfiguration } from "../IAPIConfiguration";
import { Headers } from "../Headers";
import HttpResponse from "../HttpResponse";
import { ApiResponse } from '../model/apiResponse';
import { Pet } from '../model/pet';
import { COLLECTION_FORMATS } from '../variables';
@injectable()
export class PetService {
private basePath: string = 'https://petstore.swagger.io/v2';
constructor(@inject("IApiHttpClient") private httpClient: IHttpClient,
@inject("IAPIConfiguration") private APIConfiguration: IAPIConfiguration ) {
if(this.APIConfiguration.basePath)
this.basePath = this.APIConfiguration.basePath;
}
/**
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store
*/
public addPet(body: Pet, observe?: 'body', headers?: Headers): Observable<any>;
public addPet(body: Pet, observe?: 'response', headers?: Headers): Observable<HttpResponse<any>>;
public addPet(body: Pet, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (!body){
throw new Error('Required parameter body was null or undefined when calling addPet.');
}
// authentication (petstore_auth) required
if (this.APIConfiguration.accessToken) {
let accessToken = typeof this.APIConfiguration.accessToken === 'function'
? this.APIConfiguration.accessToken()
: this.APIConfiguration.accessToken;
headers['Authorization'] = 'Bearer ' + accessToken;
}
headers['Accept'] = 'application/xml';
headers['Content-Type'] = 'application/json';
const response: Observable<HttpResponse<any>> = this.httpClient.post(`${this.basePath}/pet`, body , headers);
if (observe == 'body') {
return response.map(httpResponse => <any>(httpResponse.response));
}
return response;
}
/**
* Deletes a pet
*
* @param petId Pet id to delete
* @param apiKey
*/
public deletePet(petId: number, apiKey?: string, observe?: 'body', headers?: Headers): Observable<any>;
public deletePet(petId: number, apiKey?: string, observe?: 'response', headers?: Headers): Observable<HttpResponse<any>>;
public deletePet(petId: number, apiKey?: string, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (!petId){
throw new Error('Required parameter petId was null or undefined when calling deletePet.');
}
if (apiKey) {
headers['api_key'] = String(apiKey);
}
// authentication (petstore_auth) required
if (this.APIConfiguration.accessToken) {
let accessToken = typeof this.APIConfiguration.accessToken === 'function'
? this.APIConfiguration.accessToken()
: this.APIConfiguration.accessToken;
headers['Authorization'] = 'Bearer ' + accessToken;
}
headers['Accept'] = 'application/xml';
const response: Observable<HttpResponse<any>> = this.httpClient.delete(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, headers);
if (observe == 'body') {
return response.map(httpResponse => <any>(httpResponse.response));
}
return response;
}
/**
* 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<'available' | 'pending' | 'sold'>, observe?: 'body', headers?: Headers): Observable<Array<Pet>>;
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'response', headers?: Headers): Observable<HttpResponse<Array<Pet>>>;
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (!status){
throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
}
let queryParameters: string[] = [];
if (status) {
status.forEach((element) => {
queryParameters.push("status="+encodeURIComponent(String(status)));
})
}
// authentication (petstore_auth) required
if (this.APIConfiguration.accessToken) {
let accessToken = typeof this.APIConfiguration.accessToken === 'function'
? this.APIConfiguration.accessToken()
: this.APIConfiguration.accessToken;
headers['Authorization'] = 'Bearer ' + accessToken;
}
headers['Accept'] = 'application/xml';
const response: Observable<HttpResponse<Array<Pet>>> = this.httpClient.get(`${this.basePath}/pet/findByStatus?${queryParameters.join('&')}`, headers);
if (observe == 'body') {
return response.map(httpResponse => <Array<Pet>>(httpResponse.response));
}
return response;
}
/**
* 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<string>, observe?: 'body', headers?: Headers): Observable<Array<Pet>>;
public findPetsByTags(tags: Array<string>, observe?: 'response', headers?: Headers): Observable<HttpResponse<Array<Pet>>>;
public findPetsByTags(tags: Array<string>, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (!tags){
throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.');
}
let queryParameters: string[] = [];
if (tags) {
tags.forEach((element) => {
queryParameters.push("tags="+encodeURIComponent(String(tags)));
})
}
// authentication (petstore_auth) required
if (this.APIConfiguration.accessToken) {
let accessToken = typeof this.APIConfiguration.accessToken === 'function'
? this.APIConfiguration.accessToken()
: this.APIConfiguration.accessToken;
headers['Authorization'] = 'Bearer ' + accessToken;
}
headers['Accept'] = 'application/xml';
const response: Observable<HttpResponse<Array<Pet>>> = this.httpClient.get(`${this.basePath}/pet/findByTags?${queryParameters.join('&')}`, headers);
if (observe == 'body') {
return response.map(httpResponse => <Array<Pet>>(httpResponse.response));
}
return response;
}
/**
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return
*/
public getPetById(petId: number, observe?: 'body', headers?: Headers): Observable<Pet>;
public getPetById(petId: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<Pet>>;
public getPetById(petId: number, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (!petId){
throw new Error('Required parameter petId was null or undefined when calling getPetById.');
}
// authentication (api_key) required
if (this.APIConfiguration.apiKeys["api_key"]) {
headers['api_key'] = this.APIConfiguration.apiKeys["api_key"];
}
headers['Accept'] = 'application/xml';
const response: Observable<HttpResponse<Pet>> = this.httpClient.get(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, headers);
if (observe == 'body') {
return response.map(httpResponse => <Pet>(httpResponse.response));
}
return response;
}
/**
* Update an existing pet
*
* @param body Pet object that needs to be added to the store
*/
public updatePet(body: Pet, observe?: 'body', headers?: Headers): Observable<any>;
public updatePet(body: Pet, observe?: 'response', headers?: Headers): Observable<HttpResponse<any>>;
public updatePet(body: Pet, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (!body){
throw new Error('Required parameter body was null or undefined when calling updatePet.');
}
// authentication (petstore_auth) required
if (this.APIConfiguration.accessToken) {
let accessToken = typeof this.APIConfiguration.accessToken === 'function'
? this.APIConfiguration.accessToken()
: this.APIConfiguration.accessToken;
headers['Authorization'] = 'Bearer ' + accessToken;
}
headers['Accept'] = 'application/xml';
headers['Content-Type'] = 'application/json';
const response: Observable<HttpResponse<any>> = this.httpClient.put(`${this.basePath}/pet`, body , headers);
if (observe == 'body') {
return response.map(httpResponse => <any>(httpResponse.response));
}
return response;
}
/**
* 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: number, name?: string, status?: string, observe?: 'body', headers?: Headers): Observable<any>;
public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'response', headers?: Headers): Observable<HttpResponse<any>>;
public updatePetWithForm(petId: number, name?: string, status?: string, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (!petId){
throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.');
}
// authentication (petstore_auth) required
if (this.APIConfiguration.accessToken) {
let accessToken = typeof this.APIConfiguration.accessToken === 'function'
? this.APIConfiguration.accessToken()
: this.APIConfiguration.accessToken;
headers['Authorization'] = 'Bearer ' + accessToken;
}
headers['Accept'] = 'application/xml';
let formData: FormData = new FormData();
headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
if (name !== undefined) {
formData.append('name', <any>name);
}
if (status !== undefined) {
formData.append('status', <any>status);
}
const response: Observable<HttpResponse<any>> = this.httpClient.post(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, body, headers);
if (observe == 'body') {
return response.map(httpResponse => <any>(httpResponse.response));
}
return response;
}
/**
* 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?: Blob, observe?: 'body', headers?: Headers): Observable<ApiResponse>;
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'response', headers?: Headers): Observable<HttpResponse<ApiResponse>>;
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (!petId){
throw new Error('Required parameter petId was null or undefined when calling uploadFile.');
}
// authentication (petstore_auth) required
if (this.APIConfiguration.accessToken) {
let accessToken = typeof this.APIConfiguration.accessToken === 'function'
? this.APIConfiguration.accessToken()
: this.APIConfiguration.accessToken;
headers['Authorization'] = 'Bearer ' + accessToken;
}
headers['Accept'] = 'application/json';
let formData: FormData = new FormData();
headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
if (additionalMetadata !== undefined) {
formData.append('additionalMetadata', <any>additionalMetadata);
}
if (file !== undefined) {
formData.append('file', <any>file);
}
const response: Observable<HttpResponse<ApiResponse>> = this.httpClient.post(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, body, headers);
if (observe == 'body') {
return response.map(httpResponse => <ApiResponse>(httpResponse.response));
}
return response;
}
}

View File

@ -1,130 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
import { Observable } from "rxjs/Observable";
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import IHttpClient from "../IHttpClient";
import { inject, injectable } from "inversify";
import { IAPIConfiguration } from "../IAPIConfiguration";
import { Headers } from "../Headers";
import HttpResponse from "../HttpResponse";
import { Order } from '../model/order';
import { COLLECTION_FORMATS } from '../variables';
@injectable()
export class StoreService {
private basePath: string = 'https://petstore.swagger.io/v2';
constructor(@inject("IApiHttpClient") private httpClient: IHttpClient,
@inject("IAPIConfiguration") private APIConfiguration: IAPIConfiguration ) {
if(this.APIConfiguration.basePath)
this.basePath = this.APIConfiguration.basePath;
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors
* @param orderId ID of the order that needs to be deleted
*/
public deleteOrder(orderId: number, observe?: 'body', headers?: Headers): Observable<any>;
public deleteOrder(orderId: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<any>>;
public deleteOrder(orderId: number, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (!orderId){
throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.');
}
headers['Accept'] = 'application/xml';
const response: Observable<HttpResponse<any>> = this.httpClient.delete(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, headers);
if (observe == 'body') {
return response.map(httpResponse => <any>(httpResponse.response));
}
return response;
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
*/
public getInventory(observe?: 'body', headers?: Headers): Observable<{ [key: string]: number; }>;
public getInventory(observe?: 'response', headers?: Headers): Observable<HttpResponse<{ [key: string]: number; }>>;
public getInventory(observe: any = 'body', headers: Headers = {}): Observable<any> {
// authentication (api_key) required
if (this.APIConfiguration.apiKeys["api_key"]) {
headers['api_key'] = this.APIConfiguration.apiKeys["api_key"];
}
headers['Accept'] = 'application/json';
const response: Observable<HttpResponse<{ [key: string]: number; }>> = this.httpClient.get(`${this.basePath}/store/inventory`, headers);
if (observe == 'body') {
return response.map(httpResponse => <{ [key: string]: number; }>(httpResponse.response));
}
return response;
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &gt;&#x3D; 1 and &lt;&#x3D; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
*/
public getOrderById(orderId: number, observe?: 'body', headers?: Headers): Observable<Order>;
public getOrderById(orderId: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<Order>>;
public getOrderById(orderId: number, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (!orderId){
throw new Error('Required parameter orderId was null or undefined when calling getOrderById.');
}
headers['Accept'] = 'application/xml';
const response: Observable<HttpResponse<Order>> = this.httpClient.get(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, headers);
if (observe == 'body') {
return response.map(httpResponse => <Order>(httpResponse.response));
}
return response;
}
/**
* Place an order for a pet
*
* @param body order placed for purchasing the pet
*/
public placeOrder(body: Order, observe?: 'body', headers?: Headers): Observable<Order>;
public placeOrder(body: Order, observe?: 'response', headers?: Headers): Observable<HttpResponse<Order>>;
public placeOrder(body: Order, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (!body){
throw new Error('Required parameter body was null or undefined when calling placeOrder.');
}
headers['Accept'] = 'application/xml';
headers['Content-Type'] = 'application/json';
const response: Observable<HttpResponse<Order>> = this.httpClient.post(`${this.basePath}/store/order`, body , headers);
if (observe == 'body') {
return response.map(httpResponse => <Order>(httpResponse.response));
}
return response;
}
}

View File

@ -1,239 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
import { Observable } from "rxjs/Observable";
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import IHttpClient from "../IHttpClient";
import { inject, injectable } from "inversify";
import { IAPIConfiguration } from "../IAPIConfiguration";
import { Headers } from "../Headers";
import HttpResponse from "../HttpResponse";
import { User } from '../model/user';
import { COLLECTION_FORMATS } from '../variables';
@injectable()
export class UserService {
private basePath: string = 'https://petstore.swagger.io/v2';
constructor(@inject("IApiHttpClient") private httpClient: IHttpClient,
@inject("IAPIConfiguration") private APIConfiguration: IAPIConfiguration ) {
if(this.APIConfiguration.basePath)
this.basePath = this.APIConfiguration.basePath;
}
/**
* Create user
* This can only be done by the logged in user.
* @param body Created user object
*/
public createUser(body: User, observe?: 'body', headers?: Headers): Observable<any>;
public createUser(body: User, observe?: 'response', headers?: Headers): Observable<HttpResponse<any>>;
public createUser(body: User, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (!body){
throw new Error('Required parameter body was null or undefined when calling createUser.');
}
headers['Accept'] = 'application/xml';
headers['Content-Type'] = 'application/json';
const response: Observable<HttpResponse<any>> = this.httpClient.post(`${this.basePath}/user`, body , headers);
if (observe == 'body') {
return response.map(httpResponse => <any>(httpResponse.response));
}
return response;
}
/**
* Creates list of users with given input array
*
* @param body List of user object
*/
public createUsersWithArrayInput(body: Array<User>, observe?: 'body', headers?: Headers): Observable<any>;
public createUsersWithArrayInput(body: Array<User>, observe?: 'response', headers?: Headers): Observable<HttpResponse<any>>;
public createUsersWithArrayInput(body: Array<User>, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (!body){
throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.');
}
headers['Accept'] = 'application/xml';
headers['Content-Type'] = 'application/json';
const response: Observable<HttpResponse<any>> = this.httpClient.post(`${this.basePath}/user/createWithArray`, body , headers);
if (observe == 'body') {
return response.map(httpResponse => <any>(httpResponse.response));
}
return response;
}
/**
* Creates list of users with given input array
*
* @param body List of user object
*/
public createUsersWithListInput(body: Array<User>, observe?: 'body', headers?: Headers): Observable<any>;
public createUsersWithListInput(body: Array<User>, observe?: 'response', headers?: Headers): Observable<HttpResponse<any>>;
public createUsersWithListInput(body: Array<User>, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (!body){
throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.');
}
headers['Accept'] = 'application/xml';
headers['Content-Type'] = 'application/json';
const response: Observable<HttpResponse<any>> = this.httpClient.post(`${this.basePath}/user/createWithList`, body , headers);
if (observe == 'body') {
return response.map(httpResponse => <any>(httpResponse.response));
}
return response;
}
/**
* 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, observe?: 'body', headers?: Headers): Observable<any>;
public deleteUser(username: string, observe?: 'response', headers?: Headers): Observable<HttpResponse<any>>;
public deleteUser(username: string, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (!username){
throw new Error('Required parameter username was null or undefined when calling deleteUser.');
}
headers['Accept'] = 'application/xml';
const response: Observable<HttpResponse<any>> = this.httpClient.delete(`${this.basePath}/user/${encodeURIComponent(String(username))}`, headers);
if (observe == 'body') {
return response.map(httpResponse => <any>(httpResponse.response));
}
return response;
}
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
*/
public getUserByName(username: string, observe?: 'body', headers?: Headers): Observable<User>;
public getUserByName(username: string, observe?: 'response', headers?: Headers): Observable<HttpResponse<User>>;
public getUserByName(username: string, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (!username){
throw new Error('Required parameter username was null or undefined when calling getUserByName.');
}
headers['Accept'] = 'application/xml';
const response: Observable<HttpResponse<User>> = this.httpClient.get(`${this.basePath}/user/${encodeURIComponent(String(username))}`, headers);
if (observe == 'body') {
return response.map(httpResponse => <User>(httpResponse.response));
}
return response;
}
/**
* 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, observe?: 'body', headers?: Headers): Observable<string>;
public loginUser(username: string, password: string, observe?: 'response', headers?: Headers): Observable<HttpResponse<string>>;
public loginUser(username: string, password: string, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (!username){
throw new Error('Required parameter username was null or undefined when calling loginUser.');
}
if (!password){
throw new Error('Required parameter password was null or undefined when calling loginUser.');
}
let queryParameters: string[] = [];
if (username !== undefined) {
queryParameters.push("username="+encodeURIComponent(String(username)));
}
if (password !== undefined) {
queryParameters.push("password="+encodeURIComponent(String(password)));
}
headers['Accept'] = 'application/xml';
const response: Observable<HttpResponse<string>> = this.httpClient.get(`${this.basePath}/user/login?${queryParameters.join('&')}`, headers);
if (observe == 'body') {
return response.map(httpResponse => <string>(httpResponse.response));
}
return response;
}
/**
* Logs out current logged in user session
*
*/
public logoutUser(observe?: 'body', headers?: Headers): Observable<any>;
public logoutUser(observe?: 'response', headers?: Headers): Observable<HttpResponse<any>>;
public logoutUser(observe: any = 'body', headers: Headers = {}): Observable<any> {
headers['Accept'] = 'application/xml';
const response: Observable<HttpResponse<any>> = this.httpClient.get(`${this.basePath}/user/logout`, headers);
if (observe == 'body') {
return response.map(httpResponse => <any>(httpResponse.response));
}
return response;
}
/**
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be updated
* @param body Updated user object
*/
public updateUser(username: string, body: User, observe?: 'body', headers?: Headers): Observable<any>;
public updateUser(username: string, body: User, observe?: 'response', headers?: Headers): Observable<HttpResponse<any>>;
public updateUser(username: string, body: User, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (!username){
throw new Error('Required parameter username was null or undefined when calling updateUser.');
}
if (!body){
throw new Error('Required parameter body was null or undefined when calling updateUser.');
}
headers['Accept'] = 'application/xml';
headers['Content-Type'] = 'application/json';
const response: Observable<HttpResponse<any>> = this.httpClient.put(`${this.basePath}/user/${encodeURIComponent(String(username))}`, body , headers);
if (observe == 'body') {
return response.map(httpResponse => <any>(httpResponse.response));
}
return response;
}
}

View File

@ -1,18 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface ApiResponse {
code?: number;
type?: string;
message?: string;
}

View File

@ -1,17 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface Category {
id?: number;
name?: string;
}

View File

@ -1,32 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface Order {
id?: number;
petId?: number;
quantity?: number;
shipDate?: Date;
/**
* Order Status
*/
status?: Order.StatusEnum;
complete?: boolean;
}
export namespace Order {
export type StatusEnum = 'placed' | 'approved' | 'delivered';
export const StatusEnum = {
Placed: 'placed' as StatusEnum,
Approved: 'approved' as StatusEnum,
Delivered: 'delivered' as StatusEnum
}
}

View File

@ -1,34 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { Category } from './category';
import { Tag } from './tag';
export interface Pet {
id?: number;
category?: Category;
name: string;
photoUrls: Array<string>;
tags?: Array<Tag>;
/**
* pet status in the store
*/
status?: Pet.StatusEnum;
}
export namespace Pet {
export type StatusEnum = 'available' | 'pending' | 'sold';
export const StatusEnum = {
Available: 'available' as StatusEnum,
Pending: 'pending' as StatusEnum,
Sold: 'sold' as StatusEnum
}
}

View File

@ -1,17 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface Tag {
id?: number;
name?: string;
}

View File

@ -1,26 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface User {
id?: number;
username?: string;
firstName?: string;
lastName?: string;
email?: string;
password?: string;
phone?: string;
/**
* User Status
*/
userStatus?: number;
}

View File

@ -1,6 +0,0 @@
export const COLLECTION_FORMATS = {
'csv': ',',
'tsv': ' ',
'ssv': ' ',
'pipes': '|'
}

View File

@ -1,23 +0,0 @@
# 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

View File

@ -1,634 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as $ from 'jquery';
import * as models from '../model/models';
import { COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
/* tslint:disable:no-unused-variable member-ordering */
export class PetApi {
protected basePath = 'https://petstore.swagger.io/v2';
public defaultHeaders: Array<string> = [];
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
public configuration: Configuration = new Configuration();
constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
}
if (defaultExtraJQueryAjaxSettings) {
this.defaultExtraJQueryAjaxSettings = defaultExtraJQueryAjaxSettings;
}
}
private extendObj<T1, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
for (let key in objB) {
if (objB.hasOwnProperty(key)) {
objA[key] = objB[key];
}
}
return objA;
}
/**
*
* @summary Add a new pet to the store
* @param body Pet object that needs to be added to the store
*/
public addPet(body: models.Pet, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/pet';
let queryParameters: any = {};
let headerParams: any = {};
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling addPet.');
}
localVarPath = localVarPath + "?" + $.param(queryParameters);
// to determine the Content-Type header
let consumes: string[] = [
'application/json',
'application/xml'
];
// to determine the Accept header
let produces: string[] = [
'application/xml',
'application/json'
];
// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headerParams['Authorization'] = 'Bearer ' + accessToken;
}
headerParams['Content-Type'] = 'application/json';
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'POST',
headers: headerParams,
processData: false
};
requestOptions.data = JSON.stringify(body);
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
/**
*
* @summary Deletes a pet
* @param petId Pet id to delete
* @param apiKey
*/
public deletePet(petId: number, apiKey?: string, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/pet/{petId}'.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = {};
// verify required parameter 'petId' is not null or undefined
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling deletePet.');
}
localVarPath = localVarPath + "?" + $.param(queryParameters);
headerParams['api_key'] = String(apiKey);
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/xml',
'application/json'
];
// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headerParams['Authorization'] = 'Bearer ' + accessToken;
}
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'DELETE',
headers: headerParams,
processData: false
};
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
/**
* Multiple status values can be provided with comma separated strings
* @summary Finds Pets by status
* @param status Status values that need to be considered for filter
*/
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: Array<models.Pet>; }> {
let localVarPath = this.basePath + '/pet/findByStatus';
let queryParameters: any = {};
let headerParams: any = {};
// verify required parameter 'status' is not null or undefined
if (status === null || status === undefined) {
throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
}
if (status) {
status.forEach((element: any) => {
queryParameters['status'].push(element);
});
}
localVarPath = localVarPath + "?" + $.param(queryParameters);
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/xml',
'application/json'
];
// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headerParams['Authorization'] = 'Bearer ' + accessToken;
}
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'GET',
headers: headerParams,
processData: false
};
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: Array<models.Pet>, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
/**
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @summary Finds Pets by tags
* @param tags Tags to filter by
*/
public findPetsByTags(tags: Array<string>, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: Array<models.Pet>; }> {
let localVarPath = this.basePath + '/pet/findByTags';
let queryParameters: any = {};
let headerParams: any = {};
// verify required parameter 'tags' is not null or undefined
if (tags === null || tags === undefined) {
throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.');
}
if (tags) {
tags.forEach((element: any) => {
queryParameters['tags'].push(element);
});
}
localVarPath = localVarPath + "?" + $.param(queryParameters);
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/xml',
'application/json'
];
// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headerParams['Authorization'] = 'Bearer ' + accessToken;
}
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'GET',
headers: headerParams,
processData: false
};
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: Array<models.Pet>, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
/**
* Returns a single pet
* @summary Find pet by ID
* @param petId ID of pet to return
*/
public getPetById(petId: number, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: models.Pet; }> {
let localVarPath = this.basePath + '/pet/{petId}'.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = {};
// verify required parameter 'petId' is not null or undefined
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling getPetById.');
}
localVarPath = localVarPath + "?" + $.param(queryParameters);
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/xml',
'application/json'
];
// authentication (api_key) required
if (this.configuration.apiKey) {
headerParams['api_key'] = this.configuration.apiKey;
}
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'GET',
headers: headerParams,
processData: false
};
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: models.Pet, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
/**
*
* @summary Update an existing pet
* @param body Pet object that needs to be added to the store
*/
public updatePet(body: models.Pet, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/pet';
let queryParameters: any = {};
let headerParams: any = {};
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling updatePet.');
}
localVarPath = localVarPath + "?" + $.param(queryParameters);
// to determine the Content-Type header
let consumes: string[] = [
'application/json',
'application/xml'
];
// to determine the Accept header
let produces: string[] = [
'application/xml',
'application/json'
];
// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headerParams['Authorization'] = 'Bearer ' + accessToken;
}
headerParams['Content-Type'] = 'application/json';
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'PUT',
headers: headerParams,
processData: false
};
requestOptions.data = JSON.stringify(body);
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
/**
*
* @summary 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: number, name?: string, status?: string, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/pet/{petId}'.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = {};
let formParams = new FormData();
let reqHasFile = false;
// 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);
if (name !== null && name !== undefined) {
formParams.append('name', <any>name);
}
if (status !== null && status !== undefined) {
formParams.append('status', <any>status);
}
// to determine the Content-Type header
let consumes: string[] = [
'application/x-www-form-urlencoded'
];
// to determine the Accept header
let produces: string[] = [
'application/xml',
'application/json'
];
// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headerParams['Authorization'] = 'Bearer ' + accessToken;
}
if (!reqHasFile) {
headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
}
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'POST',
headers: headerParams,
processData: false
};
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
requestOptions.data = formParams;
if (reqHasFile) {
requestOptions.contentType = false;
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
/**
*
* @summary 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, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: models.ApiResponse; }> {
let localVarPath = this.basePath + '/pet/{petId}/uploadImage'.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = {};
let formParams = new FormData();
let reqHasFile = false;
// 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);
if (additionalMetadata !== null && additionalMetadata !== undefined) {
formParams.append('additionalMetadata', <any>additionalMetadata);
}
reqHasFile = true;
formParams.append("file", file);
// to determine the Content-Type header
let consumes: string[] = [
'multipart/form-data'
];
// to determine the Accept header
let produces: string[] = [
'application/json'
];
// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headerParams['Authorization'] = 'Bearer ' + accessToken;
}
if (!reqHasFile) {
headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
}
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'POST',
headers: headerParams,
processData: false
};
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
requestOptions.data = formParams;
if (reqHasFile) {
requestOptions.contentType = false;
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: models.ApiResponse, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
}

View File

@ -1,278 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as $ from 'jquery';
import * as models from '../model/models';
import { COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
/* tslint:disable:no-unused-variable member-ordering */
export class StoreApi {
protected basePath = 'https://petstore.swagger.io/v2';
public defaultHeaders: Array<string> = [];
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
public configuration: Configuration = new Configuration();
constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
}
if (defaultExtraJQueryAjaxSettings) {
this.defaultExtraJQueryAjaxSettings = defaultExtraJQueryAjaxSettings;
}
}
private extendObj<T1, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
for (let key in objB) {
if (objB.hasOwnProperty(key)) {
objA[key] = objB[key];
}
}
return objA;
}
/**
* For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors
* @summary Delete purchase order by ID
* @param orderId ID of the order that needs to be deleted
*/
public deleteOrder(orderId: number, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/store/order/{orderId}'.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
let queryParameters: any = {};
let headerParams: any = {};
// 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);
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/xml',
'application/json'
];
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'DELETE',
headers: headerParams,
processData: false
};
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
/**
* Returns a map of status codes to quantities
* @summary Returns pet inventories by status
*/
public getInventory(extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: { [key: string]: number; }; }> {
let localVarPath = this.basePath + '/store/inventory';
let queryParameters: any = {};
let headerParams: any = {};
localVarPath = localVarPath + "?" + $.param(queryParameters);
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/json'
];
// authentication (api_key) required
if (this.configuration.apiKey) {
headerParams['api_key'] = this.configuration.apiKey;
}
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'GET',
headers: headerParams,
processData: false
};
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: { [key: string]: number; }, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
/**
* For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions
* @summary Find purchase order by ID
* @param orderId ID of pet that needs to be fetched
*/
public getOrderById(orderId: number, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: models.Order; }> {
let localVarPath = this.basePath + '/store/order/{orderId}'.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
let queryParameters: any = {};
let headerParams: any = {};
// 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);
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/xml',
'application/json'
];
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'GET',
headers: headerParams,
processData: false
};
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: models.Order, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
/**
*
* @summary Place an order for a pet
* @param body order placed for purchasing the pet
*/
public placeOrder(body: models.Order, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: models.Order; }> {
let localVarPath = this.basePath + '/store/order';
let queryParameters: any = {};
let headerParams: any = {};
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling placeOrder.');
}
localVarPath = localVarPath + "?" + $.param(queryParameters);
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/xml',
'application/json'
];
headerParams['Content-Type'] = 'application/json';
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'POST',
headers: headerParams,
processData: false
};
requestOptions.data = JSON.stringify(body);
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: models.Order, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
}

View File

@ -1,529 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as $ from 'jquery';
import * as models from '../model/models';
import { COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
/* tslint:disable:no-unused-variable member-ordering */
export class UserApi {
protected basePath = 'https://petstore.swagger.io/v2';
public defaultHeaders: Array<string> = [];
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
public configuration: Configuration = new Configuration();
constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
}
if (defaultExtraJQueryAjaxSettings) {
this.defaultExtraJQueryAjaxSettings = defaultExtraJQueryAjaxSettings;
}
}
private extendObj<T1, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
for (let key in objB) {
if (objB.hasOwnProperty(key)) {
objA[key] = objB[key];
}
}
return objA;
}
/**
* This can only be done by the logged in user.
* @summary Create user
* @param body Created user object
*/
public createUser(body: models.User, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/user';
let queryParameters: any = {};
let headerParams: any = {};
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUser.');
}
localVarPath = localVarPath + "?" + $.param(queryParameters);
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/xml',
'application/json'
];
headerParams['Content-Type'] = 'application/json';
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'POST',
headers: headerParams,
processData: false
};
requestOptions.data = JSON.stringify(body);
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
/**
*
* @summary Creates list of users with given input array
* @param body List of user object
*/
public createUsersWithArrayInput(body: Array<models.User>, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/user/createWithArray';
let queryParameters: any = {};
let headerParams: any = {};
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.');
}
localVarPath = localVarPath + "?" + $.param(queryParameters);
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/xml',
'application/json'
];
headerParams['Content-Type'] = 'application/json';
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'POST',
headers: headerParams,
processData: false
};
requestOptions.data = JSON.stringify(body);
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
/**
*
* @summary Creates list of users with given input array
* @param body List of user object
*/
public createUsersWithListInput(body: Array<models.User>, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/user/createWithList';
let queryParameters: any = {};
let headerParams: any = {};
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.');
}
localVarPath = localVarPath + "?" + $.param(queryParameters);
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/xml',
'application/json'
];
headerParams['Content-Type'] = 'application/json';
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'POST',
headers: headerParams,
processData: false
};
requestOptions.data = JSON.stringify(body);
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
/**
* This can only be done by the logged in user.
* @summary Delete user
* @param username The name that needs to be deleted
*/
public deleteUser(username: string, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/user/{username}'.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
let headerParams: any = {};
// 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);
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/xml',
'application/json'
];
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'DELETE',
headers: headerParams,
processData: false
};
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
/**
*
* @summary Get user by user name
* @param username The name that needs to be fetched. Use user1 for testing.
*/
public getUserByName(username: string, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: models.User; }> {
let localVarPath = this.basePath + '/user/{username}'.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
let headerParams: any = {};
// 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);
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/xml',
'application/json'
];
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'GET',
headers: headerParams,
processData: false
};
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: models.User, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
/**
*
* @summary 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, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body: string; }> {
let localVarPath = this.basePath + '/user/login';
let queryParameters: any = {};
let headerParams: any = {};
// verify required parameter 'username' is not null or undefined
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling loginUser.');
}
// verify required parameter 'password' is not null or undefined
if (password === null || password === undefined) {
throw new Error('Required parameter password was null or undefined when calling loginUser.');
}
if (username !== null && username !== undefined) {
queryParameters['username'] = <string><any>username;
}
if (password !== null && password !== undefined) {
queryParameters['password'] = <string><any>password;
}
localVarPath = localVarPath + "?" + $.param(queryParameters);
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/xml',
'application/json'
];
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'GET',
headers: headerParams,
processData: false
};
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: string, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
/**
*
* @summary Logs out current logged in user session
*/
public logoutUser(extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/user/logout';
let queryParameters: any = {};
let headerParams: any = {};
localVarPath = localVarPath + "?" + $.param(queryParameters);
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/xml',
'application/json'
];
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'GET',
headers: headerParams,
processData: false
};
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
/**
* This can only be done by the logged in user.
* @summary Updated user
* @param username name that need to be updated
* @param body Updated user object
*/
public updateUser(username: string, body: models.User, extraJQueryAjaxSettings?: JQueryAjaxSettings): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/user/{username}'.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
let headerParams: any = {};
// 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.');
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling updateUser.');
}
localVarPath = localVarPath + "?" + $.param(queryParameters);
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/xml',
'application/json'
];
headerParams['Content-Type'] = 'application/json';
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: 'PUT',
headers: headerParams,
processData: false
};
requestOptions.data = JSON.stringify(body);
if (headerParams['Content-Type']) {
requestOptions.contentType = headerParams['Content-Type'];
}
if (extraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, extraJQueryAjaxSettings);
}
if (this.defaultExtraJQueryAjaxSettings) {
requestOptions = (<any>Object).assign(requestOptions, this.defaultExtraJQueryAjaxSettings);
}
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: any, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve(jqXHR, data),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject(xhr, errorThrown)
);
return dfd.promise();
}
}

View File

@ -1,7 +0,0 @@
export * from './PetApi';
import { PetApi } from './PetApi';
export * from './StoreApi';
import { StoreApi } from './StoreApi';
export * from './UserApi';
import { UserApi } from './UserApi';
export const APIS = [PetApi, StoreApi, UserApi];

View File

@ -1,6 +0,0 @@
export class Configuration {
apiKey: string;
username: string;
password: string;
accessToken: string | (() => string);
}

View File

@ -1,52 +0,0 @@
#!/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 credential 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'

View File

@ -1,4 +0,0 @@
export * from './api/api';
export * from './model/models';
export * from './variables';
export * from './configuration';

View File

@ -1,22 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from './models';
export interface ApiResponse {
code?: number;
type?: string;
message?: string;
}

View File

@ -1,20 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from './models';
export interface Category {
id?: number;
name?: string;
}

View File

@ -1,38 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from './models';
export interface Order {
id?: number;
petId?: number;
quantity?: number;
shipDate?: Date;
/**
* Order Status
*/
status?: Order.StatusEnum;
complete?: boolean;
}
export namespace Order {
export enum StatusEnum {
Placed = <any> 'placed',
Approved = <any> 'approved',
Delivered = <any> 'delivered'
}
}

View File

@ -1,38 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from './models';
export interface Pet {
id?: number;
category?: models.Category;
name: string;
photoUrls: Array<string>;
tags?: Array<models.Tag>;
/**
* pet status in the store
*/
status?: Pet.StatusEnum;
}
export namespace Pet {
export enum StatusEnum {
Available = <any> 'available',
Pending = <any> 'pending',
Sold = <any> 'sold'
}
}

View File

@ -1,20 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from './models';
export interface Tag {
id?: number;
name?: string;
}

View File

@ -1,35 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.2
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from './models';
export interface User {
id?: number;
username?: string;
firstName?: string;
lastName?: string;
email?: string;
password?: string;
phone?: string;
/**
* User Status
*/
userStatus?: number;
}

View File

@ -1,6 +0,0 @@
export * from './ApiResponse';
export * from './Category';
export * from './Order';
export * from './Pet';
export * from './Tag';
export * from './User';

View File

@ -1,7 +0,0 @@
export const COLLECTION_FORMATS = {
'csv': ',',
'tsv': ' ',
'ssv': ' ',
'pipes': '|'
}

View File

@ -1,3 +0,0 @@
wwwroot/*.js
node_modules
typings

View File

@ -1,23 +0,0 @@
# 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

Some files were not shown because too many files have changed in this diff Show More