Skip to content

Commit

Permalink
Encapsulate request result in SuccessResponse (#67)
Browse files Browse the repository at this point in the history
This enables us to augment the response with additional parameters. Eg cf-ray id or raw request/responseApiError.
  • Loading branch information
rbruggem authored Jun 20, 2024
1 parent 3ede9f0 commit 272693e
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 79 deletions.
3 changes: 2 additions & 1 deletion src/templates/exportService.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type { {{{this}}} } from '../models/{{{this}}}.js';
{{#notEquals @root.httpClient 'angular'}}
import { ClientConfig } from '../core/ClientConfig.js'
import { request as __request } from '../core/request.js'
import { SuccessResponse } from '../core/SuccessResponse.js'
import { ApiError } from '../core/ApiError.js'
import { AxiosInstance } from 'axios'
import { Result } from 'ts-results-es'
Expand Down Expand Up @@ -83,7 +84,7 @@ export abstract class {{{name}}}{{{@root.postfix}}} {
public {{{name}}}({{>parameters}}): Observable<{{>result}}> {
return __request(OpenAPI, this.http, {
{{else}}
public {{{name}}}({{>parameters}}): Promise<Result<{{>result}}, ApiError>> {
public {{{name}}}({{>parameters}}): Promise<Result<SuccessResponse<{{>result}}>, ApiError>> {
return __request(this.client, this.config, options || {}, {
{{/equals}}
{{/if}}
Expand Down
Loading

0 comments on commit 272693e

Please sign in to comment.