UNPKG

cybersource-rest-client

Version:

Node.js SDK for the CyberSource REST API

123 lines (107 loc) 4.75 kB
/** * CyberSource Merged Spec * All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html * * OpenAPI spec version: 0.0.1 * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * * Swagger Codegen version: 2.4.38 * * Do not edit the class manually. * */ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['Authentication/MLEUtility', 'ApiClient', 'model/PtsV2PaymentsRefundPost400Response', 'model/UmsV1UsersGet200Response'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../authentication/util/MLEUtility'), require('../ApiClient'), require('../model/PtsV2PaymentsRefundPost400Response'), require('../model/UmsV1UsersGet200Response')); } else { // Browser globals (root is window) if (!root.CyberSource) { root.CyberSource = {}; } root.CyberSource.UserManagementApi = factory(root.Authentication.MLEUtility, root.CyberSource.ApiClient, root.CyberSource.PtsV2PaymentsRefundPost400Response, root.CyberSource.UmsV1UsersGet200Response); } }(this, function(MLEUtility, ApiClient, PtsV2PaymentsRefundPost400Response, UmsV1UsersGet200Response) { 'use strict'; /** * UserManagement service. * @module api/UserManagementApi * @version 0.0.1 */ /** * Constructs a new UserManagementApi. * @alias module:api/UserManagementApi * @class * @param {module:ApiClient} apiClient Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ var exports = function(configObject, apiClient) { this.apiClient = apiClient || ApiClient.instance; this.apiClient.setConfiguration(configObject); /** * Callback function to receive the result of the getUsers operation. * @callback module:api/UserManagementApi~getUsersCallback * @param {String} error Error message, if any. * @param {module:model/UmsV1UsersGet200Response} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get User Information - Deprecated * This endpoint is deprecated. Please use the search end point. * @param {Object} opts Optional parameters * @param {String} opts.organizationId This is the orgId of the organization which the user belongs to. * @param {String} opts.userName User ID of the user you want to get details on. * @param {String} opts.permissionId permission that you are trying to search user on. * @param {String} opts.roleId role of the user you are trying to search on. * @param {module:api/UserManagementApi~getUsersCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/UmsV1UsersGet200Response} */ this.getUsers = function(opts, callback) { opts = opts || {}; var postBody = null; if ('GET' == 'POST') { postBody = '{}'; } var pathParams = { }; var queryParams = { 'organizationId': opts['organizationId'], 'userName': opts['userName'], 'permissionId': opts['permissionId'], 'roleId': opts['roleId'] }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json;charset=utf-8']; var accepts = ['application/hal+json;charset=utf-8']; var returnType = UmsV1UsersGet200Response; //check isMLE for an api method 'this.getUsers' var inboundMLEStatus = 'false'; var isMLEForApi = MLEUtility.checkIsMLEForAPI(this.apiClient.merchantConfig, inboundMLEStatus, 'getUsers'); if (isMLEForApi === true) { MLEUtility.encryptRequestPayload(this.apiClient.merchantConfig, postBody).then(postBody => { return this.apiClient.callApi( '/ums/v1/users', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }); } else { return this.apiClient.callApi( '/ums/v1/users', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } } }; return exports; }));