Skip to content
Merged
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
Expand Up @@ -51,6 +51,7 @@ public void processOpts() {
supportingFiles.add(new SupportingFile("index.mustache", "", "index.ts"));
supportingFiles.add(new SupportingFile("api.mustache", "", "api.ts"));
supportingFiles.add(new SupportingFile("configuration.mustache", "", "configuration.ts"));
supportingFiles.add(new SupportingFile("custom.d.mustache", "", "custom.d.ts"));
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore"));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/// <reference path="./custom.d.ts" />
// tslint:disable
{{>licenseInfo}}

import * as url from "url";
import * as isomorphicFetch from "isomorphic-fetch";
import * as portableFetch from "portable-fetch";
import { Configuration } from "./configuration";

const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, "");
Expand Down Expand Up @@ -45,7 +46,7 @@ export interface FetchArgs {
export class BaseAPI {
protected configuration: Configuration;

constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = isomorphicFetch) {
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = portableFetch) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
Expand Down Expand Up @@ -255,7 +256,7 @@ export const {{classname}}Fp = function(configuration?: Configuration) {
*/
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}> {
const localVarFetchArgs = {{classname}}FetchParamCreator(configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options);
return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => {
return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => {
return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
if (response.status >= 200 && response.status < 300) {
return response{{#returnType}}.json(){{/returnType}};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'portable-fetch';
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"postinstall": "npm run build"
},
"dependencies": {
"isomorphic-fetch": "^2.2.1"
"portable-fetch": "^3.0.0"
},
"devDependencies": {
"@types/isomorphic-fetch": "0.0.34",
Expand Down
201 changes: 0 additions & 201 deletions samples/client/petstore-security-test/typescript-fetch/LICENSE

This file was deleted.

54 changes: 0 additions & 54 deletions samples/client/petstore-security-test/typescript-fetch/README.md

This file was deleted.

11 changes: 6 additions & 5 deletions samples/client/petstore-security-test/typescript-fetch/api.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference path="./custom.d.ts" />
// tslint:disable
/**
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
Expand All @@ -13,7 +14,7 @@


import * as url from "url";
import * as isomorphicFetch from "isomorphic-fetch";
import * as portableFetch from "portable-fetch";
import { Configuration } from "./configuration";

const BASE_PATH = "https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r".replace(/\/+$/, "");
Expand All @@ -35,7 +36,7 @@ export const COLLECTION_FORMATS = {
* @interface FetchAPI
*/
export interface FetchAPI {
(url: string, init?: any): Promise<any>;
(url: string, init?: any): Promise<Response>;
}

/**
Expand All @@ -56,7 +57,7 @@ export interface FetchArgs {
export class BaseAPI {
protected configuration: Configuration;

constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = isomorphicFetch) {
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = portableFetch) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
Expand Down Expand Up @@ -146,9 +147,9 @@ export const FakeApiFp = function(configuration?: Configuration) {
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
testCodeInjectEndRnNR(test code inject * &#39; &quot; &#x3D;end rn n r?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<any> {
testCodeInjectEndRnNR(test code inject * &#39; &quot; &#x3D;end rn n r?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<Response> {
const localVarFetchArgs = FakeApiFetchParamCreator(configuration).testCodeInjectEndRnNR(test code inject * &#39; &quot; &#x3D;end rn n r, options);
return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => {
return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => {
return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
if (response.status >= 200 && response.status < 300) {
return response;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'portable-fetch';

This file was deleted.

This file was deleted.

Loading