Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e6b745c
[typescript-fetch] Fix uploading files
janbuchar May 15, 2019
8bdc162
Check for Blob instead of File
janbuchar May 16, 2019
4a6b00e
Merge remote-tracking branch 'upstream/master' into typescript-fetch-…
janbuchar May 20, 2019
f621eaa
Update samples
janbuchar May 20, 2019
412217b
Merge branch 'master' into typescript-fetch-file-upload
janbuchar May 20, 2019
04003ee
Update samples
janbuchar May 20, 2019
73ac448
Update samples
janbuchar May 20, 2019
0d1cfc8
Update samples
janbuchar May 20, 2019
d73aff5
Merge remote-tracking branch 'upstream/master' into typescript-fetch-…
janbuchar May 22, 2019
df125e6
Regenerate samples
janbuchar May 22, 2019
bf7ee5e
Bug
janbuchar May 22, 2019
d8514aa
Manually fix samples
janbuchar May 22, 2019
b8f470e
Merge remote-tracking branch 'upstream/master' into typescript-fetch-…
janbuchar May 23, 2019
68cd6dc
Implement support for Buffer and Blob in a backwards-compatible way
janbuchar May 23, 2019
915868a
Rework how blob and buffer instance checking works
janbuchar May 24, 2019
a1a3a6d
Check for Blob/Buffer existence properly
janbuchar May 24, 2019
f61c1c2
Avoid using Buffer and Blob in type declarations
janbuchar May 24, 2019
016170d
Merge remote-tracking branch 'upstream/master' into typescript-fetch-…
janbuchar May 29, 2019
8adcb8e
Remove Buffer support
janbuchar May 29, 2019
f5c1ed2
Update samples/client/petstore/typescript-fetch/tests/default/test/Pe…
janbuchar May 29, 2019
2ea96f7
Update samples/client/petstore/typescript-fetch/tests/default/test/Pe…
janbuchar May 29, 2019
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 @@ -3,6 +3,8 @@

export const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, "");

const isBlob = (value: any) => typeof Blob !== 'undefined' && value instanceof Blob;

