@@ -49,19 +49,19 @@ class SDK {
4949 }
5050
5151 api ( uri ) {
52- var _ref = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : { } ,
53- _ref $authenticate = _ref . authenticate ;
54-
55- let authenticate = _ref$authenticate === undefined ? true : _ref$authenticate ,
56- body = _ref . body ;
57- var _ref$headers = _ref . headers ;
58- let headers = _ref$headers === undefined ? { } : _ref$headers ;
59- var _ref$method = _ref . method ;
60- let method = _ref$method === undefined ? 'get' : _ref$method ,
61- queryParams = _ref . queryParams ,
62- raw = _ref . raw ;
63- var _ref$version = _ref . version ;
64- let version = _ref$version === undefined ? this . options . version : _ref$version ;
52+ let options = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : { } ;
53+ var _options $authenticate = options . authenticate ;
54+ const authenticate = _options$authenticate === undefined ? true : _options$authenticate ;
55+ var _options$headers = options . headers ;
56+ const headers = _options$headers === undefined ? { } : _options$headers ;
57+ var _options$method = options . method ;
58+ const method = _options$method === undefined ? 'get' : _options$method ,
59+ queryParams = options . queryParams ,
60+ raw = options . raw ;
61+ var _options$version = options . version ;
62+ const version = _options$version === undefined ? this . options . version : _options$version ;
63+ let body = options . body ;
64+
6565
6666 const url = ( 0 , _utils . buildUrl ) ( uri , this . options . baseUrl , version , queryParams ) ;
6767
@@ -76,15 +76,15 @@ class SDK {
7676
7777 if ( authenticate && ! headers . authorization ) {
7878 request = this . getToken ( ) . then ( tokens => {
79- return this . client . request ( url , method , body , _extends ( { } , ( 0 , _utils . buildBearerAuthorizationHeader ) ( tokens . access_token ) , headers ) ) ;
79+ return this . client . request ( url , method , body , _extends ( { } , ( 0 , _utils . buildBearerAuthorizationHeader ) ( tokens . access_token ) , headers ) , options ) ;
8080 } ) ;
8181 } else {
82- request = this . client . request ( url , method , body , headers ) ;
82+ request = this . client . request ( url , method , body , headers , options ) ;
8383 }
8484
8585 return request . then ( data => {
8686 return raw ? data : data . body ;
87- } ) . catch ( this . _refreshToken ( url , method , body , headers ) ) ;
87+ } ) . catch ( this . _refreshToken ( url , method , body , headers , options ) ) ;
8888 }
8989
9090 authorize ( code ) {
@@ -149,18 +149,19 @@ class SDK {
149149 } ) . then ( ( ) => token ) ;
150150 }
151151
152- _authenticationRequest ( _ref2 ) {
153- let body = _ref2 . body ,
154- headers = _ref2 . headers ,
155- url = _ref2 . url ;
152+ _authenticationRequest ( _ref ) {
153+ let body = _ref . body ,
154+ headers = _ref . headers ,
155+ url = _ref . url ;
156156
157- return this . client . request ( url , 'post' , body , headers ) . then ( ( _ref3 ) => {
158- let body = _ref3 . body ;
157+ return this . client . request ( url , 'post' , body , headers ) . then ( ( _ref2 ) => {
158+ let body = _ref2 . body ;
159159 return this . setToken ( body ) ;
160160 } ) ;
161161 }
162162
163- _refreshToken ( url , method , body , headers ) {
163+ _refreshToken ( url , method , body , headers , options ) {
164+ // eslint-disable-line max-params
164165 return response => {
165166 if ( ! response || ! response . body || response . body . error !== 'invalid_token' ) {
166167 return Promise . reject ( response ) ;
@@ -171,7 +172,7 @@ class SDK {
171172 }
172173
173174 return this . refreshRequestPromise . then ( tokens => {
174- return this . client . request ( url , method , body , _extends ( { } , ( 0 , _utils . buildBearerAuthorizationHeader ) ( tokens . access_token ) , headers ) ) . then ( data => data . body ) ;
175+ return this . client . request ( url , method , body , _extends ( { } , ( 0 , _utils . buildBearerAuthorizationHeader ) ( tokens . access_token ) , headers ) , options ) . then ( data => data . body ) ;
175176 } ) ;
176177 } ;
177178 }
0 commit comments