Skip to content

Commit

Permalink
[JavaScript] Added plugins variable for the javascript/ES6 client (Op…
Browse files Browse the repository at this point in the history
…enAPITools#1797)

* Added plugins variable for the javascript/ES6 client

* Ran the javascript and javascript-es6 shell script
  • Loading branch information
sredbull authored and wing328 committed Jan 7, 2019
1 parent f58fc21 commit 326771d
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@
* Allow user to override superagent agent
*/
this.requestAgent = null;

/*
* Allow user to add superagent plugins
*/
this.plugins = null;
};

{{#emitJSDoc}} /**
Expand Down Expand Up @@ -381,6 +386,14 @@
var url = this.buildUrl(path, pathParams);
var request = superagent(httpMethod, url);
if (this.plugins !== null) {
for (var index in this.plugins) {
if (this.plugins.hasOwnProperty(index)) {
request.use(this.plugins[index])
}
}
}

// apply authentications
this.applyAuthToRequest(request, authNames);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ class ApiClient {
*/
this.requestAgent = null;

/*
* Allow user to add superagent plugins
*/
this.plugins = null;

}

{{#emitJSDoc}}/**
Expand Down Expand Up @@ -352,6 +357,14 @@ class ApiClient {
var url = this.buildUrl(path, pathParams);
var request = superagent(httpMethod, url);
if (this.plugins !== null) {
for (var index in this.plugins) {
if (this.plugins.hasOwnProperty(index)) {
request.use(this.plugins[index])
}
}
}

// apply authentications
this.applyAuthToRequest(request, authNames);

Expand Down
13 changes: 13 additions & 0 deletions samples/client/petstore/javascript-es6/src/ApiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ class ApiClient {
*/
this.requestAgent = null;

/*
* Allow user to add superagent plugins
*/
this.plugins = null;

}

/**
Expand Down Expand Up @@ -354,6 +359,14 @@ class ApiClient {
var url = this.buildUrl(path, pathParams);
var request = superagent(httpMethod, url);

if (this.plugins !== null) {
for (var index in this.plugins) {
if (this.plugins.hasOwnProperty(index)) {
request.use(this.plugins[index])
}
}
}

// apply authentications
this.applyAuthToRequest(request, authNames);

Expand Down
13 changes: 13 additions & 0 deletions samples/client/petstore/javascript/src/ApiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@
* Allow user to override superagent agent
*/
this.requestAgent = null;

/*
* Allow user to add superagent plugins
*/
this.plugins = null;
};

/**
Expand Down Expand Up @@ -387,6 +392,14 @@
var url = this.buildUrl(path, pathParams);
var request = superagent(httpMethod, url);

if (this.plugins !== null) {
for (var index in this.plugins) {
if (this.plugins.hasOwnProperty(index)) {
request.use(this.plugins[index])
}
}
}

// apply authentications
this.applyAuthToRequest(request, authNames);

Expand Down

0 comments on commit 326771d

Please sign in to comment.