!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;"undefined"!=typeof window?r=window:"undefined"!=typeof global?r=global:"undefined"!=typeof self&&(r=self),r.swaggerAngularClient=e()}}(function(){var e;return function r(e,t,n){function o(a,s){if(!t[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);throw new Error("Cannot find module '"+a+"'")}var p=t[a]={exports:{}};e[a][0].call(p.exports,function(r){var t=e[a][1][r];return o(t?t:r)},p,p.exports,r,e,t,n)}return t[a].exports}for(var i="function"==typeof require&&require,a=0;aparseInt(r.maximum,10)?new p.NumberTooLargeError(e,r.maximum):void 0}function i(e){return"boolean"==typeof e||e instanceof Boolean?void 0:new p.NotABooleanError(e,typeof e)}function a(e){return null!=e?new p.NotVoidError(e,typeof e):void 0}function s(){}function u(e,r){return"string"==typeof e||e instanceof String?"enum"in r&&-1===r.enum.indexOf(e)?new p.StringNotInEnumError(e,r.enum):void 0:new p.NotAStringError(e,typeof e)}var p=e("./errorTypes");t.validateInteger=n,t.validateNumber=o,t.validateBoolean=i,t.validateVoid=a,t.validateFile=s,t.validateString=u},{"./errorTypes":1}],8:[function(e,r){"use strict";function t(e,r,t,n){if(!t)throw new o(r,e);if("header"===e.passAs)n.headers[e.keyname]=t;else if("query"===e.passAs){var i=n.url,a=e.keyname+"="+encodeURIComponent(t);-1===i.indexOf("?")?i+="?"+a:i=i.replace("?","?"+a+"&"),n.url=i}}function n(e,r,t,n,i){if(!t||!n)throw new o(r,e);var a=i.url;-1===a.indexOf("@")&&(a=a.replace("://","://"+t+":"+n+"@")),i.url=a}var o=e("./errorTypes").MissingAuthorizationError;r.exports=function(e,r,i){var a=e.authorizations;if(a||(a=e.apiObject.apiDeclaration.authorizations),a){var s=Object.keys(a).filter(function(e){return"oauth2"!==a[e].type});if(0!==s.length)if(1===s.length){var u=s[0],p=a[u];if(!r)throw new o(u,p);r[u]&&(r=r[u]),"apiKey"===p.type?t(p,u,r,i):"basicAuth"===p.type&&n(p,u,r.username,r.password,i)}else{var c=s.some(function(e){var o=a[e],s=r[e];return s?("apiKey"===o.type?t(o,e,s,i):"basicAuth"===o.type&&n(o,e,s.username,s.password,i),!0):!1});if(!c)throw new o(s.join(", "),a)}}}},{"./errorTypes":11}],9:[function(e,r){"use strict";function t(e,r){var t,s={},u="auth";e=o(e);var p=e.apis.some(function(e){return e.apiDeclaration.apis.some(function(e){var r=i(e.apiDeclaration.resourcePath||e.path);return"auth"===r?!0:e.operations.some(function(e){return"auth"===e.nickname})})});return p&&(u="authorization"),s[u]=function(){return 0===arguments.length?t:(t=n(arguments),void 0)},e.apis.forEach(function(e){var o,p,c;e.apiDeclaration.resourcePath&&(o=i(e.apiDeclaration.resourcePath),p=s[o]={},p[u]=function(){return 0===arguments.length?c:(c=n(arguments),void 0)}),e.apiDeclaration.apis.forEach(function(e){var f,m=o,d=p;m||(m=i(e.path),d=s[m]={},d[u]=function(){return 0===arguments.length?f:(f=n(arguments),void 0)}),e.operations.forEach(function(e){function o(){return i||f||c||t}var i,s,p=e.nickname;s=a(e,o,r),s[u]=function(){return 0===arguments.length?i:(i=n(arguments),void 0)},d[p]=s})})}),s}function n(e){return"string"==typeof e[0]&&"string"==typeof e[1]?{username:e[0],password:e[1]}:e[0]}function o(e){return e.apis.forEach(function(r){r.resourceListing=e,r.apiDeclaration.apis.forEach(function(e){e.resourceObject=r,e.apiDeclaration=r.apiDeclaration,e.operations.forEach(function(r){r.apiObject=e,r.parameters.forEach(function(e){e.operation=r})})})}),e}function i(e){return e=e.replace(/\W/g,"/"),e=e.replace(/(\w)\/(\w)/g,function(e,r,t){return r+t.toUpperCase()}),e=e.replace(/\//g,"")}var a=e("./createOperationHandler");r.exports=t},{"./createOperationHandler":10}],10:[function(e,r){"use strict";function t(e,r,t){function n(r,t){this.method=e.method,this.operation=e,this.errorTypes=d,this.data=r,this.options=t}var f=function(f,d){var l,y;d=d||{},null==f&&(f={}),"function"==typeof d&&(d.callback=d);try{f=o(f),f=i(e,f),f=a(e,f),l=m.operation(f,e,e.apiObject.apiDeclaration.models),y=new n(f,d),l||(y.url=u(e,f),y.headers=s(e,f,d),y.body=p(e,f,y.headers),c(e,r(),y))}catch(h){l=h}return t(l,y)};return f.Request=n,f.errorTypes=d,f.operation=e,f.validate=function(r){return m.operation(r,e,e.apiObject.apiDeclaration.models)},f}function n(){}function o(e){return JSON.parse(JSON.stringify(e))}function i(e,r){var t=e.parameters.filter(function(e){return e.required});if(t.length>1)return r;if(1!==t.length&&1!==e.parameters.length)return r;var n=t[0]||e.parameters[0];if("object"==typeof r&&void 0!==r[n.name])return r;var o,i=e.apiObject.apiDeclaration.models;try{o=m.dataType(r,n,i)}catch(a){return r}if(o)return r;var s={};return s[n.name]=r,s}function a(e,r){if(!r||"object"!=typeof r)return r;var n={};e.parameters.forEach(function(e){n[e.name]=!0});var o=Object.keys(r).filter(function(e){return!(e in n)});return t.logger.warn("Unknown parameters removed from request:",o.join(", ")),o.forEach(function(e){delete r[e]}),r}var s=e("./getRequestHeaders"),u=e("./getRequestUrl"),p=e("./getRequestBody"),c=e("./applyAuthData"),f=e("./errorTypes"),m=e("swagger-validate"),d={};Object.keys(m.errors).forEach(function(e){d[e]=m.errors[e]}),Object.keys(f).forEach(function(e){d[e]=f[e]}),r.exports=t,t.logger={debug:n,info:n,warn:n,error:n}},{"./applyAuthData":8,"./errorTypes":11,"./getRequestBody":12,"./getRequestHeaders":13,"./getRequestUrl":14,"swagger-validate":2}],11:[function(e,r,t){"use strict";function n(e){this.name="InvalidRequestError",this.message=e||"Invalid request"}function o(e,r){this.name="MissingAuthorizationError",this.message="No data found for authorization: "+e,this.authorization=r}function i(e){this.name="MissingPathParamsError",this.message="Missing the following required path parameters: "+e.join("")}function a(e,r){var t=r.apiObject.apiDeclaration,n=r.consumes||t.consumes||[];this.name="ContentTypeNotSupportedError",this.message="Operation ["+r.nickname+"] does not accept "+e+". It supports: "+n.join(", ")}function s(e,r){var t=r.apiObject.apiDeclaration,n=r.produces||t.produces||[];this.name="AcceptsNotSupportedError",this.message="Operation ["+r.nickname+"] does not produce "+e+". It supports: "+n.join(", ")}function u(e,r){this.name="OperationValidationError",this.message=e.nickname+" failed validation: \n "+r.join("\n ")}function p(e,r){this.name="ParameterValidationError",this.message=e.name+" failed validation: \n "+r.join("\n ")}function c(e){this.name="DataTypeValidationError",this.message=e||"Invalid data type"}n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,t.InvalidRequestError=n,o.prototype=Object.create(n.prototype),o.prototype.constructor=o,t.MissingAuthorizationError=o,i.prototype=Object.create(n.prototype),i.prototype.constructor=i,t.MissingPathParamsError=i,a.prototype=Object.create(n.prototype),a.prototype.constructor=a,t.ContentTypeNotSupportedError=a,s.prototype=Object.create(n.prototype),s.prototype.constructor=s,t.AcceptsNotSupportedError=s,u.prototype=Object.create(n.prototype),u.prototype.constructor=u,t.OperationValidationError=u,p.prototype=Object.create(n.prototype),p.prototype.constructor=p,t.ParameterValidationError=p,c.prototype=Object.create(Error.prototype),c.prototype.constructor=c,t.DataTypeValidationError=c},{}],12:[function(e,r){"use strict";r.exports=function(e,r,t){var n=e.parameters.filter(function(e){return"body"===e.paramType&&null!=r[e.name]}).map(function(e){return r[e.name]})[0];if(!t||!t["Content-Type"])return n;var o=t["Content-Type"],i=e.parameters.filter(function(e){return"form"===e.paramType&&null!=r[e.name]});if(-1!==o.indexOf("application/x-www-form-urlencoded"))n=i.map(function(e){var t=e.name,n=r[t];return encodeURIComponent(t)+"="+encodeURIComponent(n)}).join("&");else if(-1!==o.indexOf("multipart/form-data")){var a=Math.random().toString(16).substr(2),s="SwaggerBoundary"+a;n=i.map(function(e){var t=e.name,n=r[t],o="--"+s;return o+='\nContent-Disposition: form-data; name="'+t+'"',n.contentType&&(n.name&&(o+='; filename="'+n.name+'"'),o+="\nContent-Type: "+n.contentType),n.contentTransferEncoding&&(o+="\nContent-Transfer-Encoding: "+n.contentTransferEncoding),o+=n.body?"\n\n"+n.body:"\n\n"+n}).join("\n"),n+="\n--"+s+"--\n",t["Content-Type"]=o.replace("multipart/form-data","multipart/form-data; boundary="+s)}else-1!==o.indexOf("application/json")&&"string"!=typeof n&&(n=JSON.stringify(n));return n}},{}],13:[function(e,r,t){"use strict";function n(e,r){var t=e.parameters.some(function(e){return"body"===e.paramType&&void 0!==r[e.name]});if(t)return"application/json";var n=e.parameters.some(function(e){return"form"===e.paramType&&void 0!==r[e.name]}),o=n&&e.parameters.some(function(e){return"File"===e.type&&void 0!==r[e.name]});return o?"multipart/form-data":n?"application/x-www-form-urlencoded":void 0}function o(e,r){var t=e.apiObject.apiDeclaration,n=e.consumes||t.consumes;return n&&n.length?-1!==n.indexOf(r):!0}function i(e,r){var t=e.apiObject.apiDeclaration,n=e.produces||t.produces;return n&&n.length?-1!==n.indexOf(r):!0}var a=e("./errorTypes"),s=a.ContentTypeNotSupportedError,u=a.AcceptsNotSupportedError,p="application/json";r.exports=function(e,r,t){r=r||{},t=t||{};var a={};e.parameters.forEach(function(e){"header"===e.paramType&&null!=r[e.name]&&(a[e.name]=r[e.name])}),t.headers&&Object.keys(t.headers).forEach(function(e){a[e]=t.headers[e]});var c=t.contentType||n(e,r,t);if(c){if(!o(e,c))throw new s(c,e);a["Content-Type"]=c}var f=t.accept||p;if(f){if(!i(e,f))throw new u(f,e);a.Accept=f}return a},t.hasAccept=o,t.hasContentType=i},{"./errorTypes":11}],14:[function(e,r){"use strict";function t(e,r,t){var n=r.parameters.filter(function(e){return"path"===e.paramType}),o=n.filter(function(e){return void 0===t[e.name]});if(o.length)throw new i(o.map(function(e){return e.name}));return n.forEach(function(r){var n=r.name,o=new RegExp("{"+n+"[^}]*}","gi"),i=t[n].toString();delete t[n],i=i.split("/").map(encodeURIComponent).join("/"),e=e.replace(o,i)}),e}function n(e){var r=e.apiObject,t=r.apiDeclaration.basePath,n=r.path.replace("{format}","json");return t+n}var o=e("./errorTypes"),i=o.MissingPathParamsError;r.exports=function(e,r){var o=n(e);if(o=t(o,e,r),!r)return o;var i=e.parameters.filter(function(e){return"query"===e.paramType&&void 0!==r[e.name]}).map(function(e){var t=e.name,n=encodeURIComponent(t),o=r[t];return"array"===e.type&&Array.isArray(o)?o.map(function(e){return n+"="+encodeURIComponent(e)}).join("&"):n+"="+encodeURIComponent(o)}).join("&");return i&&(o+="?"+i),o}},{"./errorTypes":11}]},{},[9])(9)})}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e){"use strict";var r=e("../bower_components/swagger-client-generator/dist/swagger-client-generator.js");angular.module("swagger-client",[]).factory("swaggerClient",["$log","$http","$q",function(e,t,n){function o(r,o){if(r)return e.error(r),n.reject(r);try{o.body=angular.toJson(JSON.parse(o.body))}catch(i){}return t({method:o.method,url:o.url,headers:o.headers,data:o.body}).then(function(e){return e.data})}return function(e){return r(e,o)}}])},{"../bower_components/swagger-client-generator/dist/swagger-client-generator.js":1}]},{},[2])(2)}); //# sourceMappingURL=swagger-angular-client.min.js.map