/**
* This is the base class for all generated API classes.
*/
Expand Down Expand Up @@ -47,7 +49,9 @@ export class BaseAPI {
// do not handle correctly sometimes.
url += '?' + querystring(context.query);
}
const body = context.body instanceof FormData ? context.body : JSON.stringify(context.body);
const body = (context.body instanceof FormData || isBlob(context.body))
? context.body
: JSON.stringify(context.body);
const init = {
method: context.method,
headers: context.headers,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// tslint:disable
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface InlineObject
*/
export interface InlineObject {
/**
* Updated name of the pet
* @type {string}
* @memberof InlineObject
*/
name?: string;
/**
* Updated status of the pet
* @type {string}
* @memberof InlineObject
*/
status?: string;
}

export function InlineObjectFromJSON(json: any): InlineObject {
return {
'name': !exists(json, 'name') ? undefined : json['name'],
'status': !exists(json, 'status') ? undefined : json['status'],
};
}

export function InlineObjectToJSON(value?: InlineObject): any {
if (value === undefined) {
return undefined;
}
return {
'name': value.name,
'status': value.status,
};
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// tslint:disable
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface InlineObject1
*/
export interface InlineObject1 {
/**
* Additional data to pass to server
* @type {string}
* @memberof InlineObject1
*/
additionalMetadata?: string;
/**
* file to upload
* @type {Blob}
* @memberof InlineObject1
*/
file?: Blob;
}

export function InlineObject1FromJSON(json: any): InlineObject1 {
return {
'additionalMetadata': !exists(json, 'additionalMetadata') ? undefined : json['additionalMetadata'],
'file': !exists(json, 'file') ? undefined : json['file'],
};
}

export function InlineObject1ToJSON(value?: InlineObject1): any {
if (value === undefined) {
return undefined;
}
return {
'additionalMetadata': value.additionalMetadata,
'file': value.file,
};
}


Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

export const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, "");

const isBlob = (value: any) => typeof Blob !== 'undefined' && value instanceof Blob;

/**
* This is the base class for all generated API classes.
*/
Expand Down Expand Up @@ -58,7 +60,9 @@ export class BaseAPI {
// do not handle correctly sometimes.
url += '?' + querystring(context.query);
}
const body = context.body instanceof FormData ? context.body : JSON.stringify(context.body);
const body = (context.body instanceof FormData || isBlob(context.body))
? context.body
: JSON.stringify(context.body);
const init = {
method: context.method,
headers: context.headers,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// tslint:disable
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface InlineObject
*/
export interface InlineObject {
/**
* Updated name of the pet
* @type {string}
* @memberof InlineObject
*/
name?: string;
/**
* Updated status of the pet
* @type {string}
* @memberof InlineObject
*/
status?: string;
}

export function InlineObjectFromJSON(json: any): InlineObject {
return {
'name': !exists(json, 'name') ? undefined : json['name'],
'status': !exists(json, 'status') ? undefined : json['status'],
};
}

export function InlineObjectToJSON(value?: InlineObject): any {
if (value === undefined) {
return undefined;
}
return {
'name': value.name,
'status': value.status,
};
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// tslint:disable
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface InlineObject1
*/
export interface InlineObject1 {
/**
* Additional data to pass to server
* @type {string}
* @memberof InlineObject1
*/
additionalMetadata?: string;
/**
* file to upload
* @type {Blob}
* @memberof InlineObject1
*/
file?: Blob;
}

export function InlineObject1FromJSON(json: any): InlineObject1 {
return {
'additionalMetadata': !exists(json, 'additionalMetadata') ? undefined : json['additionalMetadata'],
'file': !exists(json, 'file') ? undefined : json['file'],
};
}

export function InlineObject1ToJSON(value?: InlineObject1): any {
if (value === undefined) {
return undefined;
}
return {
'additionalMetadata': value.additionalMetadata,
'file': value.file,
};
}


Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

export const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, "");

const isBlob = (value: any) => typeof Blob !== 'undefined' && value instanceof Blob;

/**
* This is the base class for all generated API classes.
*/
Expand Down Expand Up @@ -58,7 +60,9 @@ export class BaseAPI {
// do not handle correctly sometimes.
url += '?' + querystring(context.query);
}
const body = context.body instanceof FormData ? context.body : JSON.stringify(context.body);
const body = (context.body instanceof FormData || isBlob(context.body))
? context.body
: JSON.stringify(context.body);
const init = {
method: context.method,
headers: context.headers,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// tslint:disable
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface InlineObject
*/
export interface InlineObject {
/**
* Updated name of the pet
* @type {string}
* @memberof InlineObject
*/
name?: string;
/**
* Updated status of the pet
* @type {string}
* @memberof InlineObject
*/
status?: string;
}

export function InlineObjectFromJSON(json: any): InlineObject {
return {
'name': !exists(json, 'name') ? undefined : json['name'],
'status': !exists(json, 'status') ? undefined : json['status'],
};
}

export function InlineObjectToJSON(value?: InlineObject): any {
if (value === undefined) {
return undefined;
}
return {
'name': value.name,
'status': value.status,
};
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// tslint:disable
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface InlineObject1
*/
export interface InlineObject1 {
/**
* Additional data to pass to server
* @type {string}
* @memberof InlineObject1
*/
additionalMetadata?: string;
/**
* file to upload
* @type {Blob}
* @memberof InlineObject1
*/
file?: Blob;
}

export function InlineObject1FromJSON(json: any): InlineObject1 {
return {
'additionalMetadata': !exists(json, 'additionalMetadata') ? undefined : json['additionalMetadata'],
'file': !exists(json, 'file') ? undefined : json['file'],
};
}

export function InlineObject1ToJSON(value?: InlineObject1): any {
if (value === undefined) {
return undefined;
}
return {
'additionalMetadata': value.additionalMetadata,
'file': value.file,
};
}


Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

export const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, "");

const isBlob = (value: any) => typeof Blob !== 'undefined' && value instanceof Blob;

/**
* This is the base class for all generated API classes.
*/
Expand Down Expand Up @@ -58,7 +60,9 @@ export class BaseAPI {
// do not handle correctly sometimes.
url += '?' + querystring(context.query);
}
const body = context.body instanceof FormData ? context.body : JSON.stringify(context.body);
const body = (context.body instanceof FormData || isBlob(context.body))
? context.body
: JSON.stringify(context.body);
const init = {
method: context.method,
headers: context.headers,
Expand Down
Loading