-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrapsplash.js.map
1 lines (1 loc) · 62 KB
/
wrapsplash.js.map
1
{"version":3,"file":"wrapsplash.js","sources":["webpack://wrapsplash/webpack/universalModuleDefinition","webpack://wrapsplash/webpack/bootstrap","webpack://wrapsplash/./config/axiosConfig.js","webpack://wrapsplash/./lib/axiosAjaxLib.js","webpack://wrapsplash/./node_modules/crypto-browserify/index.js","webpack://wrapsplash/./src/index.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"wrapsplash\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"wrapsplash\"] = factory();\n\telse\n\t\troot[\"wrapsplash\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.js\");\n","'use strict';\n\n/**\r\n * Axios Configuration Object\r\n */\n\nvar axiosConfig = {\n // `url` is the server URL that will be used for the request\n url: '',\n\n // `method` is the request method to be used when making the request\n method: '', // default\n\n // `baseURL` will be prepended to `url` unless `url` is absolute.\n // It can be convenient to set `baseURL` for an instance of axios to pass relative URLs\n // to methods of that instance.\n baseURL: '',\n\n // `transformRequest` allows changes to the request data before it is sent to the server\n // This is only applicable for request methods 'PUT', 'POST', and 'PATCH'\n // The last function in the array must return a string or an instance of Buffer, ArrayBuffer,\n // FormData or Stream\n // You may modify the headers object.\n // transformRequest: [function (data, headers) {\n // // Do whatever you want to transform the data\n\n // return data;\n // }],\n\n // `transformResponse` allows changes to the response data to be made before\n // it is passed to then/catch\n // transformResponse: [function (data) {\n // // Do whatever you want to transform the data\n\n // return data;\n // }],\n\n // `headers` are custom headers to be sent\n headers: {},\n\n // `params` are the URL parameters to be sent with the request\n // Must be a plain object or a URLSearchParams object\n // params: {\n // ID: ''\n // },\n\n // `paramsSerializer` is an optional function in charge of serializing `params`\n // (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)\n // paramsSerializer: function (params) {\n // return Qs.stringify(params, {\n // arrayFormat: 'brackets'\n // })\n // },\n\n // `data` is the data to be sent as the request body\n // Only applicable for request methods 'PUT', 'POST', and 'PATCH'\n // When no `transformRequest` is set, must be of one of the following types:\n // - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams\n // - Browser only: FormData, File, Blob\n // - Node only: Stream, Buffer\n data: {},\n\n // `timeout` specifies the number of milliseconds before the request times out.\n // If the request takes longer than `timeout`, the request will be aborted.\n timeout: 1000,\n\n // `withCredentials` indicates whether or not cross-site Access-Control requests\n // should be made using credentials\n withCredentials: false, // default\n\n // `adapter` allows custom handling of requests which makes testing easier.\n // Return a promise and supply a valid response (see lib/adapters/README.md).\n // adapter: function (config) {\n // /* ... */\n // },\n\n // `auth` indicates that HTTP Basic auth should be used, and supplies credentials.\n // This will set an `Authorization` header, overwriting any existing\n // `Authorization` custom headers you have set using `headers`.\n //auth: {},\n\n // `responseType` indicates the type of data that the server will respond with\n // options are 'arraybuffer', 'blob', 'document', 'json', 'text', 'stream'\n responseType: 'json', // default\n\n // `responseEncoding` indicates encoding to use for decoding responses\n // Note: Ignored for `responseType` of 'stream' or client-side requests\n responseEncoding: 'utf8', // default\n\n // `xsrfCookieName` is the name of the cookie to use as a value for xsrf token\n xsrfCookieName: 'XSRF-TOKEN', // default\n\n // `xsrfHeaderName` is the name of the http header that carries the xsrf token value\n xsrfHeaderName: 'X-XSRF-TOKEN', // default\n\n // // `onUploadProgress` allows handling of progress events for uploads\n // onUploadProgress: function (progressEvent) {\n // // Do whatever you want with the native progress event\n // },\n\n // // `onDownloadProgress` allows handling of progress events for downloads\n // onDownloadProgress: function (progressEvent) {\n // // Do whatever you want with the native progress event\n // },\n\n // `maxContentLength` defines the max size of the http response content in bytes allowed\n //maxContentLength: 2000,\n\n // `validateStatus` defines whether to resolve or reject the promise for a given\n // HTTP response status code. If `validateStatus` returns `true` (or is set to `null`\n // or `undefined`), the promise will be resolved; otherwise, the promise will be\n // rejected.\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300; // default\n },\n\n // `maxRedirects` defines the maximum number of redirects to follow in node.js.\n // If set to 0, no redirects will be followed.\n maxRedirects: 5, // default\n\n // `socketPath` defines a UNIX Socket to be used in node.js.\n // e.g. '/var/run/docker.sock' to send requests to the docker daemon.\n // Only either `socketPath` or `proxy` can be specified.\n // If both are specified, `socketPath` is used.\n socketPath: null // default\n\n // `httpAgent` and `httpsAgent` define a custom agent to be used when performing http\n // and https requests, respectively, in node.js. This allows options to be added like\n // `keepAlive` that are not enabled by default.\n // httpAgent: new http.Agent({\n // keepAlive: true\n // }),\n // httpsAgent: new https.Agent({\n // keepAlive: true\n // }),\n\n // 'proxy' defines the hostname and port of the proxy server.\n // You can also define your proxy using the conventional `http_proxy` and\n // `https_proxy` environment variables. If you are using environment variables\n // for your proxy configuration, you can also define a `no_proxy` environment\n // variable as a comma-separated list of domains that should not be proxied.\n // Use `false` to disable proxies, ignoring environment variables.\n // `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and\n // supplies credentials.\n // This will set an `Proxy-Authorization` header, overwriting any existing\n // `Proxy-Authorization` custom headers you have set using `headers`.\n // proxy: {\n // host: '127.0.0.1',\n // port: 9000,\n // auth: {}\n // },\n\n // `cancelToken` specifies a cancel token that can be used to cancel the request\n // (see Cancellation section below for details)\n //cancelToken: new CancelToken(function (cancel) {})\n};\n\nmodule.exports = axiosConfig;","'use strict';\n\nvar _axios = require('axios');\n\nvar _axios2 = _interopRequireDefault(_axios);\n\nvar _axiosConfig = require('../config/axiosConfig');\n\nvar _axiosConfig2 = _interopRequireDefault(_axiosConfig);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } } /**\r\n * Axios Ajax Library - Wrapper\r\n */\n\n/**\r\n * Import Axios library\r\n */\n\n\n/**\r\n * Import axios configuration object\r\n */\n\n\n/**\r\n * @class AxiosAjax\r\n * Axios Ajax class\r\n */\nvar AxiosAjax =\n\n/**\r\n * initialize the data and attributes\r\n */\nfunction AxiosAjax(options) {\n var _this = this;\n\n _classCallCheck(this, AxiosAjax);\n\n this.makeRequest = function (url, method, queryParameters, body) {\n _this.url = url ? url : function () {\n throw new Error('URL required');\n }();\n _this.queryParameters = queryParameters || {};\n _this.body = body || {};\n _this.method = method || 'get';\n\n /**\r\n * Make the request\r\n */\n var request = _this.http({\n method: _this.method,\n url: _this.url,\n params: _this.queryParameters,\n data: _this.body\n });\n\n return request;\n };\n\n /**\r\n * Url to fetch\r\n */\n this.url = '';\n\n /**\r\n * HTTP method to use\r\n */\n this.method = '';\n\n /**\r\n * Options for axios\r\n */\n this.options = options || _axiosConfig2.default || {};\n\n /**\r\n * Optional query parameters if any\r\n */\n this.queryParameters = {};\n\n /**\r\n * Optional body to use in request (for post, patch)\r\n */\n this.body = {};\n\n /**\r\n * Initialize the axios instance\r\n */\n this.http = _axios2.default.create(this.options);\n}\n\n/**\r\n * @name makeRequest\r\n * @inner\r\n * Make a request with the options and parameters provided.\r\n * @param {String} url - The url string\r\n * @param {String} method - The HTTP method \r\n * @param {Object} queryParameters - The query parameters\r\n * @param {Object} body - The request body\r\n */\n;\n\nmodule.exports = AxiosAjax;","'use strict'\n\nexports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes')\nexports.createHash = exports.Hash = require('create-hash')\nexports.createHmac = exports.Hmac = require('create-hmac')\n\nvar algos = require('browserify-sign/algos')\nvar algoKeys = Object.keys(algos)\nvar hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys)\nexports.getHashes = function () {\n return hashes\n}\n\nvar p = require('pbkdf2')\nexports.pbkdf2 = p.pbkdf2\nexports.pbkdf2Sync = p.pbkdf2Sync\n\nvar aes = require('browserify-cipher')\n\nexports.Cipher = aes.Cipher\nexports.createCipher = aes.createCipher\nexports.Cipheriv = aes.Cipheriv\nexports.createCipheriv = aes.createCipheriv\nexports.Decipher = aes.Decipher\nexports.createDecipher = aes.createDecipher\nexports.Decipheriv = aes.Decipheriv\nexports.createDecipheriv = aes.createDecipheriv\nexports.getCiphers = aes.getCiphers\nexports.listCiphers = aes.listCiphers\n\nvar dh = require('diffie-hellman')\n\nexports.DiffieHellmanGroup = dh.DiffieHellmanGroup\nexports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup\nexports.getDiffieHellman = dh.getDiffieHellman\nexports.createDiffieHellman = dh.createDiffieHellman\nexports.DiffieHellman = dh.DiffieHellman\n\nvar sign = require('browserify-sign')\n\nexports.createSign = sign.createSign\nexports.Sign = sign.Sign\nexports.createVerify = sign.createVerify\nexports.Verify = sign.Verify\n\nexports.createECDH = require('create-ecdh')\n\nvar publicEncrypt = require('public-encrypt')\n\nexports.publicEncrypt = publicEncrypt.publicEncrypt\nexports.privateEncrypt = publicEncrypt.privateEncrypt\nexports.publicDecrypt = publicEncrypt.publicDecrypt\nexports.privateDecrypt = publicEncrypt.privateDecrypt\n\n// the least I can do is make error messages for the rest of the node.js/crypto api.\n// ;[\n// 'createCredentials'\n// ].forEach(function (name) {\n// exports[name] = function () {\n// throw new Error([\n// 'sorry, ' + name + ' is not implemented yet',\n// 'we accept pull requests',\n// 'https://github.com/crypto-browserify/crypto-browserify'\n// ].join('\\n'))\n// }\n// })\n\nvar rf = require('randomfill')\n\nexports.randomFill = rf.randomFill\nexports.randomFillSync = rf.randomFillSync\n\nexports.createCredentials = function () {\n throw new Error([\n 'sorry, createCredentials is not implemented yet',\n 'we accept pull requests',\n 'https://github.com/crypto-browserify/crypto-browserify'\n ].join('\\n'))\n}\n\nexports.constants = {\n 'DH_CHECK_P_NOT_SAFE_PRIME': 2,\n 'DH_CHECK_P_NOT_PRIME': 1,\n 'DH_UNABLE_TO_CHECK_GENERATOR': 4,\n 'DH_NOT_SUITABLE_GENERATOR': 8,\n 'NPN_ENABLED': 1,\n 'ALPN_ENABLED': 1,\n 'RSA_PKCS1_PADDING': 1,\n 'RSA_SSLV23_PADDING': 2,\n 'RSA_NO_PADDING': 3,\n 'RSA_PKCS1_OAEP_PADDING': 4,\n 'RSA_X931_PADDING': 5,\n 'RSA_PKCS1_PSS_PADDING': 6,\n 'POINT_CONVERSION_COMPRESSED': 2,\n 'POINT_CONVERSION_UNCOMPRESSED': 4,\n 'POINT_CONVERSION_HYBRID': 6\n}\n","/**\r\n * Wrapsplash API wrapper v3.0.8 for Unspalsh API\r\n * written by: Sandeep Vattapparambil\r\n * email: sandeepv68@gmail.com\r\n * website: www.sandeepv.in\r\n * github: github.com/SandeepVattapparambil\r\n * license: MIT\r\n */\n\n/**\r\n * WrapSplashApi Module\r\n * @module WrapSplashApi\r\n */\n\n'use strict';\n//constants. \n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _crypto = require('crypto');\n\nvar _crypto2 = _interopRequireDefault(_crypto);\n\nvar _axiosAjaxLib = require('../lib/axiosAjaxLib');\n\nvar _axiosAjaxLib2 = _interopRequireDefault(_axiosAjaxLib);\n\nvar _url_config = require('../config/url_config.json');\n\nvar _url_config2 = _interopRequireDefault(_url_config);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n//Import library\n\n//API Schema definitions\n\n\n/**\r\n * The main WrapSplash Class.\r\n * @class WrapSplash\r\n */\nvar WrapSplashApi =\n/**\r\n * The Options object constructor\r\n * @param {Object} options - The Options object to initialize the class.\r\n */\nfunction WrapSplashApi() {\n var _this = this;\n\n _classCallCheck(this, WrapSplashApi);\n\n this.init = function () {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (options && (typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object' && options !== null) {\n //Object.assign\n _this.options = _extends({}, options);\n var hash = _crypto2.default.createHmac('sha256', _this.options.access_key ? _this.options.access_key : _this.options.bearer_token).digest('hex');\n if (_this.options.bearer_token) {\n _this.headers = _extends({}, _this.headers, {\n 'Authorization': 'Bearer ' + _this.options.bearer_token,\n 'X-WrapSplash-Header': hash\n });\n return;\n } else {\n _this.access_key = _this.options.access_key ? _this.options.access_key : function () {\n throw new Error('Access Key missing!');\n }();\n _this.secret_key = _this.options.secret_key ? _this.options.secret_key : function () {\n throw new Error('Secret Key missing!');\n }();\n _this.redirect_uri = _this.options.redirect_uri ? _this.options.redirect_uri : function () {\n throw new Error('Redirect URI missing!');\n }();\n _this.code = _this.options.code ? _this.options.code : function () {\n throw new Error('Authorization Code missing!');\n }();\n\n _this.headers = _extends({}, _this.headers, {\n 'Authorization': 'Client-ID ' + _this.options.access_key,\n 'X-WrapSplash-Header': hash\n });\n return;\n }\n } else {\n throw new Error('Initilisation parameters required!');\n }\n };\n\n this.fetchUrl = function (url, method) {\n var ajax = new _axiosAjaxLib2.default({\n headers: _this.headers ? _this.headers : ''\n });\n return ajax.makeRequest(url, method.toLowerCase()).then(function (res) {\n if (res.status === 204) {\n var response = {\n status: res.status,\n statusText: res.statusText,\n message: 'Content Deleted'\n };\n return response;\n } else if (res.status === 403) {\n var _response = {\n status: res.status,\n statusText: res.statusText,\n message: 'Rate Limit Exceeded'\n };\n return _response;\n } else {\n return res.data;\n };\n }).catch(function (err) {\n return Promise.reject(err);\n });\n };\n\n this.generateBearerToken = function () {\n var url = _this.BEARER_TOKEN_URL + '?client_id=' + _this.access_key + '&client_secret=' + _this.secret_key + '&redirect_uri=' + _this.redirect_uri + '&code=' + _this.code + '&grant_type=' + _this.grant_type;\n return _this.fetchUrl(url, 'POST');\n };\n\n this.getCurrentUserProfile = function () {\n var url = _this.API_LOCATION + _url_config2.default.CURRENT_USER_PROFILE;\n return _this.fetchUrl(url, 'GET');\n };\n\n this.updateCurrentUserProfile = function (username, first_name, last_name, email, url, location, bio, instagram_username) {\n var _url = _this.API_LOCATION + _url_config2.default.UPDATE_CURRENT_USER_PROFILE + '?' + (username ? '?username=' + username : '') + (first_name ? '&first_name=' + first_name : '') + (last_name ? '&last_name=' + last_name : '') + (email ? '&email=' + email : '') + (url ? '&url=' + url : '') + (location ? '&location=' + location : '') + (bio ? '&bio=' + bio : '') + (instagram_username ? '&instagram_username=' + instagram_username : '');\n return _this.fetchUrl(_url, 'PUT');\n };\n\n this.getPublicProfile = function (username, width, height) {\n var url = _this.API_LOCATION + _url_config2.default.USERS_PUBLIC_PROFILE + username + '?w=' + (width && !isNaN(width) ? +width : '') + '&h=' + (height && !isNaN(height) ? +height : '');\n return _this.fetchUrl(url, 'GET');\n };\n\n this.getUserPortfolio = function (username) {\n if (!username || username === '' || username === undefined) {\n throw new Error('Parameter : username is required and cannot be empty!');\n }\n var url = _this.API_LOCATION + _url_config2.default.USERS_PORTFOLIO.replace(/:username/gi, username);\n return _this.fetchUrl(url, 'GET');\n };\n\n this.getUserPhotos = function (username, page, per_page, stats, resolution, quantity, order_by) {\n if (!username || username === '' || username === undefined) {\n throw new Error('Parameter : username is required and cannot be empty!');\n }\n if (order_by !== undefined && !_this.availableOrders.includes(order_by)) {\n throw new Error('Parameter : order_by has an unsupported value!');\n }\n if (stats !== undefined && typeof stats !== 'boolean') {\n throw new Error('Parameter : stats is a boolean or optional!');\n }\n var url = _this.API_LOCATION + _url_config2.default.USERS_PHOTOS.replace(/:username/gi, username) + '?page=' + (page && !isNaN(page) ? +page : 1) + '&per_page=' + (per_page && !isNaN(per_page) ? +per_page : 10) + '&order_by=' + (order_by ? order_by : 'latest') + '&stats=' + (stats ? stats : 'false') + '&resolution=' + (resolution ? encodeURIComponent(resolution) : 'days') + '&quantity=' + (quantity ? quantity : 30);\n return _this.fetchUrl(url, 'GET');\n };\n\n this.getUserLikedPhotos = function (username, page, per_page, order_by) {\n if (!username || username === '' || username === undefined) {\n throw new Error('Parameter : username is required and cannot be empty!');\n }\n if (order_by !== undefined && !_this.availableOrders.includes(order_by)) {\n throw new Error('Parameter : order_by has an unsupported value!');\n }\n var url = _this.API_LOCATION + _url_config2.default.USERS_LIKED_PHOTOS.replace(/:username/gi, username) + '?page=' + (page && !isNaN(page) ? +page : 1) + '&per_page=' + (per_page && !isNaN(per_page) ? +per_page : 10) + '&order_by=' + (order_by ? order_by : 'latest');\n return _this.fetchUrl(url, 'GET');\n };\n\n this.getUserCollections = function (username, page, per_page) {\n if (!username || username === '' || username === undefined) {\n throw new Error('Parameter : username is required and cannot be empty!');\n }\n var url = _this.API_LOCATION + _url_config2.default.USERS_COLLECTIONS.replace(/:username/gi, username) + '?page=' + (page && !isNaN(page) ? +page : 1) + '&per_page=' + (per_page && !isNaN(per_page) ? +per_page : 10);\n return _this.fetchUrl(url, 'GET');\n };\n\n this.getUserStatistics = function (username, resolution, quantity) {\n if (!username || username === '' || username === undefined) {\n throw new Error('Parameter : username is required and cannot be empty!');\n }\n var url = _this.API_LOCATION + _url_config2.default.USERS_STATISTICS.replace(/:username/gi, username) + '?resolution=' + (resolution ? encodeURIComponent(resolution) : 'days') + '&quantity=' + (quantity ? quantity : 30);\n return _this.fetchUrl(url, 'GET');\n };\n\n this.listPhotos = function (page, per_page, order_by) {\n if (order_by !== undefined && !_this.availableOrders.includes(order_by)) {\n throw new Error('Parameter : order_by has an unsupported value!');\n }\n var url = _this.API_LOCATION + _url_config2.default.LIST_PHOTOS + '?page=' + (page && !isNaN(page) ? +page : 1) + '&per_page=' + (per_page && !isNaN(per_page) ? +per_page : 10) + '&order_by=' + (order_by ? order_by : 'latest');\n return _this.fetchUrl(url, 'GET');\n };\n\n this.listCuratedPhotos = function (page, per_page, order_by) {\n if (order_by !== undefined && !_this.availableOrders.includes(order_by)) {\n throw new Error('Parameter : order_by has an unsupported value!');\n }\n var url = _this.API_LOCATION + _url_config2.default.LIST_CURATED_PHOTOS + '?page=' + (page && !isNaN(page) ? +page : 1) + '&per_page=' + (per_page && !isNaN(per_page) ? +per_page : 10) + '&order_by=' + (order_by ? order_by : 'latest');\n return _this.fetchUrl(url, 'GET');\n };\n\n this.getAPhoto = function (id, width, height, rect) {\n if (!id || id === undefined || id.length === 0) {\n throw new Error('Parameter : id is required!');\n }\n var url = _this.API_LOCATION + _url_config2.default.GET_A_PHOTO.replace(/:id/gi, id) + '?w=' + (width && !isNaN(width) ? +width : '') + '&h=' + (height && !isNaN(height) ? +height : '') + '&rect=' + (rect && rect.typeof === 'string' ? +encodeURIComponent(rect) : '');\n return _this.fetchUrl(url, 'GET');\n };\n\n this.getARandomPhoto = function (collections, featured, username, query, width, height, orientation, count) {\n if (!_this.availableOrientations.includes(orientation) && orientation !== undefined) {\n throw new Error('Parameter : orientation has an unsupported value!');\n }\n var url = _this.API_LOCATION + _url_config2.default.GET_A_RANDOM_PHOTO + '?collections=' + (collections && !isNaN(collections) ? +encodeURIComponent(collections) : '') + '&featured=' + (featured ? featured : false) + '&username=' + (username ? username : '') + '&query=' + (query ? encodeURIComponent(query) : '') + '&width=' + (width ? width : '') + '&height=' + (height ? height : '') + '&orientation=' + (orientation ? orientation : 'landscape') + '&count=' + (count ? count : 1);\n return _this.fetchUrl(url, 'GET');\n };\n\n this.getPhotoStatistics = function (id, resolution, quantity) {\n if (!id || id === undefined || id.length === 0) {\n throw new Error('Parameter : id is required!');\n }\n var url = _this.API_LOCATION + _url_config2.default.GET_A_PHOTO_STATISTICS.replace(/:id/gi, id) + '?resolution=' + (resolution ? encodeURIComponent(resolution) : 'days') + '&quantity=' + (quantity ? quantity : 30);\n return _this.fetchUrl(url, 'GET');\n };\n\n this.getPhotoLink = function (id) {\n if (!id || id === undefined || id.length === 0) {\n throw new Error('Parameter : id is required!');\n }\n var url = _this.API_LOCATION + _url_config2.default.GET_A_PHOTO_DOWNLOAD_LINK.replace(/:id/gi, id);\n return _this.fetchUrl(url, 'GET');\n };\n\n this.updatePhoto = function (id, location, exif) {\n if (!id || id === undefined || id.length === 0) {\n throw new Error('Parameter : id is required!');\n }\n location = Object.assign({}, location) || {};\n exif = Object.assign({}, exif) || {};\n var url = _this.API_LOCATION + _url_config2.default.UPDATE_A_PHOTO.replace(/:id/, id) + '?' + (location.latitude ? '&location[latitude]=' + encodeURIComponent(location.latitude) : '') + (location.longitude ? '&location[longitude]=' + encodeURIComponent(location.longitude) : '') + (location.name ? '&location[name]=' + encodeURIComponent(location.name) : '') + (location.city ? '&location[city]=' + encodeURIComponent(location.city) : '') + (location.country ? '&location[country]=' + encodeURIComponent(location.country) : '') + (location.confidential ? '&location[confidential]=' + encodeURIComponent(location.confidential) : '') + (exif.make ? '&exif[make]=' + encodeURIComponent(exif.make) : '') + (exif.model ? '&exif[model]=' + encodeURIComponent(exif.model) : '') + (exif.exposure_time ? '&exif[exposure_time]=' + encodeURIComponent(exif.exposure_time) : '') + (exif.aperture_value ? '&exif[aperture_value]=' + encodeURIComponent(exif.aperture_value) : '') + (exif.focal_length ? '&exif[focal_length]=' + encodeURIComponent(exif.focal_length) : '') + (exif.iso_speed_ratings ? '&exif[iso_speed_ratings]=' + encodeURIComponent(exif.iso_speed_ratings) : '');\n return _this.fetchUrl(url, 'PUT');\n };\n\n this.likePhoto = function (id) {\n if (!id || id === undefined || id.length === 0) {\n throw new Error('Parameter : id is required!');\n }\n var url = _this.API_LOCATION + _url_config2.default.LIKE_A_PHOTO.replace(/:id/gi, id);\n return _this.fetchUrl(url, 'POST');\n };\n\n this.unlikePhoto = function (id) {\n if (!id || id === undefined || id.length === 0) {\n throw new Error('Parameter : id is required!');\n }\n var url = _this.API_LOCATION + _url_config2.default.UNLIKE_A_PHOTO.replace(/:id/gi, id);\n return _this.fetchUrl(url, 'DELETE');\n };\n\n this.search = function (query, page, per_page, collections, orientation) {\n if (!_this.availableOrientations.includes(orientation) && orientation !== undefined) {\n throw new Error('Parameter : orientation has an unsupported value!');\n }\n if (query === undefined) {\n throw new Error('Parameter : query is missing!');\n }\n var url = _this.API_LOCATION + _url_config2.default.SEARCH_PHOTOS + '?query=' + (query ? encodeURIComponent(query) : '') + '&page=' + (page && !isNaN(page) ? +page : 1) + '&per_page=' + (per_page && !isNaN(per_page) ? +per_page : 10) + '&collections=' + (collections && !isNaN(collections) ? +collections : '') + '&orientation=' + (orientation ? encodeURIComponent(orientation) : '');\n return _this.fetchUrl(url, 'GET');\n };\n\n this.searchCollections = function (query, page, per_page) {\n if (query === undefined) {\n throw new Error('Parameter : query is missing!');\n }\n var url = _this.API_LOCATION + _url_config2.default.SEARCH_COLLECTIONS + '?query=' + (query ? encodeURIComponent(query) : '') + '&page=' + (page && !isNaN(page) ? +page : 1) + '&per_page=' + (per_page && !isNaN(per_page) ? +per_page : 10);\n return _this.fetchUrl(url, 'GET');\n };\n\n this.searchUsers = function (query, page, per_page) {\n if (query === undefined) {\n throw new Error('Parameter : query is missing!');\n }\n var url = _this.API_LOCATION + _url_config2.default.SEARCH_USERS + '?query=' + (query ? encodeURIComponent(query) : '') + '&page=' + (page && !isNaN(page) ? +page : 1) + '&per_page=' + (per_page && !isNaN(per_page) ? +per_page : 10);\n return _this.fetchUrl(url, 'GET');\n };\n\n this.getStatsTotals = function () {\n var url = _this.API_LOCATION + _url_config2.default.STATS_TOTALS;\n return _this.fetchUrl(url, 'GET');\n };\n\n this.getStatsMonth = function () {\n var url = _this.API_LOCATION + _url_config2.default.STATS_MONTH;\n return _this.fetchUrl(url, 'GET');\n };\n\n this.listCollections = function (page, per_page) {\n var url = _this.API_LOCATION + _url_config2.default.LIST_COLLECTIONS + '?page=' + (page && !isNaN(page) ? +page : 1) + '&per_page=' + (per_page && !isNaN(per_page) ? +per_page : 10);\n return _this.fetchUrl(url, 'GET');\n };\n\n this.listFeaturedCollections = function (page, per_page) {\n var url = _this.API_LOCATION + _url_config2.default.LIST_FEATURED_COLLECTIONS + '?page=' + (page && !isNaN(page) ? +page : 1) + '&per_page=' + (per_page && !isNaN(per_page) ? +per_page : 10);\n return _this.fetchUrl(url, 'GET');\n };\n\n this.listCuratedCollections = function (page, per_page) {\n var url = _this.API_LOCATION + _url_config2.default.LIST_CURATED_COLLECTIONS + '?page=' + (page && !isNaN(page) ? +page : 1) + '&per_page=' + (per_page && !isNaN(per_page) ? +per_page : 10);\n return _this.fetchUrl(url, 'GET');\n };\n\n this.getCollection = function (id) {\n if (!id || id === undefined || id.length === 0) {\n throw new Error('Parameter : id is required!');\n }\n var url = _this.API_LOCATION + _url_config2.default.GET_COLLECTION.replace(/:id/gi, id);\n return _this.fetchUrl(url, 'GET');\n };\n\n this.getCuratedCollection = function (id) {\n if (!id || id === undefined || id.length === 0) {\n throw new Error('Parameter : id is required!');\n }\n var url = _this.API_LOCATION + _url_config2.default.GET_CURATED_COLLECTION.replace(/:id/gi, id);\n return _this.fetchUrl(url, 'GET');\n };\n\n this.getCollectionPhotos = function (id, page, per_page) {\n if (!id || id === undefined || id.length === 0) {\n throw new Error('Parameter : id is required!');\n }\n var url = _this.API_LOCATION + _url_config2.default.GET_COLLECTION_PHOTOS.replace(/:id/gi, id) + '?page=' + (page && !isNaN(page) ? +page : 1) + '&per_page=' + (per_page && !isNaN(per_page) ? +per_page : 10);\n return _this.fetchUrl(url, 'GET');\n };\n\n this.getCuratedCollectionPhotos = function (id, page, per_page) {\n if (!id || id === undefined || id.length === 0) {\n throw new Error('Parameter : id is required!');\n }\n var url = _this.API_LOCATION + _url_config2.default.GET_CURATED_COLLECTION_PHOTOS.replace(/:id/gi, id) + '?page=' + (page && !isNaN(page) ? +page : 1) + '&per_page=' + (per_page && !isNaN(per_page) ? +per_page : 10);\n return _this.fetchUrl(url, 'GET');\n };\n\n this.listRelatedCollections = function (id) {\n if (!id || id === undefined || id.length === 0) {\n throw new Error('Parameter : id is required!');\n }\n var url = _this.API_LOCATION + _url_config2.default.LIST_RELATED_COLLECTION.replace(/:id/gi, id);\n return _this.fetchUrl(url, 'GET');\n };\n\n this.createNewColection = function (title, description, private_collection) {\n if (!title || title === undefined || title.length === 0) {\n throw new Error('Parameter : title is required!');\n }\n private_collection = private_collection || false;\n var url = _this.API_LOCATION + _url_config2.default.CREATE_NEW_COLLECTION + '?title=' + encodeURIComponent(title) + (description ? '&description=' + encodeURIComponent(description) : '') + '&private=' + private_collection;\n return _this.fetchUrl(url, 'POST');\n };\n\n this.updateExistingCollection = function (id, title, description, private_collection) {\n if (!id || id === undefined || id.length === 0) {\n throw new Error('Parameter : id is required!');\n }\n if (!title || title === undefined || title.length === 0) {\n throw new Error('Parameter : title is required!');\n }\n private_collection = private_collection || false;\n var url = _this.API_LOCATION + _url_config2.default.UPDATE_EXISTING_COLLECTION.replace(/:id/gi, id) + '?title=' + encodeURIComponent(title) + (description ? '&description=' + encodeURIComponent(description) : '') + '&private=' + private_collection;\n return _this.fetchUrl(url, 'PUT');\n };\n\n this.deleteCollection = function (id) {\n if (!id || id === undefined || id.length === 0) {\n throw new Error('Parameter : id is required!');\n }\n var url = _this.API_LOCATION + _url_config2.default.DELETE_COLLECTION.replace(/:id/gi, id);\n return _this.fetchUrl(url, 'DELETE');\n };\n\n this.addPhotoToCollection = function (collection_id, photo_id) {\n if (!collection_id || collection_id === undefined || collection_id.length === 0) {\n throw new Error('Parameter : collection_id is required!');\n }\n if (!photo_id || photo_id === undefined || photo_id.length === 0) {\n throw new Error('Parameter : photo_id is required!');\n }\n var url = _this.API_LOCATION + _url_config2.default.ADD_PHOTO_TO_COLLECTION.replace(/:collection_id/gi, collection_id) + '?photo_id=' + photo_id;\n return _this.fetchUrl(url, 'POST');\n };\n\n this.removePhotoFromCollection = function (collection_id, photo_id) {\n if (!collection_id || collection_id === undefined || collection_id.length === 0) {\n throw new Error('Parameter : collection_id is required!');\n }\n if (!photo_id || photo_id === undefined || photo_id.length === 0) {\n throw new Error('Parameter : photo_id is required!');\n }\n var url = _this.API_LOCATION + _url_config2.default.REMOVE_PHOTO_FROM_COLLECTION.replace(/:collection_id/gi, collection_id) + '?photo_id=' + photo_id;\n return _this.fetchUrl(url, 'DELETE');\n };\n\n //The location of the Unsplash API\n this.API_LOCATION = _url_config2.default.API_LOCATION;\n //The API to generate Unsplash API Bearer Token.\n this.BEARER_TOKEN_URL = _url_config2.default.BEARER_TOKEN_URL;\n //Defaults\n this.options = {};\n this.access_key = '';\n this.secret_key = '';\n this.redirect_uri = '';\n this.code = '';\n this.grant_type = 'authorization_code';\n this.bearer_token = '';\n this.headers = {\n 'Content-type': 'application/json',\n 'X-Requested-With': 'WrapSplash'\n };\n //Set available order_by options\n this.availableOrders = ['latest', 'oldest', 'popular'];\n //Sset available orientation options\n this.availableOrientations = ['landscape', 'portrait', 'squarish'];\n}\n\n/**\r\n * @memberof WrapSplashApi\r\n * @function init\r\n * A helper function to initialize WrapSplashApi and validate the options\r\n * @param {Object} options - The options object\r\n * @returns {*} - The class initialized with the passed in parameters\r\n */\n\n\n/**\r\n * Heler function to fetch a given url\r\n * @function fetchUrl\r\n * @param {String} url - The url to be fetched (required).\r\n * @param {String} method - The HTTP method to be used (required).\r\n * @returns {Object} - The JSON data object.\r\n */\n\n\n/**\r\n * Promise factory to generate a Bearer Token for write_access to private data.\r\n * The Unsplash API uses OAuth2 to authenticate and authorize Unsplash users. \r\n * Unsplash’s OAuth2 paths live at https://unsplash.com/oauth/.\r\n * @function generateBearerToken\r\n * @memberof UnsplashApi\r\n * @returns {Object} - The user's Access Token JSON data object.\r\n */\n\n\n/**\r\n * Promise factory to get the current User's profile.\r\n * To access a user’s private data, the user is required to \r\n * authorize the read_user scope. Without it, this request \r\n * will return a 403 Forbidden response.\r\n * Without a Bearer token (i.e. using a Client-ID token) this request \r\n * will return a 401 Unauthorized response.\r\n * @function getCurrentUserProfile\r\n * @memberof UnsplashApi\r\n * @returns {Object} - The JSON data Object.\r\n */\n\n\n/**\r\n * Promise factory to update the current User's profile.\r\n * This action requires the write_user scope. Without it, it will return a 403 Forbidden response.\r\n * @function updateCurrentUserProfile\r\n * @memberof UnsplashApi\r\n * @param {String} username - The username of the current user (Optional).\r\n * @param {String} first_name - The first name of the current user (Optional).\r\n * @param {String} last_name - The last name of the current user (Optional).\r\n * @param {String} email - The email id of the current user (Optional).\r\n * @param {String} url - The Portfolio/personal URL of the current user (Optional).\r\n * @param {String} location - The location of the current user (Optional).\r\n * @param {String} bio - The About/bio of the current user (Optional).\r\n * @param {String} instagram_username - The Instagram username of the current user (Optional).\r\n * @returns {Object} - The JSON data Object.\r\n */\n\n\n/**\r\n * Promise factory to retrieve public details on a given user.\r\n * @function getPublicProfile\r\n * @memberof UnsplashApi\r\n * @param {*} username - The username of the particular user (required). \r\n * @param {Number} width - The width of the profile image to be fetched (Optional).\r\n * @param {Number} height - The height of the profile image to be fetched (Optional).\r\n * Will be included in the 'profile_image' object as 'custom'. \r\n * @returns {Object} - The JSON data object. \r\n */\n\n\n/**\r\n * Promise factory to retrieve a single user’s portfolio link.\r\n * @function getUserPortfolio\r\n * @memberof UnsplashApi\r\n * @param {*} username - The username of the user to fetch the portfolio (required).\r\n * @returns {Object} - The JSON data object. \r\n */\n\n\n/**\r\n * Promise factory to get a list of photos uploaded by a particular user.\r\n * @function getUserPhotos\r\n * @memberof UnsplashApi\r\n * @param {*} username - The username of the user to fetch the portfolio (required).\r\n * @param {Number} page - The page number of results to fetch (Optional, defaults to 1).\r\n * @param {Number} per_page - The number of items per page (Optional, defaults to 10).\r\n * @param {Booelan} stats - Show the stats for each user’s photo (Optional; default: false).\r\n * @param {String} resolution - The frequency of the stats (Optional; default: 'days').\r\n * @param {Number} quantity - The amount of for each stat (Optional; default: 30).\r\n * @param {String} order_by - The sort method for results (Optional, Valid values: latest, oldest, popular; defaults to: latest).\r\n * @returns {Object} - The JSON data object. \r\n */\n\n\n/**\r\n * Promise factory to get a list of photos liked by a user.\r\n * @function getUserLikedPhotos\r\n * @memberof UnsplashApi\r\n * @param {*} username - The username of the user to fetch the portfolio (required).\r\n * @param {Number} page - The page number of results to fetch (Optional, defaults to 1).\r\n * @param {Number} per_page - The number of items per page (Optional, defaults to 10).\r\n * @param {String} order_by - The sort method for results (Optional, Valid values: latest, oldest, popular; defaults to: latest).\r\n * @returns {Object} - The JSON data object. \r\n */\n\n\n/**\r\n * Promise factory to get a list of collections created by the user.\r\n * @function getUserCollections\r\n * @memberof UnsplashApi\r\n * @param {*} username - The username of the user to fetch the portfolio (required).\r\n * @param {Number} page - The page number of results to fetch (Optional, defaults to 1).\r\n * @param {Number} per_page - The number of items per page (Optional, defaults to 10).\r\n * @returns {Object} - The JSON data object. \r\n */\n\n\n/**\r\n * Pomise factory to retrieve the consolidated number of downloads, views and likes of all user’s photos, \r\n * as well as the historical breakdown and average of these stats in a specific timeframe.\r\n * @function getUserStatistics\r\n * @memberof UnsplashApi\r\n * @param {*} username - The username of the user to fetch the portfolio (required).\r\n * @param {String} resolution - The frequency of the stats (Optional; default: 'days').\r\n * @param {Number} quantity - The amount of for each stat (Optional; default: 30).\r\n * @returns {Object} - The JSON data object. \r\n */\n\n\n/**\r\n * Promise factory to access the list Photos endpoint of the Unsplash API.\r\n * @function listPhotos\r\n * @memberof UnsplashApi\r\n * @param {Number} page - The page number of results to fetch (Optional, defaults to 1).\r\n * @param {Number} per_page - The number of items per page (Optional, defaults to 10).\r\n * @param {String} order_by - The sort method for results (Optional, Valid values: latest, oldest, popular; defaults to: latest).\r\n * @returns {Object} - The JSON data object. \r\n */\n\n\n/**\r\n * Promise factory to get a single page from the list of the curated photos.\r\n * @function listCuratedPhotos\r\n * @memberof UnsplashApi\r\n * @param {Number} page - The page number of results to fetch (Optional, defaults to 1).\r\n * @param {Number} per_page - The number of items per page (Optional, defaults to 10).\r\n * @param {String} order_by - The sort method for results (Optional, Valid values: latest, oldest, popular; defaults to: latest).\r\n * @returns {Object} - The JSON data object. \r\n */\n\n\n/**\r\n * Promise factory to retrieve a single photo.\r\n * @function getAPhoto\r\n * @memberof UnsplashApi\r\n * @param {String} id - The photo’s ID (required).\r\n * @param {Number} width - Image width in pixels (optional).\r\n * @param {Number} height - Image height in pixels (optionl).\r\n * @param {String} rect - 4 comma-separated integers representing x, y, width, height of the cropped rectangle (optional).\r\n * @returns {Object} - The JSON data object. \r\n */\n\n\n/**\r\n * Promise factory to retrieve a single random photo, given optional filters.\r\n * All parameters are optional, and can be combined to narrow the pool of \r\n * photos from which a random one will be chosen.\r\n * You can’t use the collections and query parameters in the same request \r\n * When supplying a count parameter - and only then - the response will be an \r\n * array of photos, even if the value of count is 1.\r\n * @function getARandomPhoto\r\n * @memberof UnsplashApi\r\n * @param {String} collections - The public collection ID(‘s) to filter selection. If multiple, comma-separated\r\n * @param {Boolean} featured - Limit selection to featured photos.\r\n * @param {String} username - Limit selection to a single user.\r\n * @param {String} query - Limit selection to photos matching a search term.\r\n * @param {Number} width - The Image width in pixels.\r\n * @param {Number} height - The Image height in pixels.\r\n * @param {String} orientation - Filter search results by photo orientation. Valid values are landscape, portrait, and squarish.\r\n * @param {Number} count - The number of photos to return. (Default: 1; max: 30).\r\n * @returns {Object} - The JSON data object.\r\n */\n\n\n/**\r\n * Promise factory to retrieve total number of downloads, views and likes of a single photo, \r\n * as well as the historical breakdown of these stats in a specific timeframe (default is 30 days).\r\n * @function getPhotoStatistics\r\n * @memberof UnsplashApi\r\n * @param {String} id - The photo’s ID (required).\r\n * @param {String} resolution - The frequency of the stats (Optional; default: 'days').\r\n * @param {Number} quantity - The amount of for each stat (Optional; default: 30).\r\n * @returns {Object} - The JSON data object.\r\n */\n\n\n/**\r\n * Promise factory to retrieve a single photo’s download link. Preferably hit this endpoint \r\n * if a photo is downloaded in your application for use (example: to be displayed on a blog article, \r\n * to be shared on social media, to be remixed, etc).\r\n * This is different than the concept of a view, which is tracked automatically when you hotlinking an image.\r\n * @function getPhotoLink\r\n * @memberof UnsplashApi\r\n * @param {String} id - The photo’s ID (required).\r\n * @returns {Object} - The JSON data object.\r\n */\n\n\n/**\r\n * Promise factory to update a photo on behalf of the logged-in user. \r\n * This requires the write_photos scope.\r\n * @function updatePhoto\r\n * @memberof UnsplashApi\r\n * @param {String} id - The photo’s ID (required).\r\n * @param {Object} location - The location object holding location data (Optional).\r\n * @param {Object} exif - The exif object holding exif data (Optional).\r\n * @returns {Object} - The updated photo data object.\r\n */\n\n\n/**\r\n * Promise factory to like a photo on behalf of the logged-in user. \r\n * This requires the write_likes scope.\r\n * This action is idempotent; sending the POST request to a single photo \r\n * multiple times has no additional effect.\r\n * @function likePhoto\r\n * @memberof UnsplashApi\r\n * @param {String} id - The photo’s ID (required).\r\n * @returns {Object} - The updated photo data object.\r\n */\n\n\n/**\r\n * Promise factory to remove a user’s like of a photo.\r\n * This action is idempotent; sending the DELETE request \r\n * to a single photo multiple times has no additional effect.\r\n * @function unlikePhoto\r\n * @memberof UnsplashApi\r\n * @param {String} id - The photo’s ID (required).\r\n * @returns {Object} - The updated photo data object.\r\n */\n\n\n/**\r\n * Promise factory to access the Search Photos endpoint of the Unsplash API.\r\n * @function search\r\n * @memberof UnsplashApi\r\n * @param {String} query - The search query (required).\r\n * @param {Number} page - The page number of results to fetch (Optional, defaults to 1).\r\n * @param {Number} per_page - The number of items per page (Optional, defaults to 10).\r\n * @param {Number} collections - The collection ID(‘s) to narrow the search. If multiple, comma-separated (Optional).\r\n * @param {String} orientation - Filter search results by photo orientation (Optional, Valid values are landscape, portrait, and squarish, defaults to: landscape).\r\n * @returns {Object} - The JSON data object.\r\n */\n\n\n/**\r\n * Promise factory to get a single page of collection results for a query.\r\n * @function searchCollections\r\n * @memberof UnsplashApi\r\n * @param {String} query - The search query (required).\r\n * @param {Number} page - The page number of results to fetch (Optional, defaults to 1).\r\n * @param {Number} per_page - The number of items per page (Optional, defaults to 10).\r\n * @returns {Object} - The JSON data object.\r\n */\n\n\n/**\r\n * Promise factory to get a single page of user results for a query.\r\n * @function searchUsers\r\n * @memberof UnsplashApi\r\n * @param {String} query - The search query (required).\r\n * @param {Number} page - The page number of results to fetch (Optional, defaults to 1).\r\n * @param {Number} per_page - The number of items per page (Optional, defaults to 10).\r\n * @returns {Object} - The JSON data object.\r\n */\n\n\n/**\r\n * Promise factory to get a list of counts for all of Unsplash.\r\n * @function getStatsTotals\r\n * @memberof UnsplashApi\r\n * @returns {Object} - The JSON data object.\r\n */\n\n\n/**\r\n * Promise factory to get the overall Unsplash stats for the past 30 days.\r\n * @function getStatsMonth\r\n * @memberof UnsplashApi\r\n * @returns {Object} - The JSON data object.\r\n */\n\n\n/**\r\n * Promise factory to get a single page from the list of all collections.\r\n * @function listCollections\r\n * @memberof UnsplashApi\r\n * @param {Number} page - The page number of results to fetch (Optional, defaults to 1).\r\n * @param {Number} per_page - The number of items per page (Optional, defaults to 10).\r\n * @returns {Object} - The JSON data object.\r\n */\n\n\n/**\r\n * Promise factory to get a single page from the list of featured collections.\r\n * @function listFeaturedCollections\r\n * @memberof UnsplashApi\r\n * @param {Number} page - The page number of results to fetch (Optional, defaults to 1).\r\n * @param {Number} per_page - The number of items per page (Optional, defaults to 10).\r\n * @returns {Object} - The JSON data object.\r\n */\n\n\n/**\r\n * Promise factory to get a single page from the list of curated collections.\r\n * @function listCuratedCollections\r\n * @memberof UnsplashApi\r\n * @param {Number} page - The page number of results to fetch (Optional, defaults to 1).\r\n * @param {Number} per_page - The number of items per page (Optional, defaults to 10).\r\n * @returns {Object} - The JSON data object.\r\n */\n\n\n/**\r\n * Promise factory to retrieve a single collection. \r\n * To view a user’s private collections, the read_collections scope is required.\r\n * @function getCollection\r\n * @memberof UnsplashApi\r\n * @param {String} id - The Collection ID (required).\r\n * @returns {Object} - The updated photo data object.\r\n */\n\n\n/**\r\n * Promise factory to retrieve a single curated collection. \r\n * To view a user’s private collections, the read_collections scope is required.\r\n * @function getCuratedCollection\r\n * @memberof UnsplashApi\r\n * @param {String} id - The Collection ID (required).\r\n * @returns {Object} - The updated photo data object.\r\n */\n\n\n/**\r\n * Promise factory to retrieve a collection’s photos.\r\n * @function getCollectionPhotos\r\n * @memberof UnsplashApi\r\n * @param {String} id - The Collection ID (required).\r\n * @param {Number} page - The page number of results to fetch (Optional, defaults to 1). \r\n * @param {Number} per_page - The number of items per page (Optional, defaults to 10).\r\n * @returns {Object} - The updated photo data object.\r\n */\n\n\n/**\r\n * Promise factory to retrieve a curated collection’s photos.\r\n * @function getCuratedCollectionPhotos\r\n * @memberof UnsplashApi\r\n * @param {String} id - The Collection ID (required).\r\n * @param {Number} page - The page number of results to fetch (Optional, defaults to 1). \r\n * @param {Number} per_page - The number of items per page (Optional, defaults to 10).\r\n * @returns {Object} - The updated photo data object.\r\n */\n\n\n/**\r\n * Promise factory to retrieve a list of collections related to a particular one.\r\n * @function listRelatedCollections\r\n * @memberof UnsplashApi\r\n * @param {String} id - The Collection ID (required).\r\n * @returns {Object} - The updated photo data object.\r\n */\n\n\n/**\r\n * Promise factory to create a new collection. \r\n * This requires the write_collections scope.\r\n * @function createNewColection\r\n * @memberof UnsplashApi\r\n * @param {String} title - The title of the collection (Required).\r\n * @param {String} description - The collection’s description (Optional).\r\n * @param {Boolean} private - Whether to make this collection private (Optional; default false).\r\n * @returns {Object} - The updated photo data object.\r\n */\n\n\n/**\r\n * Promise factory to update an existing collection belonging to the logged-in user. \r\n * This requires the write_collections scope.\r\n * @function updateExistingCollection\r\n * @memberof UnsplashApi\r\n * @param {String} id - The Collection ID (Required).\r\n * @param {String} title - The title of the collection (Optional).\r\n * @param {String} description - The collection’s description (Optional).\r\n * @param {Boolean} private - Whether to make this collection private (Optional; default false).\r\n * @returns {Object} - The updated photo data object.\r\n */\n\n\n/**\r\n * Promise factory to delete a collection belonging to the logged-in user. \r\n * This requires the write_collections scope.\r\n * @function deleteCollection\r\n * @memberof UnsplashApi\r\n * @param {String} id - The Collection ID (Required).\r\n * @returns {Object} - The updated photo data object.\r\n */\n\n\n/**\r\n * Promise factory to add a photo to one of the logged-in user’s collections. \r\n * Requires the write_collections scope.\r\n * If the photo is already in the collection, this acion has no effect.\r\n * @function addPhotoToCollection\r\n * @memberof UnsplashApi\r\n * @param {String} collection_id - The collection’s ID (Required).\r\n * @param {String} photo_id - The photo’s ID (Required).\r\n * @returns {Object} - The updated photo data object.\r\n */\n\n\n/**\r\n * Promise factory to remove a photo from one of the logged-in user’s collections. \r\n * Requires the write_collections scope.\r\n * @function removePhotoFromCollection\r\n * @memberof UnsplashApi\r\n * @param {String} collection_id - The collection’s ID (Required).\r\n * @param {String} photo_id - The photo’s ID (Required).\r\n * @returns {Object} - The updated photo data object.\r\n */\n;\n\nmodule.exports = WrapSplashApi;"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACnEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;AC7JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACvGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AChGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A","sourceRoot":""}