diff --git a/rest-api-sdk/src/api/OAuthApi.js b/rest-api-sdk/src/api/OAuthApi.js index 2c5d36a..dc59cd3 100644 --- a/rest-api-sdk/src/api/OAuthApi.js +++ b/rest-api-sdk/src/api/OAuthApi.js @@ -14,7 +14,7 @@ (function(factory) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../utils/ApiClient'), require('../utils/Context'), require('../utils/OAuthUtils'), require('../model/oAuth/OAuthIndex'), require('../utils/validator/OAuthApiValidator'), require('../utils/ApiError')); - + }(function(ApiClient, Context, OAuthUtils, OAuthIndex, OAuthApiValidator, ApiError) { 'use strict'; @@ -35,7 +35,7 @@ /** * Retrieves the authorization url that will be used to get the authorization code. * @function getAuthorizationUrl - * @param authorizationRequest {Object} Authorization request + * @param authorizationRequest {Object} Authorization request * @returns {String} The authorization url where the user will be directed to authorize the application. * @instance */ @@ -64,7 +64,7 @@ /** * Retrieves the access token with the required scopes using the authorization code granted during the authorization. * @function getAccessToken - * @param accessTokenRequest {Object} Access token request + * @param accessTokenRequest {Object} Access token request * @returns {Promise} A promise that returns {@link module:model/oAuth/AccessTokenResponse|AccessTokenResponse} if resolved and apiError if rejected. * @instance */ @@ -141,7 +141,9 @@ 'refresh_token': accessTokenRefreshRequest['refreshToken'], 'client_id': accessTokenRefreshRequest['clientId'], 'client_secret': accessTokenRefreshRequest['clientSecret'], - 'grant_type': accessTokenRefreshRequest['grantType'] + 'grant_type': accessTokenRefreshRequest['grantType'], + 'redirect_uri': accessTokenRefreshRequest['redirectUri'], + 'code': accessTokenRefreshRequest['code'] }; var contentTypes = ['application/x-www-form-urlencoded']; diff --git a/rest-api-sdk/src/model/oAuth/AccessTokenRefreshRequest.js b/rest-api-sdk/src/model/oAuth/AccessTokenRefreshRequest.js index 6814524..0335023 100644 --- a/rest-api-sdk/src/model/oAuth/AccessTokenRefreshRequest.js +++ b/rest-api-sdk/src/model/oAuth/AccessTokenRefreshRequest.js @@ -15,7 +15,7 @@ (function(factory) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../../utils/ApiClient')); - + }(function(ApiClient) { 'use strict'; @@ -38,11 +38,13 @@ var AccessTokenRefreshRequest = function() { _this.clientSecret = undefined; _this.refreshToken = undefined; _this.grantType = undefined; + _this.code = undefined; + _this.redirectUri = undefined; /** * Identifies the application configured on the OAuth Configuration page. * @function getClientId - * @return clientId {string} + * @return clientId {string} * @instance */ _this.getClientId = function() { @@ -119,6 +121,41 @@ var AccessTokenRefreshRequest = function() { this.grantType = grantType; }; + /** + * The url where the end user will be redirected after successful completion of authorization. + * This value must belong to the set of values specified on the OAuth Configuration page. + * @function getRedirectUri + * @return redirectUri {string} + * @instance + */ + _this.getRedirectUri = function() { + return this.redirectUri; + }; + + /** + * The url where the end user will be redirected after successful completion of authorization. + * This value must belong to the set of values specified on the OAuth Configuration page. + * @function setRedirectUri + * @param redirectUri {string} RedirectUri + * @instance + */ + _this.setRedirectUri = function (redirectUri) { + this.redirectUri = redirectUri; + }; + + /** + * @return code + */ + _this.getCode = function() { + return this.code; + }; + + /** + * @param code Code + */ + _this.setCode = function (code) { + this.code = code; + }; }; @@ -146,6 +183,14 @@ AccessTokenRefreshRequest.constructFromObject = function(data, obj) { if (data.hasOwnProperty('grant_type')) { obj.setGrantType(data.grant_type); } + + if (data.hasOwnProperty('redirect_uri')) { + obj.setRedirectUri(data.redirect_uri); + } + + if (data.hasOwnProperty('code')) { + obj.setCode(data.code); + } } return obj; };