Skip to content

Commit

Permalink
chore(client): update to latest version of openapi ts
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Shatford <[email protected]>
  • Loading branch information
jordanshatford committed Mar 31, 2024
1 parent c2ac66d commit 2a26257
Show file tree
Hide file tree
Showing 5 changed files with 294 additions and 37 deletions.
2 changes: 1 addition & 1 deletion packages/client/openapi-ts.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module.exports = {
input: require('@yd/api'),
output: './src/generated',
client: 'fetch',
enums: true,
enums: 'javascript',
exportSchemas: false
};
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"format": "prettier --write ."
},
"devDependencies": {
"@hey-api/openapi-ts": "^0.31.0",
"@hey-api/openapi-ts": "^0.32.1",
"@yd/api": "workspace:*",
"@yd/config": "workspace:*",
"prettier": "^3.2.5",
Expand Down
45 changes: 34 additions & 11 deletions packages/client/src/generated/core/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,7 @@ export const isStringWithValue = (value: unknown): value is string => {
};

export const isBlob = (value: any): value is Blob => {
return (
value !== null &&
typeof value === 'object' &&
typeof value.type === 'string' &&
typeof value.stream === 'function' &&
typeof value.arrayBuffer === 'function' &&
typeof value.constructor === 'function' &&
typeof value.constructor.name === 'string' &&
/^(Blob|File)$/.test(value.constructor.name) &&
/^(Blob|File)$/.test(value[Symbol.toStringTag])
);
return value instanceof Blob;
};

export const isFormData = (value: unknown): value is FormData => {
Expand Down Expand Up @@ -255,11 +245,44 @@ export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult):
const errors: Record<number, string> = {
400: 'Bad Request',
401: 'Unauthorized',
402: 'Payment Required',
403: 'Forbidden',
404: 'Not Found',
405: 'Method Not Allowed',
406: 'Not Acceptable',
407: 'Proxy Authentication Required',
408: 'Request Timeout',
409: 'Conflict',
410: 'Gone',
411: 'Length Required',
412: 'Precondition Failed',
413: 'Payload Too Large',
414: 'URI Too Long',
415: 'Unsupported Media Type',
416: 'Range Not Satisfiable',
417: 'Expectation Failed',
418: 'Im a teapot',
421: 'Misdirected Request',
422: 'Unprocessable Content',
423: 'Locked',
424: 'Failed Dependency',
425: 'Too Early',
426: 'Upgrade Required',
428: 'Precondition Required',
429: 'Too Many Requests',
431: 'Request Header Fields Too Large',
451: 'Unavailable For Legal Reasons',
500: 'Internal Server Error',
501: 'Not Implemented',
502: 'Bad Gateway',
503: 'Service Unavailable',
504: 'Gateway Timeout',
505: 'HTTP Version Not Supported',
506: 'Variant Also Negotiates',
507: 'Insufficient Storage',
508: 'Loop Detected',
510: 'Not Extended',
511: 'Network Authentication Required',
...options.errors
};

Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/generated/services/DownloadsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class DownloadsService {
* @returns binary Successful Response
* @throws ApiError
*/
public static getDownloadFile(data: TDataGetDownloadFile): CancelablePromise<Blob> {
public static getDownloadFile(data: TDataGetDownloadFile): CancelablePromise<Blob | File> {
const { downloadId } = data;
return __request(OpenAPI, {
method: 'GET',
Expand Down
Loading

0 comments on commit 2a26257

Please sign in to comment.