Skip to content

Commit

Permalink
make api_gen gen_e2e gen_samples
Browse files Browse the repository at this point in the history
  • Loading branch information
huequica committed Jan 16, 2023
1 parent 0b82afd commit e93bb9a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions e2e/multipart/clients/ts/api_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface MiddlewareContext {
response?: unknown;
responseBody?: string;
responseHeaders?: Headers;
statusCode?: number;
baseURL: string;
headers: {[key: string]: string};
options: {[key: string]: any};
Expand Down Expand Up @@ -186,6 +187,7 @@ class ParamClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -402,6 +404,7 @@ export class APIClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down
2 changes: 2 additions & 0 deletions samples/empty_root/clients/ts/api_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface MiddlewareContext {
response?: unknown;
responseBody?: string;
responseHeaders?: Headers;
statusCode?: number;
baseURL: string;
headers: {[key: string]: string};
options: {[key: string]: any};
Expand Down Expand Up @@ -170,6 +171,7 @@ class FooBarClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down
16 changes: 16 additions & 0 deletions samples/standard/clients/ts/api_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export interface MiddlewareContext {
response?: unknown;
responseBody?: string;
responseHeaders?: Headers;
statusCode?: number;
baseURL: string;
headers: {[key: string]: string};
options: {[key: string]: any};
Expand Down Expand Up @@ -253,6 +254,7 @@ class ServiceClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -405,6 +407,7 @@ class ServiceGroupsClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -600,6 +603,7 @@ class ServiceStaticPageClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -805,6 +809,7 @@ class ServiceUser2Client {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -889,6 +894,7 @@ class ServiceUser2Client {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -989,6 +995,7 @@ class ServiceUser2Client {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -1075,6 +1082,7 @@ class ServiceUser2Client {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -1224,6 +1232,7 @@ class ServiceUser2UserIDClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -1364,6 +1373,7 @@ class ServiceUser2UserIDJobIDClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -1505,6 +1515,7 @@ class ServiceUserClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -1591,6 +1602,7 @@ class ServiceUserClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -1677,6 +1689,7 @@ class ServiceUserClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -1876,6 +1889,7 @@ export class APIClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -1982,6 +1996,7 @@ export class APIClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down Expand Up @@ -2074,6 +2089,7 @@ export class APIClient {
const responseText = await resp.text();
context.responseBody = responseText;
context.responseHeaders = resp.headers;
context.statusCode = resp.status;

if (Math.floor(resp.status / 100) !== 2) {
await this.callMiddleware(this.afterMiddleware, context);
Expand Down

0 comments on commit e93bb9a

Please sign in to comment.