Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Observable } from 'rxjs/Observable';

export interface ConfigurationParameters {
apiKeys?: {[ key: string ]: string};
username?: string;
password?: string;
accessToken?: string | (() => string);
accessToken?: string | ((name: string, scopes?: string[]) => Observable<string>);
basePath?: string;
withCredentials?: boolean;
}
Expand All @@ -11,7 +13,7 @@ export class Configuration {
apiKeys?: {[ key: string ]: string};
username?: string;
password?: string;
accessToken?: string | (() => string);
accessToken?: string | ((name: string, scopes?: string[]) => Observable<string>);
basePath?: string;
withCredentials?: boolean;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

// Statics
import 'rxjs/add/observable/throw';
import 'rxjs/add/observable/of';

// Operators
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/zip';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/mergeMap';
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.3-SNAPSHOT
2.3.0-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import { FakeService } from './api/fake.service';
providers: [ FakeService ]
})
export class ApiModule {
public static forConfig(configuration: Configuration): ModuleWithProviders {
public static forConfig(configurationFactory: () => Configuration): ModuleWithProviders {
return {
ngModule: ApiModule,
providers: [ {provide: Configuration, useValue: configuration}]
providers: [ {provide: Configuration, useFactory: configurationFactory}]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* Do not edit the class manually.
*/

/* tslint:disable:no-unused-variable member-ordering */

import { Inject, Injectable, Optional } from '@angular/core';
import { Http, Headers, URLSearchParams } from '@angular/http';
import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http';
Expand All @@ -22,11 +24,10 @@ import '../rxjs-operators';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';

/* tslint:disable:no-unused-variable member-ordering */


@Injectable()
export class FakeService {

protected basePath = 'https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r';
public defaultHeaders: Headers = new Headers();
public configuration: Configuration = new Configuration();
Expand All @@ -37,12 +38,12 @@ export class FakeService {
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.basePath = basePath || configuration.basePath || this.basePath;
}
}

/**
*
*
* Extends object by coping non-existing properties.
* @param objA object to be extended
* @param objB source object
Expand Down Expand Up @@ -71,8 +72,8 @@ export class FakeService {
}

/**
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
*
* @summary To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
* @param test code inject * &#39; &quot; &#x3D;end rn n r To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
*/
public testCodeInjectEndRnNR(test code inject * &#39; &quot; &#x3D;end rn n r?: string, extraHttpRequestParams?: any): Observable<{}> {
Expand All @@ -96,11 +97,11 @@ export class FakeService {
const path = this.basePath + '/fake';

let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
let headersObservable = Observable.of(new Headers(this.defaultHeaders.toJSON())); // https://github.com/angular/angular/issues/6845

// to determine the Content-Type header
let consumes: string[] = [
'application/json',
'application/json',
'*_/ =end -- '
];
let canConsumeForm = this.canConsumeForm(consumes);
Expand All @@ -111,28 +112,32 @@ export class FakeService {

// to determine the Accept header
let produces: string[] = [
'application/json',
'application/json',
'*_/ =end -- '
];


if (test code inject * &#39; &quot; &#x3D;end rn n r !== undefined) {
formParams.set('test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r', <any>test code inject * &#39; &quot; &#x3D;end rn n r);
}

let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Put,
headers: headers,
body: formParams.toString(),
search: queryParameters,
withCredentials:this.configuration.withCredentials
let requestOptionsObservable = headersObservable.map((headers: Headers) => {
let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Put,
headers: headers,
body: formParams.toString(),
search: queryParameters,
withCredentials:this.configuration.withCredentials
});
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}

return requestOptions;
});
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}

return this.http.request(path, requestOptions);
return requestOptionsObservable.mergeMap((requestOptions: RequestOptionsArgs) => this.http.request(path, requestOptions));
}

}
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { Observable } from 'rxjs/Observable';

export interface ConfigurationParameters {
apiKeys?: {[ key: string ]: string};
username?: string;
password?: string;
accessToken?: string;
accessToken?: string | ((name: string, scopes?: string[]) => Observable<string>);
basePath?: string;
withCredentials?: boolean;
}

export class Configuration {
apiKeys: {[ key: string ]: string};
username: string;
password: string;
accessToken: string | (() => string);
basePath: string;
withCredentials: boolean;
apiKeys?: {[ key: string ]: string};
username?: string;
password?: string;
accessToken?: string | ((name: string, scopes?: string[]) => Observable<string>);
basePath?: string;
withCredentials?: boolean;

constructor(configurationParameters: ConfigurationParameters = {}) {
this.apiKeys = configurationParameters.apiKeys;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

// Statics
import 'rxjs/add/observable/throw';
import 'rxjs/add/observable/of';

// Operators
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/zip';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/mergeMap';
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { InjectionToken<string> } from '@angular/core';
import { InjectionToken } from '@angular/core';

export const BASE_PATH = new InjectionToken<string>('basePath');
export const COLLECTION_FORMATS = {
'csv': ',',
'tsv': ' ',
'ssv': ' ',
'pipes': '|'
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Observable } from 'rxjs/Observable';

export interface ConfigurationParameters {
apiKeys?: {[ key: string ]: string};
username?: string;
password?: string;
accessToken?: string | (() => string);
accessToken?: string | ((name: string, scopes?: string[]) => Observable<string>);
basePath?: string;
withCredentials?: boolean;
}
Expand All @@ -11,7 +13,7 @@ export class Configuration {
apiKeys?: {[ key: string ]: string};
username?: string;
password?: string;
accessToken?: string | (() => string);
accessToken?: string | ((name: string, scopes?: string[]) => Observable<string>);
basePath?: string;
withCredentials?: boolean;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

// Statics
import 'rxjs/add/observable/throw';
import 'rxjs/add/observable/of';

// Operators
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/zip';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/mergeMap';
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Observable } from 'rxjs/Observable';

export interface ConfigurationParameters {
apiKeys?: {[ key: string ]: string};
username?: string;
password?: string;
accessToken?: string | (() => string);
accessToken?: string | ((name: string, scopes?: string[]) => Observable<string>);
basePath?: string;
withCredentials?: boolean;
}
Expand All @@ -11,7 +13,7 @@ export class Configuration {
apiKeys?: {[ key: string ]: string};
username?: string;
password?: string;
accessToken?: string | (() => string);
accessToken?: string | ((name: string, scopes?: string[]) => Observable<string>);
basePath?: string;
withCredentials?: boolean;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

// Statics
import 'rxjs/add/observable/throw';
import 'rxjs/add/observable/of';

// Operators
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/zip';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/mergeMap';
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Observable } from 'rxjs/Observable';

export interface ConfigurationParameters {
apiKeys?: {[ key: string ]: string};
username?: string;
password?: string;
accessToken?: string | (() => string);
accessToken?: string | ((name: string, scopes?: string[]) => Observable<string>);
basePath?: string;
withCredentials?: boolean;
}
Expand All @@ -11,7 +13,7 @@ export class Configuration {
apiKeys?: {[ key: string ]: string};
username?: string;
password?: string;
accessToken?: string | (() => string);
accessToken?: string | ((name: string, scopes?: string[]) => Observable<string>);
basePath?: string;
withCredentials?: boolean;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

// Statics
import 'rxjs/add/observable/throw';
import 'rxjs/add/observable/of';

// Operators
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/zip';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/mergeMap';

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@swagger/angular2-typescript-petstore",
"name": "@swagger/angular4-typescript-petstore",
"version": "0.0.1",
"description": "swagger client for @swagger/angular2-typescript-petstore",
"author": "Swagger Codegen Contributors",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

// Statics
import 'rxjs/add/observable/throw';
import 'rxjs/add/observable/of';

// Operators
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/zip';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/mergeMap';
Loading