|
15 | 15 | (function(root, factory) { |
16 | 16 | if (typeof define === 'function' && define.and) { |
17 | 17 | // AMD. Register as an anonymous module. |
18 | | - define(['ApiClient', 'model/AccessToken'], factory); |
| 18 | + define(['Sdk', 'model/AccessToken'], factory); |
19 | 19 | } else if (typeof module === 'object' && module.exports) { |
20 | 20 | // CommonJS-like environments that support module.exports, like Node. |
21 | | - module.exports = factory(require('../ApiClient'), require('../model/AccessToken')); |
| 21 | + module.exports = factory(require('../Sdk'), require('../model/AccessToken')); |
22 | 22 | } else { |
23 | 23 | if (!root.OrderCloud) { |
24 | 24 | root.OrderCloud = {}; |
25 | 25 | } |
26 | | - root.OrderCloud.Auth = factory(root.OrderCloud.ApiClient, root.OrderCloud.AccessToken); |
| 26 | + root.OrderCloud.Auth = factory(root.OrderCloud.Sdk, root.OrderCloud.AccessToken); |
27 | 27 | } |
28 | | -}(this, function(ApiClient, AccessToken) { |
| 28 | +}(this, function(Sdk, AccessToken) { |
29 | 29 | 'use strict'; |
30 | 30 |
|
31 | 31 | /** |
|
37 | 37 | * Constructs a new Auth. |
38 | 38 | * @alias module:api/Auth |
39 | 39 | * @class |
40 | | - * @param {module:ApiClient} apiClient Optional API client implementation to use, |
41 | | - * default to {@link module:ApiClient#instance} if unspecified. |
| 40 | + * @param {module:Sdk} sdk Optional SDK implementation to use, |
| 41 | + * default to {@link module:Sdk#instance} if unspecified. |
42 | 42 | */ |
43 | 43 |
|
44 | | - var exports = function(apiClient) { |
45 | | - this.apiClient = apiClient || ApiClient.instance; |
| 44 | + var exports = function(sdk) { |
| 45 | + this.sdk = sdk || Sdk.instance; |
46 | 46 |
|
47 | 47 | /** |
48 | 48 | * @param {String} username of the user logging in |
|
67 | 67 | throw new Error("Missing the required parameter 'scope' when calling Login"); |
68 | 68 | } |
69 | 69 |
|
70 | | - var postBody = 'grant_type=password&scope=' + this.apiClient.buildCollectionParam(scope, 'plus') + '&client_id=' + clientID + '&username=' + username + '&password=' + password; |
| 70 | + var postBody = 'grant_type=password&scope=' + this.sdk.buildCollectionParam(scope, 'plus') + '&client_id=' + clientID + '&username=' + username + '&password=' + password; |
71 | 71 |
|
72 | 72 | var pathParams = {}; |
73 | 73 | var queryParams = {}; |
|
79 | 79 | var accepts = ['application/json']; |
80 | 80 | var returnType = AccessToken; |
81 | 81 |
|
82 | | - return this.apiClient.callAuth( |
| 82 | + return this.sdk.callAuth( |
83 | 83 | '/oauth/token', 'POST', |
84 | 84 | pathParams, queryParams, headerParams, formParams, postBody, |
85 | 85 | authNames, contentTypes, accepts, returnType |
|
114 | 114 | throw new Error("Missing the required parameter 'scope' when calling ElevatedLogin"); |
115 | 115 | } |
116 | 116 |
|
117 | | - var postBody = 'grant_type=password&scope=' + this.apiClient.buildCollectionParam(scope, 'plus') + '&client_secret=' + clientSecret + '&client_id=' + clientID + '&username=' + username + '&password=' + password; |
| 117 | + var postBody = 'grant_type=password&scope=' + this.sdk.buildCollectionParam(scope, 'plus') + '&client_secret=' + clientSecret + '&client_id=' + clientID + '&username=' + username + '&password=' + password; |
118 | 118 |
|
119 | 119 | var pathParams = {}; |
120 | 120 | var queryParams = {}; |
|
126 | 126 | var accepts = ['application/json']; |
127 | 127 | var returnType = AccessToken; |
128 | 128 |
|
129 | | - return this.apiClient.callAuth( |
| 129 | + return this.sdk.callAuth( |
130 | 130 | '/oauth/token', 'POST', |
131 | 131 | pathParams, queryParams, headerParams, formParams, postBody, |
132 | 132 | authNames, contentTypes, accepts, returnType |
|
151 | 151 | throw new Error("Missing the required parameter 'scope' when calling ElevatedLogin"); |
152 | 152 | } |
153 | 153 |
|
154 | | - var postBody = 'grant_type=client_credentials&scope=' + this.apiClient.buildCollectionParam(scope, 'plus') + '&client_secret=' + clientSecret + '&client_id=' + clientID; |
| 154 | + var postBody = 'grant_type=client_credentials&scope=' + this.sdk.buildCollectionParam(scope, 'plus') + '&client_secret=' + clientSecret + '&client_id=' + clientID; |
155 | 155 |
|
156 | 156 | var pathParams = {}; |
157 | 157 | var queryParams = {}; |
|
163 | 163 | var accepts = ['application/json']; |
164 | 164 | var returnType = AccessToken; |
165 | 165 |
|
166 | | - return this.apiClient.callAuth( |
| 166 | + return this.sdk.callAuth( |
167 | 167 | '/oauth/token', 'POST', |
168 | 168 | pathParams, queryParams, headerParams, formParams, postBody, |
169 | 169 | authNames, contentTypes, accepts, returnType |
|
188 | 188 | throw new Error("Missing the required parameter 'scope' when calling RefreshToken"); |
189 | 189 | } |
190 | 190 |
|
191 | | - var postBody = 'grant_type=refresh_token&scope=' + this.apiClient.buildCollectionParam(scope, 'plus') + '&refresh_token=' + refreshToken + '&client_id=' + clientID; |
| 191 | + var postBody = 'grant_type=refresh_token&scope=' + this.sdk.buildCollectionParam(scope, 'plus') + '&refresh_token=' + refreshToken + '&client_id=' + clientID; |
192 | 192 |
|
193 | 193 | var pathParams = {}; |
194 | 194 | var queryParams = {}; |
|
200 | 200 | var accepts = ['application/json']; |
201 | 201 | var returnType = AccessToken; |
202 | 202 |
|
203 | | - return this.apiClient.callAuth( |
| 203 | + return this.sdk.callAuth( |
204 | 204 | '/oauth/token', 'POST', |
205 | 205 | pathParams, queryParams, headerParams, formParams, postBody, |
206 | 206 | authNames, contentTypes, accepts, returnType |
|
220 | 220 | throw new Error("Missing the required parameter 'scope' when calling RefreshToken"); |
221 | 221 | } |
222 | 222 |
|
223 | | - var postBody = 'grant_type=client_credentials&scope=' + this.apiClient.buildCollectionParam(scope, 'plus') + '&client_id=' + clientID; |
| 223 | + var postBody = 'grant_type=client_credentials&scope=' + this.sdk.buildCollectionParam(scope, 'plus') + '&client_id=' + clientID; |
224 | 224 |
|
225 | 225 | var pathParams = {}; |
226 | 226 | var queryParams = {}; |
|
232 | 232 | var accepts = ['application/json']; |
233 | 233 | var returnType = AccessToken; |
234 | 234 |
|
235 | | - return this.apiClient.callAuth( |
| 235 | + return this.sdk.callAuth( |
236 | 236 | '/oauth/token', 'POST', |
237 | 237 | pathParams, queryParams, headerParams, formParams, postBody, |
238 | 238 | authNames, contentTypes, accepts, returnType |
|
0 commit comments