swagger-client
Advanced tools
Comparing version 2.1.8-M1 to 2.1.9-M1
@@ -1,2 +0,2 @@ | ||
!function(){var e=function(e){this.name="arrayModel",this.definition=e||{},this.properties=[];var t=(e["enum"]||[],e.items);return t&&(t.type?this.type=typeFromJsonSchema(t.type,t.format):this.ref=t.$ref),this};e.prototype.createJSONSample=function(e){var t;if(e=e||{},this.type)t=this.type;else if(this.ref){var s=simpleRef(this.ref);if("undefined"!=typeof e[s])return s;e[s]=this,t=g[s].createJSONSample(e)}return[t]},e.prototype.getSampleValue=function(e){var t;if(e=e||{},this.type)t=type;else if(this.ref){var s=simpleRef(this.ref);t=g[s].getSampleValue(e)}return[t]},e.prototype.getMockSignature=function(e){var t,s,r=[];for(t=0;t<this.properties.length;t++)s=this.properties[t],r.push(s.toString());var i='<span class="strong">',a="</span>",n=i+"array {"+a,o=i+"}"+a,p=n+"<div>"+r.join(",</div><div>")+"</div>"+o;for(e||(e={}),e[this.name]=this,t=0;t<this.properties.length;t++){s=this.properties[t];var u=s.$ref,h=g[u];h&&"undefined"==typeof e[u]&&(p+="<br>"+h.getMockSignature(e))}return p};var t=function(){this.authz={}};t.prototype.add=function(e,t){return this.authz[e]=t,t},t.prototype.remove=function(e){return delete this.authz[e]},t.prototype.apply=function(e,t){var s,r,i,a,n=null;if("undefined"==typeof t||0===Object.keys(t).length)for(s in this.authz)i=this.authz[s],a=i.apply(e,t),a===!0&&(n=!0);else if(Array.isArray(t))for(var o=0;o<t.length;o++){var p=t[o];for(r in p)for(s in this.authz)s==r&&(i=this.authz[s],a=i.apply(e,t),a===!0&&(n=!0))}else for(r in t)for(s in this.authz)s==r&&(i=this.authz[s],a=i.apply(e,t),a===!0&&(n=!0));return n};var s=function(e,t,s){this.name=e,this.value=t,this.type=s};s.prototype.apply=function(e){return"query"===this.type?(e.url=e.url.indexOf("?")>0?e.url+"&"+this.name+"="+this.value:e.url+"?"+this.name+"="+this.value,!0):"header"===this.type?(e.headers[this.name]=this.value,!0):void 0};var i=function(e){this.cookie=e};i.prototype.apply=function(e){return e.cookieJar=e.cookieJar||CookieJar(),e.cookieJar.setCookie(this.cookie),!0};var a=function(e,t,s){this.name=e,this.username=t,this.password=s,this._btoa=null,this._btoa="undefined"!=typeof window?btoa:require("btoa")};a.prototype.apply=function(e){var t=this._btoa;return e.headers.Authorization="Basic "+t(this.username+":"+this.password),!0};var n=function(e,t){return function(){return e.apply(t,arguments)}};fail=function(e){log(e)},log=function(){log.history=log.history||[],log.history.push(arguments),this.console&&console.log(Array.prototype.slice.call(arguments)[0])},Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){for(var s=t||0,r=this.length;r>s;s++)if(this[s]===e)return s;return-1});var o=function(e,t){var s="undefined"!=typeof window?window:exports;return s.parameterMacro?s.parameterMacro(e,t):t.defaultValue},p=function(e,t){var s="undefined"!=typeof window?window:exports;return s.modelPropertyMacro?s.modelPropertyMacro(e,t):t.defaultValue},u=function(e){this.name="name",this.definition=e||{},this.properties=[];e["enum"]||[];this.type=typeFromJsonSchema(e.type,e.format)};u.prototype.createJSONSample=function(){var e=this.type;return e},u.prototype.getSampleValue=function(){this.type;return null},u.prototype.getMockSignature=function(e){var t,s,r=[];for(t=0;t<this.properties.length;t++)s=this.properties[t],r.push(s.toString());var i='<span class="strong">',a="</span>",n=i+this.name+" {"+a,o=i+"}"+a,p=n+"<div>"+r.join(",</div><div>")+"</div>"+o;for(e||(e={}),e[this.name]=this,t=0;t<this.properties.length;t++){s=this.properties[t];var u=s.$ref,h=g[u];h&&"undefined"==typeof e[u]&&(p+="<br>"+h.getMockSignature(e))}return p};var h=function(e,t){g[e]=t},l=function(e,t){return this.isBuilt=!1,this.url=null,this.debug=!1,this.basePath=null,this.modelsArray=[],this.authorizations=null,this.authorizationScheme=null,this.isValid=!1,this.info=null,this.useJQuery=!1,this.resourceCount=0,"undefined"!=typeof e?this.initialize(e,t):void 0};l.prototype.initialize=function(e,t){this.models=g={},t=t||{},"string"==typeof e?this.url=e:"object"==typeof e&&(t=e,this.url=t.url),this.swaggerRequstHeaders=t.swaggerRequstHeaders||"application/json;charset=utf-8,*/*",this.defaultSuccessCallback=t.defaultSuccessCallback||null,this.defaultErrorCallback=t.defaultErrorCallback||null,"function"==typeof t.success&&(this.success=t.success),t.useJQuery&&(this.useJQuery=t.useJQuery),this.clientAuthorizations=t.authorizations?t.authorizations:authorizations,this.supportedSubmitMethods=t.supportedSubmitMethods||[],this.failure=t.failure||function(){},this.progress=t.progress||function(){},this.spec=t.spec,this.options=t,"function"==typeof t.success&&(this.ready=!0,this.build())},l.prototype.build=function(e){if(this.isBuilt)return this;var t=this;this.progress("fetching resource list: "+this.url);var s={useJQuery:this.useJQuery,url:this.url,method:"get",headers:{accept:this.swaggerRequstHeaders},on:{error:function(e){return t.fail("http"!==t.url.substring(0,4)?"Please specify the protocol for "+t.url:0===e.status?"Can't read from server. It may not have the appropriate access-control-origin settings.":404===e.status?"Can't read swagger JSON from "+t.url:e.status+" : "+e.statusText+" "+t.url)},response:function(e){var s=e.obj||JSON.parse(e.data);return t.swaggerVersion=s.swaggerVersion,s.swagger&&2===parseInt(s.swagger)?(t.swaggerVersion=s.swagger,t.buildFromSpec(s),t.isValid=!0,void 0):"1.2"===t.swaggerVersion?t.buildFrom1_2Spec(s):t.buildFrom1_1Spec(s)}}};if(this.spec)setTimeout(function(){t.buildFromSpec(t.spec)},10);else{if(authorizations.apply(s),e)return s;(new C).execute(s)}return this},l.prototype.buildFromSpec=function(e){if(this.isBuilt)return this;this.info=e.info||{},this.title=e.title||"",this.host=e.host||"",this.schemes=e.schemes||[],this.basePath=e.basePath||"",this.apis={},this.apisArray=[],this.consumes=e.consumes,this.produces=e.produces,this.securityDefinitions=e.securityDefinitions,this.authSchemes=e.securityDefinitions;var t={};if(Array.isArray(e.tags))for(t={},k=0;k<e.tags.length;k++){var s=e.tags[k];t[s.name]=s}var r;"string"==typeof this.url&&(r=this.parseUri(this.url)),this.scheme="undefined"==typeof this.schemes||0===this.schemes.length?r.scheme||"http":this.schemes[0],("undefined"==typeof this.host||""===this.host)&&(this.host=r.host,r.port&&(this.host=this.host+":"+r.port)),this.definitions=e.definitions;var i;for(i in this.definitions){var a=new c(i,this.definitions[i]);a&&(g[i]=a)}var n;for(n in e.paths)if("object"==typeof e.paths[n]){var o;for(o in e.paths[n])if(-1!==["delete","get","head","options","patch","post","put"].indexOf(o)){var p=e.paths[n][o],u=p.tags;"undefined"==typeof u&&(p.tags=["default"],u=p.tags);var h=this.idFromOp(n,o,p),l=new d(this,p.scheme,h,o,n,p,this.definitions);if(u.length>0){var m;for(m=0;m<u.length;m++){var y=this.tagFromLabel(u[m]),v=this[y];if("undefined"==typeof this.apis[y]&&(this.apis[y]={}),"undefined"==typeof v){this[y]=[],v=this[y],v.operations={},v.label=y,v.apis=[];var b=t[y];"object"==typeof b&&(v.description=b.description,v.externalDocs=b.externalDocs),this[y].help=this.help.bind(v),this.apisArray.push(new f(y,v.description,v.externalDocs,l))}"function"!=typeof this.apis[y].help&&(this.apis[y].help=this.help.bind(v)),this.apis[y][h]=l.execute.bind(l),this.apis[y][h].help=l.help.bind(l),this.apis[y][h].asCurl=l.asCurl.bind(l),v[h]=l.execute.bind(l),v[h].help=l.help.bind(l),v[h].asCurl=l.asCurl.bind(l),v.apis.push(l),v.operations[h]=l;var w,S;for(w=0;w<this.apisArray.length;w++)this.apisArray[w].tag===y&&(S=this.apisArray[w]);S&&S.operationsArray.push(l)}}else log("no group to bind to")}}return this.isBuilt=!0,this.success&&(this.isValid=!0,this.isBuilt=!0,this.success()),this},l.prototype.parseUri=function(e){var t=/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,s=t.exec(e);return{scheme:s[4].replace(":",""),host:s[11],port:s[12],path:s[15]}},l.prototype.help=function(e){var t,s='operations for the "'+this.label+'" tag';for(t=0;t<this.apis.length;t++){var r=this.apis[t];s+="\n * "+r.nickname+": "+r.operation.summary}return e?s:(log(s),s)},l.prototype.tagFromLabel=function(e){return e},l.prototype.idFromOp=function(e,t,s){var r=s.operationId||e.substring(1)+"_"+t;return r.replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()\+\s]/g,"_")},l.prototype.fail=function(e){throw this.failure(e),e};var f=function(e,t,s,r){this.tag=e,this.path=e,this.description=t,this.externalDocs=s,this.name=e,this.operation=r,this.operationsArray=[]},d=function(e,t,s,r,i,a,n){var o=[];if(e=e||{},a=a||{},this.operations={},this.operation=a,this.deprecated=a.deprecated,this.consumes=a.consumes,this.produces=a.produces,this.parent=e,this.host=e.host||"localhost",this.schemes=e.schemes,this.scheme=t||e.scheme||"http",this.basePath=e.basePath||"/",this.nickname=s||o.push("Operations must have a nickname."),this.method=r||o.push("Operation "+s+" is missing method."),this.path=i||o.push("Operation "+this.nickname+" is missing path."),this.parameters=null!==a?a.parameters||[]:{},this.summary=a.summary||"",this.responses=a.responses||{},this.type=null,this.security=a.security,this.authorizations=a.security,this.description=a.description,this.useJQuery=e.useJQuery,"string"==typeof this.deprecated)switch(this.deprecated.toLowerCase()){case"true":case"yes":case"1":this.deprecated=!0;break;case"false":case"no":case"0":case null:this.deprecated=!1;break;default:this.deprecated=Boolean(this.deprecated)}var p,u;if(n){var h;for(h in this.definitions)u=new c(h,n[h]),u&&(g[h]=u)}for(p=0;p<this.parameters.length;p++){var l=this.parameters[p];"array"===l.type&&(l.isList=!0,l.allowMultiple=!0);var f=this.getType(l);if(f&&"boolean"===f.toString().toLowerCase()&&(l.allowableValues={},l.isList=!0,l["enum"]=["true","false"]),"undefined"!=typeof l["enum"]){var d;for(l.allowableValues={},l.allowableValues.values=[],l.allowableValues.descriptiveValues=[],d=0;d<l["enum"].length;d++){var m=l["enum"][d],y=m===l["default"]?!0:!1;l.allowableValues.values.push(m),l.allowableValues.descriptiveValues.push({value:m,isDefault:y})}}"array"===l.type&&(f=[f],"undefined"==typeof l.allowableValues&&(delete l.isList,delete l.allowMultiple)),l.signature=this.getModelSignature(f,g).toString(),l.sampleJSON=this.getModelSampleJSON(f,g),l.responseClassSignature=l.signature}var v,b,w=this.responses;if(w[200]?(b=w[200],v="200"):w[201]?(b=w[201],v="201"):w[202]?(b=w[202],v="202"):w[203]?(b=w[203],v="203"):w[204]?(b=w[204],v="204"):w[205]?(b=w[205],v="205"):w[206]?(b=w[206],v="206"):w["default"]&&(b=w["default"],v="default"),b&&b.schema){var S=this.resolveModel(b.schema,n);delete w[v],S?(this.successResponse={},this.successResponse[v]=S):(this.successResponse={},this.successResponse[v]=b.schema.type),this.type=b}return o.length>0&&this.resource&&this.resource.api&&this.resource.api.fail&&this.resource.api.fail(o),this};f.prototype.sort=function(){},d.prototype.getType=function(e){var t,s=e.type,r=e.format,i=!1;"integer"===s&&"int32"===r?t="integer":"integer"===s&&"int64"===r?t="long":"integer"===s?t="integer":"string"===s?t="date-time"===r?"date-time":"date"===r?"date":"string":"number"===s&&"float"===r?t="float":"number"===s&&"double"===r?t="double":"number"===s?t="double":"boolean"===s?t="boolean":"array"===s&&(i=!0,e.items&&(t=this.getType(e.items))),e.$ref&&(t=e.$ref);var a=e.schema;if(a){var n=a.$ref;return n?(n=simpleRef(n),i?[n]:n):this.getType(a)}return i?[t]:t},d.prototype.resolveModel=function(t,s){if("undefined"!=typeof t.$ref){var r=t.$ref;if(0===r.indexOf("#/definitions/")&&(r=r.substring("#/definitions/".length)),s[r])return new c(r,s[r])}return"array"===t.type?new e(t):null},d.prototype.help=function(e){for(var t=this.nickname+": "+this.summary+"\n",s=0;s<this.parameters.length;s++){var r=this.parameters[s],i=r.signature;t+="\n * "+r.name+" ("+i+"): "+r.description}return"undefined"==typeof e&&log(t),t},d.prototype.getModelSignature=function(e,t){var s,r;return e instanceof Array?(r=!0,e=e[0]):"undefined"==typeof e&&(e="undefined"),s="string"===e?!0:r&&t[r]||t[e]?!1:!0,s?r?"Array["+e+"]":e.toString():r?"Array["+t[e].getMockSignature()+"]":t[e].getMockSignature()},d.prototype.supportHeaderParams=function(){return!0},d.prototype.supportedSubmitMethods=function(){return this.parent.supportedSubmitMethods},d.prototype.getHeaderParams=function(e){for(var t=this.setContentTypes(e,{}),s=0;s<this.parameters.length;s++){var r=this.parameters[s];if("undefined"!=typeof e[r.name]&&"header"===r["in"]){var i=e[r.name];Array.isArray(i)&&(i=i.toString()),t[r.name]=i}}return t},d.prototype.urlify=function(e){for(var t={},s=this.path,r="",i=0;i<this.parameters.length;i++){var a=this.parameters[i];if("undefined"!=typeof e[a.name])if("path"===a["in"]){var n=new RegExp("{"+a.name+"}","gi"),o=e[a.name];o=Array.isArray(o)?this.encodePathCollection(a.collectionFormat,a.name,o):this.encodePathParam(o),s=s.replace(n,o)}else if("query"===a["in"]&&"undefined"!=typeof e[a.name])if(r+=""===r?"?":"&","undefined"!=typeof a.collectionFormat){var p=e[a.name];r+=Array.isArray(p)?this.encodeQueryCollection(a.collectionFormat,a.name,p):this.encodeQueryParam(a.name)+"="+this.encodeQueryParam(e[a.name])}else r+=this.encodeQueryParam(a.name)+"="+this.encodeQueryParam(e[a.name]);else"formData"===a["in"]&&(t[a.name]=e[a.name])}var u=this.scheme+"://"+this.host;return"/"!==this.basePath&&(u+=this.basePath),u+s+r},d.prototype.getMissingParams=function(e){var t,s=[];for(t=0;t<this.parameters.length;t++){var r=this.parameters[t];r.required===!0&&"undefined"==typeof e[r.name]&&(s=r.name)}return s},d.prototype.getBody=function(e,t,s){for(var r,i,a={},n=0;n<this.parameters.length;n++){var o=this.parameters[n];"undefined"!=typeof t[o.name]&&("body"===o["in"]?r=t[o.name]:"formData"===o["in"]&&(a[o.name]=t[o.name]))}if("application/x-www-form-urlencoded"===e["Content-Type"]){var p="";for(i in a)value=a[i],"undefined"!=typeof value&&(""!==p&&(p+="&"),p+=encodeURIComponent(i)+"="+encodeURIComponent(value));r=p}else if(e["Content-Type"]&&e["Content-Type"].indexOf("multipart/form-data")>=0&&s.useJQuery){var u=new FormData;u.type="formData";for(i in a)value=t[i],"undefined"!=typeof value&&("file"===value.type&&value.value?(delete e["Content-Type"],u.append(i,value.value)):u.append(i,value));r=u}return r},d.prototype.getModelSampleJSON=function(e,t){var s,r,i;if(r=e instanceof Array,s=t[e]?!1:!0,i=s?void 0:t[e].createJSONSample()){if(i=r?[i]:i,"string"==typeof i)return i;if("object"==typeof i){var a=i;if(i instanceof Array&&i.length>0&&(a=i[0]),a.nodeName){var n=(new XMLSerializer).serializeToString(a);return this.formatXml(n)}return JSON.stringify(i,null,2)}return i}},d.prototype["do"]=function(e,t,s,r,i){return this.execute(e,t,s,r,i)},d.prototype.execute=function(e,t,s,r,i){var a,n,o=e||{},p={};"object"==typeof t&&(p=t,a=s,n=r),"function"==typeof t&&(a=t,n=s),a=a||log,n=n||log,p.useJQuery&&(this.useJQuery=p.useJQuery);var u=this.getMissingParams(o);if(u.length>0){var h="missing required params: "+u;return void fail(h)}var l,f=this.getHeaderParams(o),d=this.setContentTypes(o,p),c={};for(l in f)c[l]=f[l];for(l in d)c[l]=d[l];{var m=this.getBody(c,o,p),y=this.urlify(o),g={url:y,method:this.method.toUpperCase(),body:m,useJQuery:this.useJQuery,headers:c,on:{response:function(e){return a(e,i)},error:function(e){return n(e,i)}}};authorizations.apply(g,this.operation.security)}return p.mock===!0?g:void(new C).execute(g,p)},d.prototype.setContentTypes=function(e,t){var s,r,i="application/json",a=e.parameterContentType||"application/json",n=this.parameters,o=[],p=[],u={};for(r=0;r<n.length;r++){var h=n[r];if("formData"===h["in"])"file"===h.type?p.push(h):o.push(h);else if("header"===h["in"]&&t){var l=h.name,f=t[h.name];"undefined"!=typeof t[h.name]&&(u[l]=f)}else"body"===h["in"]&&"undefined"!=typeof e[h.name]&&(s=e[h.name])}return!s||"post"!==this.method&&"put"!==this.method&&"patch"!==this.method&&"delete"!==this.method?o.length>0?a=t.requestContentType?t.requestContentType:p.length>0?"multipart/form-data":"application/x-www-form-urlencoded":"DELETE"==this.type?s="{}":"DELETE"!=this.type&&(a=null):t.requestContentType&&(a=t.requestContentType),a&&this.consumes&&-1===this.consumes.indexOf(a)&&log("server doesn't consume "+a+", try "+JSON.stringify(this.consumes)),i=t.responseContentType?t.responseContentType:"application/json",i&&this.produces&&-1===this.produces.indexOf(i)&&log("server can't produce "+i),(a&&""!==s||"application/x-www-form-urlencoded"===a)&&(u["Content-Type"]=a),i&&(u.Accept=i),u},d.prototype.asCurl=function(e){var t=this.execute(e,{mock:!0});authorizations.apply(t);var s=[];if(s.push("-X "+this.method.toUpperCase()),t.headers){var r;for(r in t.headers)s.push('--header "'+r+": "+t.headers[r]+'"')}if(t.body){var i;i="object"==typeof t.body?JSON.stringify(t.body):t.body,s.push('-d "'+i.replace(/"/g,'\\"')+'"')}return"curl "+s.join(" ")+' "'+t.url+'"'},d.prototype.encodePathCollection=function(e,t,s){var r,i="",a="";for(a="ssv"===e?"%20":"tsv"===e?"\\t":"pipes"===e?"|":",",r=0;r<s.length;r++)0===r?i=this.encodeQueryParam(s[r]):i+=a+this.encodeQueryParam(s[r]);return i},d.prototype.encodeQueryCollection=function(e,t,s){var r,i="";if("default"===e||"multi"===e)for(r=0;r<s.length;r++)r>0&&(i+="&"),i+=this.encodeQueryParam(t)+"="+this.encodeQueryParam(s[r]);else{var a="";if("csv"===e)a=",";else if("ssv"===e)a="%20";else if("tsv"===e)a="\\t";else if("pipes"===e)a="|";else if("brackets"===e)for(r=0;r<s.length;r++)0!==r&&(i+="&"),i+=this.encodeQueryParam(t)+"[]="+this.encodeQueryParam(s[r]);if(""!==a)for(r=0;r<s.length;r++)0===r?i=this.encodeQueryParam(t)+"="+this.encodeQueryParam(s[r]):i+=a+this.encodeQueryParam(s[r])}return i},d.prototype.encodeQueryParam=function(e){return encodeURIComponent(e)},d.prototype.encodePathParam=function(e){var t,s,r,i;if(e=e.toString(),-1===e.indexOf("/"))return encodeURIComponent(e);for(s=e.split("/"),t=[],r=0,i=s.length;i>r;r++)t.push(encodeURIComponent(s[r]));return t.join("/")};var c=function(t,s){this.name=t,this.definition=s||{},this.properties=[];var r=s.required||[];if("array"===s.type){var i=new e(s);return i}var a,n=s.properties;if(n)for(a in n){var o=!1,p=n[a];r.indexOf(a)>=0&&(o=!0),this.properties.push(new m(a,p,o))}};c.prototype.createJSONSample=function(e){var t,s={},r={};for(e=e||{},e[this.name]=this,t=0;t<this.properties.length;t++){prop=this.properties[t];var i=prop.getSampleValue(e,r);s[prop.name]=i}return delete e[this.name],s},c.prototype.getSampleValue=function(e){var t,s={},r={};for(t=0;t<this.properties.length;t++){var i=this.properties[t];s[i.name]=i.sampleValue(!1,e,r)}return s},c.prototype.getMockSignature=function(e){var t,s,r=[];for(t=0;t<this.properties.length;t++)s=this.properties[t],r.push(s.toString());var i='<span class="strong">',a="</span>",n=i+this.name+" {"+a,o=i+"}"+a,p=n+"<div>"+r.join(",</div><div>")+"</div>"+o;for(e||(e={}),e[this.name]=this,t=0;t<this.properties.length;t++){s=this.properties[t];var u=s.$ref,h=g[u];h&&"undefined"==typeof e[h.name]&&(p+="<br>"+h.getMockSignature(e))}return p};var m=function(e,t,s){this.schema=t,this.required=s,t.$ref?this.$ref=simpleRef(t.$ref):"array"===t.type&&t.items&&(t.items.$ref?this.$ref=simpleRef(t.items.$ref):t=t.items),this.name=e,this.description=t.description,this.obj=t,this.optional=!0,this.optional=!s,this["default"]=t["default"]||null,this.example=void 0!==t.example?t.example:null,this.collectionFormat=t.collectionFormat||null,this.maximum=t.maximum||null,this.exclusiveMaximum=t.exclusiveMaximum||null,this.minimum=t.minimum||null,this.exclusiveMinimum=t.exclusiveMinimum||null,this.maxLength=t.maxLength||null,this.minLength=t.minLength||null,this.pattern=t.pattern||null,this.maxItems=t.maxItems||null,this.minItems=t.minItems||null,this.uniqueItems=t.uniqueItems||null,this["enum"]=t["enum"]||null,this.multipleOf=t.multipleOf||null};m.prototype.getSampleValue=function(e,t){return this.sampleValue(!1,e,t)},m.prototype.isArray=function(){var e=this.schema;return"array"===e.type?!0:!1},m.prototype.sampleValue=function(e,t,s){e=e||this.isArray(),t=t||{};var r,i=getStringSignature(this.obj,!0);if(this.$ref){var a=simpleRef(this.$ref),n=g[a];if("undefined"!=typeof s[i])return s[i];n&&"undefined"==typeof t[i]?(t[i]=this,r=n.getSampleValue(t,s),s[i]=r):r=s[i]||a}else r=this.example?this.example:this["default"]?this["default"]:"date-time"===i?(new Date).toISOString():"date"===i?(new Date).toISOString().split("T")[0]:"string"===i?"string":"integer"===i?0:"long"===i?0:"float"===i?0:"double"===i?0:"boolean"===i?!0:{};return t[i]=r,e?[r]:r},getStringSignature=function(e,t){var s="";return"undefined"!=typeof e.$ref?s+=simpleRef(e.$ref):"undefined"==typeof e.type?s+="object":"array"===e.type?t?s+=getStringSignature(e.items||e.$ref||{}):(s+="Array[",s+=getStringSignature(e.items||e.$ref||{}),s+="]"):s+="integer"===e.type&&"int32"===e.format?"integer":"integer"===e.type&&"int64"===e.format?"long":"integer"===e.type&&"undefined"==typeof e.format?"long":"string"===e.type&&"date-time"===e.format?"date-time":"string"===e.type&&"date"===e.format?"date":"string"===e.type&&"undefined"==typeof e.format?"string":"number"===e.type&&"float"===e.format?"float":"number"===e.type&&"double"===e.format?"double":"number"===e.type&&"undefined"==typeof e.format?"double":"boolean"===e.type?"boolean":e.$ref?simpleRef(e.$ref):e.type,s},simpleRef=function(e){return"undefined"==typeof e?null:0===e.indexOf("#/definitions/")?e.substring("#/definitions/".length):e},m.prototype.toString=function(){var e=getStringSignature(this.obj);""!==e?(e='<span class="propName '+this.required+'">'+this.name+'</span> (<span class="propType">'+e+"</span>",this.required||(e+=', <span class="propOptKey">optional</span>'),e+=")"):e=this.name+" ("+JSON.stringify(this.obj)+")","undefined"!=typeof this.description&&(e+=": "+this.description),this["enum"]&&(e+=' = <span class="propVals">[\''+this["enum"].join("' or '")+"']</span>"),this.descr&&(e+=': <span class="propDesc">'+this.descr+"</span>");var t,s="",r="array"===this.schema.type;switch(t=r?this.schema.items?this.schema.items.type:"":this.schema.type,this["default"]&&(s+=optionHtml("Default",this["default"])),t){case"string":this.minLength&&(s+=optionHtml("Min. Length",this.minLength)),this.maxLength&&(s+=optionHtml("Max. Length",this.maxLength)),this.pattern&&(s+=optionHtml("Reg. Exp.",this.pattern));break;case"integer":case"number":this.minimum&&(s+=optionHtml("Min. Value",this.minimum)),this.exclusiveMinimum&&(s+=optionHtml("Exclusive Min.","true")),this.maximum&&(s+=optionHtml("Max. Value",this.maximum)),this.exclusiveMaximum&&(s+=optionHtml("Exclusive Max.","true")),this.multipleOf&&(s+=optionHtml("Multiple Of",this.multipleOf))}if(r&&(this.minItems&&(s+=optionHtml("Min. Items",this.minItems)),this.maxItems&&(s+=optionHtml("Max. Items",this.maxItems)),this.uniqueItems&&(s+=optionHtml("Unique Items","true")),this.collectionFormat&&(s+=optionHtml("Coll. Format",this.collectionFormat))),this["enum"]){var i;i="number"===t||"integer"===t?this["enum"].join(", "):'"'+this["enum"].join('", "')+'"',s+=optionHtml("Enum",i)}return s.length>0&&(e='<span class="propWrap">'+e+'<table class="optionsWrapper"><tr><th colspan="2">'+this.name+"</th></tr>"+s+"</table></span>"),e},optionHtml=function(e,t){return'<tr><td class="optionName">'+e+":</td><td>"+t+"</td></tr>"},typeFromJsonSchema=function(e,t){var s;return"integer"===e&&"int32"===t?s="integer":"integer"===e&&"int64"===t?s="long":"integer"===e&&"undefined"==typeof t?s="long":"string"===e&&"date-time"===t?s="date-time":"string"===e&&"date"===t?s="date":"number"===e&&"float"===t?s="float":"number"===e&&"double"===t?s="double":"number"===e&&"undefined"==typeof t?s="double":"boolean"===e?s="boolean":"string"===e&&(s="string"),s};var y={},g={};l.prototype.buildFrom1_2Spec=function(e){null!==e.apiVersion&&(this.apiVersion=e.apiVersion),this.apis={},this.apisArray=[],this.consumes=e.consumes,this.produces=e.produces,this.authSchemes=e.authorizations,this.info=this.convertInfo(e.info);var t,s,r=!1;for(t=0;t<e.apis.length;t++){var i=e.apis[t];if(i.operations){var a;for(a=0;a<i.operations.length;a++)operation=i.operations[a],r=!0}}if(this.basePath=e.basePath?e.basePath:this.url.indexOf("?")>0?this.url.substring(0,this.url.lastIndexOf("?")):this.url,r){var n=e.resourcePath.replace(/\//g,"");this.resourcePath=e.resourcePath,s=new v(e,this),this.apis[n]=s,this.apisArray.push(s),this.finish()}else{var o;for(this.expectedResourceCount=e.apis.length,o=0;o<e.apis.length;o++){var p=e.apis[o];s=new v(p,this),this.apis[s.name]=s,this.apisArray.push(s)}}return this.isValid=!0,this},l.prototype.finish=function(){"function"==typeof this.success&&(this.isValid=!0,this.ready=!0,this.isBuilt=!0,this.selfReflect(),this.success())},l.prototype.buildFrom1_1Spec=function(e){log("This API is using a deprecated version of Swagger! Please see http://github.com/wordnik/swagger-core/wiki for more info"),null!==e.apiVersion&&(this.apiVersion=e.apiVersion),this.apis={},this.apisArray=[],this.produces=e.produces,this.info=this.convertInfo(e.info);for(var t,s=!1,r=0;r<e.apis.length;r++){var i=e.apis[r];if(i.operations)for(var a=0;a<i.operations.length;a++)operation=i.operations[a],s=!0}if(this.basePath=e.basePath?e.basePath:this.url.indexOf("?")>0?this.url.substring(0,this.url.lastIndexOf("?")):this.url,s){var n=e.resourcePath.replace(/\//g,"");this.resourcePath=e.resourcePath,t=new v(e,this),this.apis[n]=t,this.apisArray.push(t),this.finish()}else for(this.expectedResourceCount=e.apis.length,k=0;k<e.apis.length;k++)resource=e.apis[k],t=new v(resource,this),this.apis[t.name]=t,this.apisArray.push(t);return this.isValid=!0,this},l.prototype.convertInfo=function(e){if("object"==typeof e){var t={};return t.title=e.title,t.description=e.description,t.termsOfService=e.termsOfServiceUrl,t.contact={},t.contact.name=e.contact,t.license={},t.license.name=e.license,t.license.url=e.licenseUrl,t}},l.prototype.selfReflect=function(){var e,t;if(null===this.apis)return!1;t=this.apis;for(e in t){if(api=t[e],null===api.ready)return!1;this[e]=api,this[e].help=n(api.help,api)}this.setConsolidatedModels(),this.ready=!0},l.prototype.setConsolidatedModels=function(){var e,t,s,r,i,a,n,o;this.models={},a=this.apis;for(r in a){s=a[r];for(t in s.models)"undefined"==typeof this.models[t]&&(this.models[t]=s.models[t],this.modelsArray.push(s.models[t]))}for(n=this.modelsArray,o=[],i=0;i<n.length;i++)e=n[i],o.push(e.setReferencedModels(this.models));return o};var v=function(e,t){var s=this;this.api=t,this.swaggerRequstHeaders=t.swaggerRequstHeaders,this.path="string"==typeof this.api.resourcePath?this.api.resourcePath:e.path,this.description=e.description,this.authorizations=e.authorizations||{};var r=this.path.split("/");if(this.name=r[r.length-1].replace(".{format}",""),this.basePath=this.api.basePath,this.operations={},this.operationsArray=[],this.modelsArray=[],this.models=t.models||{},this.rawModels={},this.useJQuery="undefined"!=typeof t.useJQuery?t.useJQuery:null,e.apis&&this.api.resourcePath)this.addApiDeclaration(e);else{"undefined"==typeof this.path&&this.api.fail("SwaggerResources must have a path."),this.url="http"===this.path.substring(0,4)?this.path.replace("{format}","json"):this.api.basePath+this.path.replace("{format}","json"),this.api.progress("fetching resource "+this.name+": "+this.url);var i={url:this.url,method:"GET",useJQuery:this.useJQuery,headers:{accept:this.swaggerRequstHeaders},on:{response:function(e){var t=e.obj||JSON.parse(e.data);return s.api.resourceCount+=1,s.addApiDeclaration(t)},error:function(e){return s.api.resourceCount+=1,s.api.fail("Unable to read api '"+s.name+"' from path "+s.url+" (server returned "+e.statusText+")")}}},a="undefined"!=typeof window?window:exports;a.authorizations.apply(i),(new C).execute(i)}};v.prototype.help=function(e){var t,s='operations for the "'+this.name+'" tag';for(t=0;t<this.operationsArray.length;t++){var r=this.operationsArray[t];s+="\n * "+r.nickname+": "+r.description}return e?s:(log(s),s)},v.prototype.getAbsoluteBasePath=function(e){var t,s;s=this.api.basePath,t=s.lastIndexOf(e);var r=s.split("/"),i=r[0]+"//"+r[2];if(0===e.indexOf("http"))return e;if("/"===e)return i;if("/"==e.substring(0,1))return i+e;t=this.basePath.lastIndexOf("/");var a=this.basePath.substring(0,t);return"/"==a.substring(a.length-1)?a+e:a+"/"+e},v.prototype.addApiDeclaration=function(e){if("string"==typeof e.produces&&(this.produces=e.produces),"string"==typeof e.consumes&&(this.consumes=e.consumes),"string"==typeof e.basePath&&e.basePath.replace(/\s/g,"").length>0&&(this.basePath=-1===e.basePath.indexOf("http")?this.getAbsoluteBasePath(e.basePath):e.basePath),this.resourcePath=e.resourcePath,this.addModels(e.models),e.apis)for(var t=0;t<e.apis.length;t++){var s=e.apis[t];this.addOperations(s.path,s.operations,e.consumes,e.produces)}return this.api[this.name]=this,this.ready=!0,this.api.resourceCount===this.api.expectedResourceCount&&this.api.finish(),this},v.prototype.addModels=function(e){if("object"==typeof e){var t;for(t in e)if("undefined"==typeof this.models[t]){var s=new b(t,e[t]);this.modelsArray.push(s),this.models[t]=s,this.rawModels[t]=e[t]}for(var r=[],i=0;i<this.modelsArray.length;i++){var a=this.modelsArray[i];r.push(a.setReferencedModels(this.models))}return r}},v.prototype.addOperations=function(e,t,s,i){if(t){for(var a=[],n=0;n<t.length;n++){var o=t[n];s=this.consumes,i=this.produces,s="undefined"!=typeof o.consumes?o.consumes:this.consumes,i="undefined"!=typeof o.produces?o.produces:this.produces;var p=o.type||o.responseClass;"array"===p&&(ref=null,o.items&&(ref=o.items.type||o.items.$ref),p="array["+ref+"]");var u=o.responseMessages,h=o.method;if(o.httpMethod&&(h=o.httpMethod),o.supportedContentTypes&&(s=o.supportedContentTypes),o.errorResponses){u=o.errorResponses;for(var l=0;l<u.length;l++)r=u[l],r.message=r.reason,r.reason=null}o.nickname=this.sanitize(o.nickname);var f=new S(o.nickname,e,h,o.parameters,o.summary,o.notes,p,u,this,s,i,o.authorizations,o.deprecated);this.operations[f.nickname]=f,a.push(this.operationsArray.push(f))}return a}},v.prototype.sanitize=function(e){var t;return t=e.replace(/[\s!@#$%^&*()_+=\[{\]};:<>|.\/?,\\'""-]/g,"_"),t=t.replace(/((_){2,})/g,"_"),t=t.replace(/^(_)*/g,""),t=t.replace(/([_])*$/g,"")};var b=function(e,t){this.name="undefined"!=typeof t.id?t.id:e,this.properties=[];var s;for(s in t.properties){if(t.required){var r;for(r in t.required)s===t.required[r]&&(t.properties[s].required=!0)}var i=new w(s,t.properties[s],this);this.properties.push(i)}};b.prototype.setReferencedModels=function(e){for(var t=[],s=0;s<this.properties.length;s++){var r=this.properties[s],i=r.type||r.dataType;t.push(e[i]?r.refModel=e[i]:r.refDataType&&e[r.refDataType]?r.refModel=e[r.refDataType]:void 0)}return t},b.prototype.getMockSignature=function(e){var t,s,r=[];for(t=0;t<this.properties.length;t++)s=this.properties[t],r.push(s.toString());var i='<span class="strong">',a="</span>",n=i+this.name+" {"+a,o=i+"}"+a,p=n+"<div>"+r.join(",</div><div>")+"</div>"+o;for(e||(e=[]),e.push(this.name),t=0;t<this.properties.length;t++)s=this.properties[t],s.refModel&&-1===e.indexOf(s.refModel.name)&&(p+="<br>"+s.refModel.getMockSignature(e));return p},b.prototype.createJSONSample=function(e){if(y[this.name])return y[this.name];var t={};e=e||[],e.push(this.name);for(var s=0;s<this.properties.length;s++){var r=this.properties[s];t[r.name]=r.getSampleValue(e)}return e.pop(this.name),t};var w=function(e,t,s){this.name=e,this.dataType=t.type||t.dataType||t.$ref,this.isCollection=this.dataType&&("array"===this.dataType.toLowerCase()||"list"===this.dataType.toLowerCase()||"set"===this.dataType.toLowerCase()),this.descr=t.description,this.required=t.required,this.defaultValue=p(t,s),t.items&&(t.items.type&&(this.refDataType=t.items.type),t.items.$ref&&(this.refDataType=t.items.$ref)),this.dataTypeWithRef=this.refDataType?this.dataType+"["+this.refDataType+"]":this.dataType,t.allowableValues&&(this.valueType=t.allowableValues.valueType,this.values=t.allowableValues.values,this.values&&(this.valuesString="'"+this.values.join("' or '")+"'")),t["enum"]&&(this.valueType="string",this.values=t["enum"],this.values&&(this.valueString="'"+this.values.join("' or '")+"'")) | ||
};w.prototype.getSampleValue=function(e){var t;return t=this.refModel&&-1===e.indexOf(this.refModel.name)?this.refModel.createJSONSample(e):this.toSampleValue(this.isCollection?this.refDataType:this.dataType),this.isCollection?[t]:t},w.prototype.toSampleValue=function(e){var t;return t="undefined"!=typeof this.defaultValue&&this.defaultValue?this.defaultValue:"integer"===e?0:"boolean"===e?!1:"double"===e||"number"===e?0:"string"===e?"":e},w.prototype.toString=function(){var e=this.required?"propReq":"propOpt",t='<span class="propName '+e+'">'+this.name+'</span> (<span class="propType">'+this.dataTypeWithRef+"</span>";return this.required||(t+=', <span class="propOptKey">optional</span>'),t+=")",this.values&&(t+=' = <span class="propVals">[\''+this.values.join("' or '")+"']</span>"),this.descr&&(t+=': <span class="propDesc">'+this.descr+"</span>"),t};var S=function(e,t,s,r,i,a,p,u,h,l,f,d,c){var m=this,y=[];if(this.nickname=e||y.push("SwaggerOperations must have a nickname."),this.path=t||y.push("SwaggerOperation "+e+" is missing path."),this.method=s||y.push("SwaggerOperation "+e+" is missing method."),this.parameters=r?r:[],this.summary=i,this.notes=a,this.type=p,this.responseMessages=u||[],this.resource=h||y.push("Resource is required"),this.consumes=l,this.produces=f,this.authorizations="undefined"!=typeof d?d:h.authorizations,this.deprecated=c,this["do"]=n(this["do"],this),"string"==typeof this.deprecated)switch(this.deprecated.toLowerCase()){case"true":case"yes":case"1":this.deprecated=!0;break;case"false":case"no":case"0":case null:this.deprecated=!1;break;default:this.deprecated=Boolean(this.deprecated)}y.length>0&&(console.error("SwaggerOperation errors",y,arguments),this.resource.api.fail(y)),this.path=this.path.replace("{format}","json"),this.method=this.method.toLowerCase(),this.isGetMethod="get"===this.method;var g,v,b;for(this.resourceName=this.resource.name,"undefined"!=typeof this.type&&"void"===this.type?this.type=null:(this.responseClassSignature=this.getSignature(this.type,this.resource.models),this.responseSampleJSON=this.getSampleJSON(this.type,this.resource.models)),g=0;g<this.parameters.length;g++){var w=this.parameters[g];w.name=w.name||w.type||w.dataType,p=w.type||w.dataType,"array"===p&&(p="array["+(w.items.$ref?w.items.$ref:w.items.type)+"]"),w.type=p,p&&"boolean"===p.toLowerCase()&&(w.allowableValues={},w.allowableValues.values=["true","false"]),w.signature=this.getSignature(p,this.resource.models),w.sampleJSON=this.getSampleJSON(p,this.resource.models);var S=w["enum"];if("undefined"!=typeof S)for(w.isList=!0,w.allowableValues={},w.allowableValues.descriptiveValues=[],v=0;v<S.length;v++)b=S[v],w.allowableValues.descriptiveValues.push(w.defaultValue?{value:String(b),isDefault:b===w.defaultValue}:{value:String(b),isDefault:!1});else if(w.allowableValues&&("RANGE"===w.allowableValues.valueType?w.isRange=!0:w.isList=!0,w.allowableValues&&(w.allowableValues.descriptiveValues=[],w.allowableValues.values)))for(v=0;v<w.allowableValues.values.length;v++)b=w.allowableValues.values[v],w.allowableValues.descriptiveValues.push(null!==w.defaultValue?{value:String(b),isDefault:b===w.defaultValue}:{value:String(b),isDefault:!1});w.defaultValue=o(this,w)}var x=this.resource.api.defaultSuccessCallback||null,C=this.resource.api.defaultErrorCallback||null;this.resource[this.nickname]=function(e,t,s,r){var i,a,n,o;return"function"==typeof e?(i={},a={},n=e,o=t):"object"==typeof e&&"function"==typeof t?(i=e,a={},n=t,o=s):(i=e,a=t,n=s,o=r),m["do"](i||{},a||{},n||x,o||C)},this.resource[this.nickname].help=function(e){return m.help(e)},this.resource[this.nickname].asCurl=function(e){return m.asCurl(e)}};S.prototype.isListType=function(e){return e&&e.indexOf("[")>=0?e.substring(e.indexOf("[")+1,e.indexOf("]")):void 0},S.prototype.getSignature=function(e,t){var s,r;return r=this.isListType(e),s="undefined"!=typeof r&&t[r]||"undefined"!=typeof t[e]?!1:!0,s?e:"undefined"!=typeof r?t[r].getMockSignature():t[e].getMockSignature()},S.prototype.getSampleJSON=function(e,t){var s,r,i;if(r=this.isListType(e),s="undefined"!=typeof r&&t[r]||"undefined"!=typeof t[e]?!1:!0,i=s?void 0:r?t[r].createJSONSample():t[e].createJSONSample()){if(i=r?[i]:i,"string"==typeof i)return i;if("object"==typeof i){var a=i;if(i instanceof Array&&i.length>0&&(a=i[0]),a.nodeName){var n=(new XMLSerializer).serializeToString(a);return this.formatXml(n)}return JSON.stringify(i,null,2)}return i}},S.prototype["do"]=function(e,t,s,r){var i,a,n,o,p,u=[];"function"!=typeof r&&(r=function(e,t,s){return log(e,t,s)}),"function"!=typeof s&&(s=function(e){var t;return t=null,t=null!==e?e.data:"no data",log("default callback: "+t)}),n={},n.headers=[],e.headers&&(n.headers=e.headers,delete e.headers),t&&t.responseContentType&&(n.headers["Content-Type"]=t.responseContentType),t&&t.requestContentType&&(n.headers.Accept=t.requestContentType);for(var h=0;h<this.parameters.length;h++)if(a=this.parameters[h],"header"===a.paramType)"undefined"!=typeof e[a.name]&&(n.headers[a.name]=e[a.name]);else if("form"===a.paramType||"file"===a.paramType.toLowerCase())u.push(a);else if("body"===a.paramType&&"body"!==a.name&&"undefined"!=typeof e[a.name]){if(e.body)throw new Error("Saw two body params in an API listing; expecting a max of one.");e.body=e[a.name]}if("undefined"!=typeof e.body&&(n.body=e.body,delete e.body),u)for(i in u)p=u[i],e[p.name]&&(n[p.name]=e[p.name]);return o=new x(this.method,this.urlify(e),n,t,s,r,this),t.mock?o:!0},S.prototype.pathJson=function(){return this.path.replace("{format}","json")},S.prototype.pathXml=function(){return this.path.replace("{format}","xml")},S.prototype.encodePathParam=function(e){var t,s,r,i,a;if(e=e.toString(),-1===e.indexOf("/"))return encodeURIComponent(e);for(r=e.split("/"),t=[],i=0,a=r.length;a>i;i++)s=r[i],t.push(encodeURIComponent(s));return t.join("/")},S.prototype.urlify=function(e){var t,s,r,i;i=this.resource.basePath.length>1&&"/"===this.resource.basePath.slice(-1)&&"/"===this.pathJson().charAt(0)?this.resource.basePath+this.pathJson().substring(1):this.resource.basePath+this.pathJson();var a=this.parameters;for(t=0;t<a.length;t++)if(r=a[t],"path"===r.paramType){if("undefined"==typeof e[r.name])throw""+r.name+" is a required path param.";var n=new RegExp("\\{\\s*?"+r.name+"[^\\{\\}\\/]*(?:\\{.*?\\}[^\\{\\}\\/]*)*\\}(?=(\\/?|$))","gi");i=i.replace(n,this.encodePathParam(e[r.name])),delete e[r.name]}var o="";for(t=0;t<a.length;t++)if(r=a[t],"query"===r.paramType)if(""!==o&&(o+="&"),Array.isArray(r)){var p="";for(s=0;s<r.length;s++)s>0&&(p+=","),p+=encodeURIComponent(r[s]);o+=encodeURIComponent(r.name)+"="+p}else if("undefined"!=typeof e[r.name])o+=encodeURIComponent(r.name)+"="+encodeURIComponent(e[r.name]);else if(r.required)throw""+r.name+" is a required query param.";return o&&o.length>0&&(i+="?"+o),i},S.prototype.supportHeaderParams=function(){return this.resource.api.supportHeaderParams},S.prototype.supportedSubmitMethods=function(){return this.resource.api.supportedSubmitMethods},S.prototype.getQueryParams=function(e){return this.getMatchingParams(["query"],e)},S.prototype.getHeaderParams=function(e){return this.getMatchingParams(["header"],e)},S.prototype.getMatchingParams=function(e,t){for(var s={},r=this.parameters,i=0;i<r.length;i++)param=r[i],t&&t[param.name]&&(s[param.name]=t[param.name]);var a,n=this.resource.api.headers;for(a in n){var o=n[a];s[a]=o}return s},S.prototype.help=function(e){for(var t=this.nickname+": "+this.summary,s=this.parameters,r=0;r<s.length;r++){var i=s[r];t+="\n* "+i.name+(i.required?" (required)":"")+" - "+i.description}return e?t:(console.log(t),t)},S.prototype.asCurl=function(e){var t,s=[],r=x.prototype.setHeaders(e,{},this);for(t=0;t<this.parameters.length;t++){var i=this.parameters[t];i.paramType&&"header"===i.paramType&&e[i.name]&&(r[i.name]=e[i.name])}var a;for(a in r)s.push('--header "'+a+": "+r[a]+'"');return"curl "+s.join(" ")+" "+this.urlify(e)},S.prototype.formatXml=function(e){var t,s,r,i,a,n,o,p,u,h,l,f,d;for(p=/(>)(<)(\/*)/g,h=/[ ]*(.*)[ ]+\n/g,t=/(<.+>)(.+\n)/g,e=e.replace(p,"$1\n$2$3").replace(h,"$1\n").replace(t,"$1\n$2"),o=0,s="",a=e.split("\n"),r=0,i="other",u={"single->single":0,"single->closing":-1,"single->opening":0,"single->other":0,"closing->single":0,"closing->closing":-1,"closing->opening":0,"closing->other":0,"opening->single":1,"opening->closing":0,"opening->opening":1,"opening->other":1,"other->single":0,"other->closing":-1,"other->opening":0,"other->other":0},l=function(e){var t,a,n,o,p,h,l;h={single:Boolean(e.match(/<.+\/>/)),closing:Boolean(e.match(/<\/.+>/)),opening:Boolean(e.match(/<[^!?].*>/))},p=function(){var e;e=[];for(n in h)l=h[n],l&&e.push(n);return e}()[0],p=void 0===p?"other":p,t=i+"->"+p,i=p,o="",r+=u[t],o=function(){var e,t,s;for(s=[],a=e=0,t=r;t>=0?t>e:e>t;a=t>=0?++e:--e)s.push(" ");return s}().join(""),"opening->closing"===t?s=s.substr(0,s.length-1)+e+"\n":s+=o+e+"\n"},f=0,d=a.length;d>f;f++)n=a[f],l(n);return s};var x=function(e,t,s,r,i,a,n,o){var p=this,u=[];if(this.useJQuery="undefined"!=typeof n.resource.useJQuery?n.resource.useJQuery:null,this.type=e||u.push("SwaggerRequest type is required (get/post/put/delete/patch/options)."),this.url=t||u.push("SwaggerRequest url is required."),this.params=s,this.opts=r,this.successCallback=i||u.push("SwaggerRequest successCallback is required."),this.errorCallback=a||u.push("SwaggerRequest error callback is required."),this.operation=n||u.push("SwaggerRequest operation is required."),this.execution=o,this.headers=s.headers||{},u.length>0)throw u;this.type=this.type.toUpperCase();var h=this.setHeaders(s,r,this.operation),l=s.body;if(h["Content-Type"]){var f,d,c,m={},y=this.operation.parameters;for(c=0;c<y.length;c++){var g=y[c];"form"===g.paramType&&(m[g.name]=g)}if(0===h["Content-Type"].indexOf("application/x-www-form-urlencoded")){var v="";for(f in m)d=this.params[f],"undefined"!=typeof d&&(""!==v&&(v+="&"),v+=encodeURIComponent(f)+"="+encodeURIComponent(d));l=v}else if(0===h["Content-Type"].indexOf("multipart/form-data")){var b="",w="----SwaggerFormBoundary"+Date.now();for(f in m)d=this.params[f],"undefined"!=typeof d&&(b+="--"+w+"\n",b+='Content-Disposition: form-data; name="'+f+'"',b+="\n\n",b+=d+"\n");b+="--"+w+"--\n",h["Content-Type"]="multipart/form-data; boundary="+w,l=b}}var S;if(!this.headers||!this.headers.mock){S={url:this.url,method:this.type,headers:h,body:l,useJQuery:this.useJQuery,on:{error:function(e){return p.errorCallback(e,p.opts.parent)},redirect:function(e){return p.successCallback(e,p.opts.parent)},307:function(e){return p.successCallback(e,p.opts.parent)},response:function(e){return p.successCallback(e,p.opts.parent)}}};var x=!1;if(this.operation.resource&&this.operation.resource.api&&this.operation.resource.api.clientAuthorizations)x=this.operation.resource.api.clientAuthorizations.apply(S,this.operation.authorizations);else{var T;T="undefined"!=typeof window?window:exports,x=T.authorizations.apply(S,this.operation.authorizations)}if(r.mock)return S;x!==!1?(new C).execute(S):S.canceled=!0}return S};x.prototype.setHeaders=function(e,t,s){var r,i=t.responseContentType||"application/json",a=t.requestContentType||"application/json",n=s.parameters,o=[],p=[],u=e.body,h={};for(r=0;r<n.length;r++){var l=n[r];if("form"===l.paramType)o.push(l);else if("file"===l.paramType)p.push(l);else if("header"===l.paramType&&this.params.headers){var f=l.name,d=this.params.headers[l.name];"undefined"!=typeof this.params.headers[l.name]&&(h[f]=d)}}return!u||"POST"!==this.type&&"PUT"!==this.type&&"PATCH"!==this.type&&"DELETE"!==this.type?o.length>0?a=p.length>0?"multipart/form-data":"application/x-www-form-urlencoded":"DELETE"===this.type?u="{}":"DELETE"!=this.type&&(a=null):this.opts.requestContentType&&(a=this.opts.requestContentType),a&&this.operation.consumes&&-1===this.operation.consumes.indexOf(a)&&log("server doesn't consume "+a+", try "+JSON.stringify(this.operation.consumes)),i=this.opts&&this.opts.responseContentType?this.opts.responseContentType:"application/json",i&&s.produces&&-1===s.produces.indexOf(i)&&log("server can't produce "+i),(a&&""!==u||"application/x-www-form-urlencoded"===a)&&(h["Content-Type"]=a),i&&(h.Accept=i),h};var C=function(){};C.prototype.execute=function(e,t){return this.useJQuery=e&&"boolean"==typeof e.useJQuery?e.useJQuery:this.isIE8(),e&&"object"==typeof e.body&&(e.body.type&&"formData"!==e.body.type?e.body=JSON.stringify(e.body):(e.contentType=!1,e.processData=!1,delete e.headers["Content-Type"])),this.useJQuery?new T(t).execute(e):new O(t).execute(e)},C.prototype.isIE8=function(){var e=!1;if("undefined"!=typeof navigator&&navigator.userAgent&&(nav=navigator.userAgent.toLowerCase(),-1!==nav.indexOf("msie"))){var t=parseInt(nav.split("msie")[1]);8>=t&&(e=!0)}return e};var T=function(){"use strict";if(!e)var e=window.jQuery};T.prototype.execute=function(e){var t=e.on,s=e;return e.type=e.method,e.cache=!1,delete e.useJQuery,e.data=e.body,delete e.body,e.complete=function(e){for(var r={},i=e.getAllResponseHeaders().split("\n"),a=0;a<i.length;a++){var n=i[a].trim();if(0!==n.length){var o=n.indexOf(":");if(-1!==o){var p=n.substring(0,o).trim(),u=n.substring(o+1).trim();r[p]=u}else r[n]=null}}var h={url:s.url,method:s.method,status:e.status,statusText:e.statusText,data:e.responseText,headers:r},l=r["content-type"]||r["Content-Type"]||null;if(l&&(0===l.indexOf("application/json")||l.indexOf("+json")>0))try{h.obj=e.responseJSON||JSON.parse(h.data)||{}}catch(f){log("unable to parse JSON content")}if(e.status>=200&&e.status<300)t.response(h);else{if(!(0===e.status||e.status>=400&&e.status<599))return t.response(h);t.error(h)}},jQuery.support.cors=!0,jQuery.ajax(e)};var O=function(e){this.opts=e||{},this.isInitialized=!1;"undefined"!=typeof window?(this.Shred=require("./shred"),this.content=require("./shred/content")):this.Shred=require("shred"),this.shred=new this.Shred(e)};O.prototype.initShred=function(){this.isInitialized=!0,this.registerProcessors(this.shred)},O.prototype.registerProcessors=function(){var e=function(e){return e},t=function(e){return e.toString()};"undefined"!=typeof window?this.content.registerProcessor(["application/json; charset=utf-8","application/json","json"],{parser:e,stringify:t}):this.Shred.registerProcessor(["application/json; charset=utf-8","application/json","json"],{parser:e,stringify:t})},O.prototype.execute=function(e){this.isInitialized||this.initShred();var t,s=e.on,r=function(e){var t={headers:e._headers,url:e.request.url,method:e.request.method,status:e.status,data:e.content.data},s=e._headers.normalized||e._headers,r=s["content-type"]||s["Content-Type"]||null;if(r&&(0===r.indexOf("application/json")||r.indexOf("+json")>0))if(e.content.data&&""!==e.content.data)try{t.obj=JSON.parse(e.content.data)}catch(i){}else t.obj={};return t},i=function(e){var t={status:0,data:e.message||e};return e.code&&(t.obj=e,("ENOTFOUND"===e.code||"ECONNREFUSED"===e.code)&&(t.status=404)),t};return t={error:function(t){return e?s.error(r(t)):void 0},request_error:function(t){return e?s.error(i(t)):void 0},response:function(t){return e?s.response(r(t)):void 0}},e&&(e.on=t),this.shred.request(e)};var P="undefined"!=typeof window?window:exports;P.authorizations=authorizations=new t,P.ApiKeyAuthorization=s,P.PasswordAuthorization=a,P.CookieAuthorization=i,P.SwaggerClient=l,P.SwaggerApi=l,P.Operation=d,P.Model=c,P.addModel=h}(); | ||
!function(){var e=function(e){this.name="arrayModel",this.definition=e||{},this.properties=[];var t=(e["enum"]||[],e.items);return t&&(t.type?this.type=typeFromJsonSchema(t.type,t.format):this.ref=t.$ref),this};e.prototype.createJSONSample=function(e){var t;if(e=e||{},this.type)t=this.type;else if(this.ref){var r=simpleRef(this.ref);if("undefined"!=typeof e[r])return r;e[r]=this,t=v[r].createJSONSample(e)}return[t]},e.prototype.getSampleValue=function(e){var t;if(e=e||{},this.type)t=type;else if(this.ref){var r=simpleRef(this.ref);t=v[r].getSampleValue(e)}return[t]},e.prototype.getMockSignature=function(e){var t,r,s=[];for(t=0;t<this.properties.length;t++)r=this.properties[t],s.push(r.toString());var i='<span class="strong">',n="</span>",a=i+"array {"+n,o=i+"}"+n,p=a+"<div>"+s.join(",</div><div>")+"</div>"+o;for(e||(e={}),e[this.name]=this,t=0;t<this.properties.length;t++){r=this.properties[t];var u=r.$ref,h=v[u];h&&"undefined"==typeof e[u]&&(p+="<br>"+h.getMockSignature(e))}return p};var t=function(){this.authz={}};t.prototype.add=function(e,t){return this.authz[e]=t,t},t.prototype.remove=function(e){return delete this.authz[e]},t.prototype.apply=function(e,t){var r,s,i,n,a=null;if("undefined"==typeof t||0===Object.keys(t).length)for(r in this.authz)i=this.authz[r],n=i.apply(e,t),n===!0&&(a=!0);else if(Array.isArray(t))for(var o=0;o<t.length;o++){var p=t[o];for(s in p)for(r in this.authz)r==s&&(i=this.authz[r],n=i.apply(e,t),n===!0&&(a=!0))}else for(s in t)for(r in this.authz)r==s&&(i=this.authz[r],n=i.apply(e,t),n===!0&&(a=!0));return a};var s=function(e,t,r){this.name=e,this.value=t,this.type=r};s.prototype.apply=function(e){return"query"===this.type?(e.url=e.url.indexOf("?")>0?e.url+"&"+this.name+"="+this.value:e.url+"?"+this.name+"="+this.value,!0):"header"===this.type?(e.headers[this.name]=this.value,!0):void 0};var i=function(e){this.cookie=e};i.prototype.apply=function(e){return e.cookieJar=e.cookieJar||CookieJar(),e.cookieJar.setCookie(this.cookie),!0};var n=function(e,t,r){this.name=e,this.username=t,this.password=r,this._btoa=null,this._btoa="undefined"!=typeof window?btoa:require("btoa")};n.prototype.apply=function(e){var t=this._btoa;return e.headers.Authorization="Basic "+t(this.username+":"+this.password),!0};var a=function(e,t){return function(){return e.apply(t,arguments)}};fail=function(e){log(e)},log=function(){log.history=log.history||[],log.history.push(arguments),this.console&&console.log(Array.prototype.slice.call(arguments)[0])},Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){for(var r=t||0,s=this.length;s>r;r++)if(this[r]===e)return r;return-1});var o=function(e,t){var r="undefined"!=typeof window?window:exports;return r.parameterMacro?r.parameterMacro(e,t):t.defaultValue},p=function(e,t){var r="undefined"!=typeof window?window:exports;return r.modelPropertyMacro?r.modelPropertyMacro(e,t):t.defaultValue},u=function(e){this.name="name",this.definition=e||{},this.properties=[];e["enum"]||[];this.type=typeFromJsonSchema(e.type,e.format)};u.prototype.createJSONSample=function(){var e=this.type;return e},u.prototype.getSampleValue=function(){this.type;return null},u.prototype.getMockSignature=function(e){var t,r,s=[];for(t=0;t<this.properties.length;t++)r=this.properties[t],s.push(r.toString());var i='<span class="strong">',n="</span>",a=i+this.name+" {"+n,o=i+"}"+n,p=a+"<div>"+s.join(",</div><div>")+"</div>"+o;for(e||(e={}),e[this.name]=this,t=0;t<this.properties.length;t++){r=this.properties[t];var u=r.$ref,h=v[u];h&&"undefined"==typeof e[u]&&(p+="<br>"+h.getMockSignature(e))}return p};var h=function(){};h.prototype.resolve=function(e,t,r){this.scope=r||this;var s,i,n,a,o,p=0,u={},h={},l={};for(i in e.definitions){var f=e.definitions[i];for(o in f.properties)a=f.properties[o],this.resolveTo(a,l)}for(i in e.paths){var d,c,m;n=e.paths[i];for(d in n){c=n[d];var y,g=c.parameters;for(y in g){var v=g[y];"body"===v["in"]&&v.schema&&this.resolveTo(v.schema,l),v.$ref&&this.resolveInline(e,v,l,h)}for(m in c.responses){var b=c.responses[m];b.schema&&this.resolveTo(b.schema,l)}}}var w={},S=0;for(i in l){var x=i.split("#");2==x.length&&(s=x[0],n=x[1],Array.isArray(w[s])||(w[s]=[],S+=1),w[s].push(n))}for(i in w){var C=this,O=w[i];s=i;var P={useJQuery:!1,url:s,method:"get",headers:{accept:this.scope.swaggerRequestHeaders||"application/json"},on:{error:function(){p+=1;var r;for(r=0;r<O.length;r++){var i=s+"#"+O[r];h[i]=null}p===S&&C.finish(e,l,u,h,t)},response:function(r){var i,n,a=r.obj;for(p+=1,i=0;i<O.length;i++){var o=a,f=O[i],d=f.split("/");for(n=0;n<d.length;n++){var c=d[n];if("undefined"==typeof o)break;c.length>0&&(o=o[c])}var m=s+"#"+f,y=d[n-1];"undefined"!=typeof o?u[m]={name:y,obj:o}:h[m]=null}p===S&&C.finish(e,l,u,h,t)}}};authorizations.apply(P),(new T).execute(P)}0===Object.keys(w).length&&t.call(this.scope,e,h)},h.prototype.finish=function(e,t,r,s,i){var n;for(n in t){var a,o=t[n];for(a=0;a<o.length;a++){var p=r[o[a].obj.$ref];if(p)if(e.definitions||(e.definitions={}),"$ref"===o[a].resolveAs)e.definitions[p.name]=p.obj,o[a].obj.$ref="#/definitions/"+p.name;else if("inline"===o[a].resolveAs){var u,h=o[a].obj;delete h.$ref;for(u in p.obj)h[u]=p.obj[u]}}}i.call(this.scope,e,s)},h.prototype.resolveInline=function(e,t,r,s){var i=t.$ref;if(i){if(0===i.indexOf("http"))Array.isArray(r[i])?r[i].push({obj:t,resolveAs:"inline"}):r[i]=[{obj:t,resolveAs:"inline"}];else if(0===i.indexOf("#")){var n,a=i.substring(1),o=a.split("/"),p=e;for(n=0;n<o.length;n++){var u=o[n];u.length>0&&(p=p[u])}if(p){delete t.$ref;var h;for(h in p)t[h]=p[h]}else s[i]=null}}else"array"===t.type&&this.resolveTo(t.items,r)},h.prototype.resolveTo=function(e,t){var r=e.$ref;if(r)0===r.indexOf("http")&&(Array.isArray(t[r])?t[r].push({obj:e,resolveAs:"$ref"}):t[r]=[{obj:e,resolveAs:"$ref"}]);else if("array"===e.type){var s=e.items;this.resolveTo(s,t)}};var l=function(e,t){v[e]=t},f=function(e,t){return this.isBuilt=!1,this.url=null,this.debug=!1,this.basePath=null,this.modelsArray=[],this.authorizations=null,this.authorizationScheme=null,this.isValid=!1,this.info=null,this.useJQuery=!1,this.resourceCount=0,"undefined"!=typeof e?this.initialize(e,t):void 0};f.prototype.initialize=function(e,t){this.models=v={},t=t||{},"string"==typeof e?this.url=e:"object"==typeof e&&(t=e,this.url=t.url),this.swaggerRequstHeaders=t.swaggerRequstHeaders||"application/json;charset=utf-8,*/*",this.defaultSuccessCallback=t.defaultSuccessCallback||null,this.defaultErrorCallback=t.defaultErrorCallback||null,"function"==typeof t.success&&(this.success=t.success),t.useJQuery&&(this.useJQuery=t.useJQuery),this.clientAuthorizations=t.authorizations?t.authorizations:authorizations,this.supportedSubmitMethods=t.supportedSubmitMethods||[],this.failure=t.failure||function(){},this.progress=t.progress||function(){},this.spec=t.spec,this.options=t,"function"==typeof t.success&&(this.ready=!0,this.build())},f.prototype.build=function(e){if(this.isBuilt)return this;var t=this;this.progress("fetching resource list: "+this.url);var r={useJQuery:this.useJQuery,url:this.url,method:"get",headers:{accept:this.swaggerRequstHeaders},on:{error:function(e){return t.fail("http"!==t.url.substring(0,4)?"Please specify the protocol for "+t.url:0===e.status?"Can't read from server. It may not have the appropriate access-control-origin settings.":404===e.status?"Can't read swagger JSON from "+t.url:e.status+" : "+e.statusText+" "+t.url)},response:function(e){var r=e.obj||JSON.parse(e.data);return t.swaggerVersion=r.swaggerVersion,r.swagger&&2===parseInt(r.swagger)?(t.swaggerVersion=r.swagger,(new h).resolve(r,t.buildFromSpec,t),t.isValid=!0,void 0):"1.2"===t.swaggerVersion?t.buildFrom1_2Spec(r):t.buildFrom1_1Spec(r)}}};if(this.spec)setTimeout(function(){(new h).resolve(t.spec,t.buildFromSpec,t)},10);else{if(authorizations.apply(r),e)return r;(new T).execute(r)}return this},f.prototype.buildFromSpec=function(e){if(this.isBuilt)return this;this.info=e.info||{},this.title=e.title||"",this.host=e.host||"",this.schemes=e.schemes||[],this.basePath=e.basePath||"",this.apis={},this.apisArray=[],this.consumes=e.consumes,this.produces=e.produces,this.securityDefinitions=e.securityDefinitions,this.authSchemes=e.securityDefinitions;var t={};if(Array.isArray(e.tags))for(t={},k=0;k<e.tags.length;k++){var r=e.tags[k];t[r.name]=r}var s;"string"==typeof this.url&&(s=this.parseUri(this.url)),this.scheme="undefined"==typeof this.schemes||0===this.schemes.length?s.scheme||"http":this.schemes[0],("undefined"==typeof this.host||""===this.host)&&(this.host=s.host,s.port&&(this.host=this.host+":"+s.port)),this.definitions=e.definitions;var i;for(i in this.definitions){var n=new m(i,this.definitions[i]);n&&(v[i]=n)}var a;for(a in e.paths)if("object"==typeof e.paths[a]){var o;for(o in e.paths[a])if(-1!==["delete","get","head","options","patch","post","put"].indexOf(o)){var p=e.paths[a][o],u=p.tags;"undefined"==typeof u&&(p.tags=["default"],u=p.tags);var h=this.idFromOp(a,o,p),l=new c(this,p.scheme,h,o,a,p,this.definitions);if(u.length>0){var f;for(f=0;f<u.length;f++){var y=this.tagFromLabel(u[f]),g=this[y];if("undefined"==typeof this.apis[y]&&(this.apis[y]={}),"undefined"==typeof g){this[y]=[],g=this[y],g.operations={},g.label=y,g.apis=[];var b=t[y];"object"==typeof b&&(g.description=b.description,g.externalDocs=b.externalDocs),this[y].help=this.help.bind(g),this.apisArray.push(new d(y,g.description,g.externalDocs,l))}"function"!=typeof this.apis[y].help&&(this.apis[y].help=this.help.bind(g)),this.apis[y][h]=l.execute.bind(l),this.apis[y][h].help=l.help.bind(l),this.apis[y][h].asCurl=l.asCurl.bind(l),g[h]=l.execute.bind(l),g[h].help=l.help.bind(l),g[h].asCurl=l.asCurl.bind(l),g.apis.push(l),g.operations[h]=l;var w,S;for(w=0;w<this.apisArray.length;w++)this.apisArray[w].tag===y&&(S=this.apisArray[w]);S&&S.operationsArray.push(l)}}else log("no group to bind to")}}return this.isBuilt=!0,this.success&&(this.isValid=!0,this.isBuilt=!0,this.success()),this},f.prototype.parseUri=function(e){var t=/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,r=t.exec(e);return{scheme:r[4].replace(":",""),host:r[11],port:r[12],path:r[15]}},f.prototype.help=function(e){var t,r='operations for the "'+this.label+'" tag';for(t=0;t<this.apis.length;t++){var s=this.apis[t];r+="\n * "+s.nickname+": "+s.operation.summary}return e?r:(log(r),r)},f.prototype.tagFromLabel=function(e){return e},f.prototype.idFromOp=function(e,t,r){var s=r.operationId||e.substring(1)+"_"+t;return s.replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()\+\s]/g,"_")},f.prototype.fail=function(e){throw this.failure(e),e};var d=function(e,t,r,s){this.tag=e,this.path=e,this.description=t,this.externalDocs=r,this.name=e,this.operation=s,this.operationsArray=[]},c=function(e,t,r,s,i,n,a){var o=[];if(e=e||{},n=n||{},this.operations={},this.operation=n,this.deprecated=n.deprecated,this.consumes=n.consumes,this.produces=n.produces,this.parent=e,this.host=e.host||"localhost",this.schemes=e.schemes,this.scheme=t||e.scheme||"http",this.basePath=e.basePath||"/",this.nickname=r||o.push("Operations must have a nickname."),this.method=s||o.push("Operation "+r+" is missing method."),this.path=i||o.push("Operation "+this.nickname+" is missing path."),this.parameters=null!==n?n.parameters||[]:{},this.summary=n.summary||"",this.responses=n.responses||{},this.type=null,this.security=n.security,this.authorizations=n.security,this.description=n.description,this.useJQuery=e.useJQuery,"string"==typeof this.deprecated)switch(this.deprecated.toLowerCase()){case"true":case"yes":case"1":this.deprecated=!0;break;case"false":case"no":case"0":case null:this.deprecated=!1;break;default:this.deprecated=Boolean(this.deprecated)}var p,u;if(a){var h;for(h in this.definitions)u=new m(h,a[h]),u&&(v[h]=u)}for(p=0;p<this.parameters.length;p++){var l=this.parameters[p];"array"===l.type&&(l.isList=!0,l.allowMultiple=!0);var f=this.getType(l);if(f&&"boolean"===f.toString().toLowerCase()&&(l.allowableValues={},l.isList=!0,l["enum"]=["true","false"]),"undefined"!=typeof l["enum"]){var d;for(l.allowableValues={},l.allowableValues.values=[],l.allowableValues.descriptiveValues=[],d=0;d<l["enum"].length;d++){var c=l["enum"][d],y=c===l["default"]?!0:!1;l.allowableValues.values.push(c),l.allowableValues.descriptiveValues.push({value:c,isDefault:y})}}"array"===l.type&&(f=[f],"undefined"==typeof l.allowableValues&&(delete l.isList,delete l.allowMultiple)),l.signature=this.getModelSignature(f,v).toString(),l.sampleJSON=this.getModelSampleJSON(f,v),l.responseClassSignature=l.signature}var g,b,w=this.responses;if(w[200]?(b=w[200],g="200"):w[201]?(b=w[201],g="201"):w[202]?(b=w[202],g="202"):w[203]?(b=w[203],g="203"):w[204]?(b=w[204],g="204"):w[205]?(b=w[205],g="205"):w[206]?(b=w[206],g="206"):w["default"]&&(b=w["default"],g="default"),b&&b.schema){var S=this.resolveModel(b.schema,a);delete w[g],S?(this.successResponse={},this.successResponse[g]=S):(this.successResponse={},this.successResponse[g]=b.schema.type),this.type=b}return o.length>0&&this.resource&&this.resource.api&&this.resource.api.fail&&this.resource.api.fail(o),this};d.prototype.sort=function(){},c.prototype.getType=function(e){var t,r=e.type,s=e.format,i=!1;"integer"===r&&"int32"===s?t="integer":"integer"===r&&"int64"===s?t="long":"integer"===r?t="integer":"string"===r?t="date-time"===s?"date-time":"date"===s?"date":"string":"number"===r&&"float"===s?t="float":"number"===r&&"double"===s?t="double":"number"===r?t="double":"boolean"===r?t="boolean":"array"===r&&(i=!0,e.items&&(t=this.getType(e.items))),e.$ref&&(t=e.$ref);var n=e.schema;if(n){var a=n.$ref;return a?(a=simpleRef(a),i?[a]:a):this.getType(n)}return i?[t]:t},c.prototype.resolveModel=function(t,r){if("undefined"!=typeof t.$ref){var s=t.$ref;if(0===s.indexOf("#/definitions/")&&(s=s.substring("#/definitions/".length)),r[s])return new m(s,r[s])}return"array"===t.type?new e(t):null},c.prototype.help=function(e){for(var t=this.nickname+": "+this.summary+"\n",r=0;r<this.parameters.length;r++){var s=this.parameters[r],i=s.signature;t+="\n * "+s.name+" ("+i+"): "+s.description}return"undefined"==typeof e&&log(t),t},c.prototype.getModelSignature=function(e,t){var r,s;return e instanceof Array?(s=!0,e=e[0]):"undefined"==typeof e&&(e="undefined"),r="string"===e?!0:s&&t[s]||t[e]?!1:!0,r?s?"Array["+e+"]":e.toString():s?"Array["+t[e].getMockSignature()+"]":t[e].getMockSignature()},c.prototype.supportHeaderParams=function(){return!0},c.prototype.supportedSubmitMethods=function(){return this.parent.supportedSubmitMethods},c.prototype.getHeaderParams=function(e){for(var t=this.setContentTypes(e,{}),r=0;r<this.parameters.length;r++){var s=this.parameters[r];if("undefined"!=typeof e[s.name]&&"header"===s["in"]){var i=e[s.name];Array.isArray(i)&&(i=i.toString()),t[s.name]=i}}return t},c.prototype.urlify=function(e){for(var t={},r=this.path,s="",i=0;i<this.parameters.length;i++){var n=this.parameters[i];if("undefined"!=typeof e[n.name])if("path"===n["in"]){var a=new RegExp("{"+n.name+"}","gi"),o=e[n.name];o=Array.isArray(o)?this.encodePathCollection(n.collectionFormat,n.name,o):this.encodePathParam(o),r=r.replace(a,o)}else if("query"===n["in"]&&"undefined"!=typeof e[n.name])if(s+=""===s?"?":"&","undefined"!=typeof n.collectionFormat){var p=e[n.name];s+=Array.isArray(p)?this.encodeQueryCollection(n.collectionFormat,n.name,p):this.encodeQueryParam(n.name)+"="+this.encodeQueryParam(e[n.name])}else s+=this.encodeQueryParam(n.name)+"="+this.encodeQueryParam(e[n.name]);else"formData"===n["in"]&&(t[n.name]=e[n.name])}var u=this.scheme+"://"+this.host;return"/"!==this.basePath&&(u+=this.basePath),u+r+s},c.prototype.getMissingParams=function(e){var t,r=[];for(t=0;t<this.parameters.length;t++){var s=this.parameters[t];s.required===!0&&"undefined"==typeof e[s.name]&&(r=s.name)}return r},c.prototype.getBody=function(e,t,r){for(var s,i,n={},a=0;a<this.parameters.length;a++){var o=this.parameters[a];"undefined"!=typeof t[o.name]&&("body"===o["in"]?s=t[o.name]:"formData"===o["in"]&&(n[o.name]=t[o.name]))}if("application/x-www-form-urlencoded"===e["Content-Type"]){var p="";for(i in n)value=n[i],"undefined"!=typeof value&&(""!==p&&(p+="&"),p+=encodeURIComponent(i)+"="+encodeURIComponent(value));s=p}else if(e["Content-Type"]&&e["Content-Type"].indexOf("multipart/form-data")>=0&&r.useJQuery){var u=new FormData;u.type="formData";for(i in n)value=t[i],"undefined"!=typeof value&&("file"===value.type&&value.value?(delete e["Content-Type"],u.append(i,value.value)):u.append(i,value));s=u}return s},c.prototype.getModelSampleJSON=function(e,t){var r,s,i;if(s=e instanceof Array,r=t[e]?!1:!0,i=r?void 0:t[e].createJSONSample()){if(i=s?[i]:i,"string"==typeof i)return i;if("object"==typeof i){var n=i;if(i instanceof Array&&i.length>0&&(n=i[0]),n.nodeName){var a=(new XMLSerializer).serializeToString(n);return this.formatXml(a)}return JSON.stringify(i,null,2)}return i}},c.prototype["do"]=function(e,t,r,s,i){return this.execute(e,t,r,s,i)},c.prototype.execute=function(e,t,r,s,i){var n,a,o=e||{},p={};"object"==typeof t&&(p=t,n=r,a=s),"function"==typeof t&&(n=t,a=r),n=n||log,a=a||log,p.useJQuery&&(this.useJQuery=p.useJQuery);var u=this.getMissingParams(o);if(u.length>0){var h="missing required params: "+u;return void fail(h)}var l,f=this.getHeaderParams(o),d=this.setContentTypes(o,p),c={};for(l in f)c[l]=f[l];for(l in d)c[l]=d[l];{var m=this.getBody(c,o,p),y=this.urlify(o),g={url:y,method:this.method.toUpperCase(),body:m,useJQuery:this.useJQuery,headers:c,on:{response:function(e){return n(e,i)},error:function(e){return a(e,i)}}};authorizations.apply(g,this.operation.security)}return p.mock===!0?g:void(new T).execute(g,p)},c.prototype.setContentTypes=function(e,t){var r,s,i="application/json",n=e.parameterContentType||"application/json",a=this.parameters,o=[],p=[],u={};for(s=0;s<a.length;s++){var h=a[s];if("formData"===h["in"])"file"===h.type?p.push(h):o.push(h);else if("header"===h["in"]&&t){var l=h.name,f=t[h.name];"undefined"!=typeof t[h.name]&&(u[l]=f)}else"body"===h["in"]&&"undefined"!=typeof e[h.name]&&(r=e[h.name])}return!r||"post"!==this.method&&"put"!==this.method&&"patch"!==this.method&&"delete"!==this.method?o.length>0?n=t.requestContentType?t.requestContentType:p.length>0?"multipart/form-data":"application/x-www-form-urlencoded":"DELETE"==this.type?r="{}":"DELETE"!=this.type&&(n=null):t.requestContentType&&(n=t.requestContentType),n&&this.consumes&&-1===this.consumes.indexOf(n)&&log("server doesn't consume "+n+", try "+JSON.stringify(this.consumes)),i=t.responseContentType?t.responseContentType:"application/json",i&&this.produces&&-1===this.produces.indexOf(i)&&log("server can't produce "+i),(n&&""!==r||"application/x-www-form-urlencoded"===n)&&(u["Content-Type"]=n),i&&(u.Accept=i),u},c.prototype.asCurl=function(e){var t=this.execute(e,{mock:!0});authorizations.apply(t);var r=[];if(r.push("-X "+this.method.toUpperCase()),t.headers){var s;for(s in t.headers)r.push('--header "'+s+": "+t.headers[s]+'"')}if(t.body){var i;i="object"==typeof t.body?JSON.stringify(t.body):t.body,r.push('-d "'+i.replace(/"/g,'\\"')+'"')}return"curl "+r.join(" ")+' "'+t.url+'"'},c.prototype.encodePathCollection=function(e,t,r){var s,i="",n="";for(n="ssv"===e?"%20":"tsv"===e?"\\t":"pipes"===e?"|":",",s=0;s<r.length;s++)0===s?i=this.encodeQueryParam(r[s]):i+=n+this.encodeQueryParam(r[s]);return i},c.prototype.encodeQueryCollection=function(e,t,r){var s,i="";if("default"===e||"multi"===e)for(s=0;s<r.length;s++)s>0&&(i+="&"),i+=this.encodeQueryParam(t)+"="+this.encodeQueryParam(r[s]);else{var n="";if("csv"===e)n=",";else if("ssv"===e)n="%20";else if("tsv"===e)n="\\t";else if("pipes"===e)n="|";else if("brackets"===e)for(s=0;s<r.length;s++)0!==s&&(i+="&"),i+=this.encodeQueryParam(t)+"[]="+this.encodeQueryParam(r[s]);if(""!==n)for(s=0;s<r.length;s++)0===s?i=this.encodeQueryParam(t)+"="+this.encodeQueryParam(r[s]):i+=n+this.encodeQueryParam(r[s])}return i},c.prototype.encodeQueryParam=function(e){return encodeURIComponent(e)},c.prototype.encodePathParam=function(e){var t,r,s,i;if(e=e.toString(),-1===e.indexOf("/"))return encodeURIComponent(e);for(r=e.split("/"),t=[],s=0,i=r.length;i>s;s++)t.push(encodeURIComponent(r[s]));return t.join("/")};var m=function(t,r){this.name=t,this.definition=r||{},this.properties=[];var s=r.required||[];if("array"===r.type){var i=new e(r);return i}var n,a=r.properties;if(a)for(n in a){var o=!1,p=a[n];s.indexOf(n)>=0&&(o=!0),this.properties.push(new y(n,p,o))}};m.prototype.createJSONSample=function(e){var t,r={},s={};for(e=e||{},e[this.name]=this,t=0;t<this.properties.length;t++){prop=this.properties[t];var i=prop.getSampleValue(e,s);r[prop.name]=i}return delete e[this.name],r},m.prototype.getSampleValue=function(e){var t,r={},s={};for(t=0;t<this.properties.length;t++){var i=this.properties[t];r[i.name]=i.sampleValue(!1,e,s)}return r},m.prototype.getMockSignature=function(e){var t,r,s=[];for(t=0;t<this.properties.length;t++)r=this.properties[t],s.push(r.toString());var i='<span class="strong">',n="</span>",a=i+this.name+" {"+n,o=i+"}"+n,p=a+"<div>"+s.join(",</div><div>")+"</div>"+o;for(e||(e={}),e[this.name]=this,t=0;t<this.properties.length;t++){r=this.properties[t];var u=r.$ref,h=v[u];h&&"undefined"==typeof e[h.name]&&(p+="<br>"+h.getMockSignature(e))}return p};var y=function(e,t,r){this.schema=t,this.required=r,t.$ref?this.$ref=simpleRef(t.$ref):"array"===t.type&&t.items&&(t.items.$ref?this.$ref=simpleRef(t.items.$ref):t=t.items),this.name=e,this.description=t.description,this.obj=t,this.optional=!0,this.optional=!r,this["default"]=t["default"]||null,this.example=void 0!==t.example?t.example:null,this.collectionFormat=t.collectionFormat||null,this.maximum=t.maximum||null,this.exclusiveMaximum=t.exclusiveMaximum||null,this.minimum=t.minimum||null,this.exclusiveMinimum=t.exclusiveMinimum||null,this.maxLength=t.maxLength||null,this.minLength=t.minLength||null,this.pattern=t.pattern||null,this.maxItems=t.maxItems||null,this.minItems=t.minItems||null,this.uniqueItems=t.uniqueItems||null,this["enum"]=t["enum"]||null,this.multipleOf=t.multipleOf||null};y.prototype.getSampleValue=function(e,t){return this.sampleValue(!1,e,t)},y.prototype.isArray=function(){var e=this.schema;return"array"===e.type?!0:!1},y.prototype.sampleValue=function(e,t,r){e=e||this.isArray(),t=t||{};var s,i=getStringSignature(this.obj,!0);if(this.$ref){var n=simpleRef(this.$ref),a=v[n];if("undefined"!=typeof r[i])return r[i];a&&"undefined"==typeof t[i]?(t[i]=this,s=a.getSampleValue(t,r),r[i]=s):s=r[i]||n}else s=this.example?this.example:this["default"]?this["default"]:"date-time"===i?(new Date).toISOString():"date"===i?(new Date).toISOString().split("T")[0]:"string"===i?"string":"integer"===i?0:"long"===i?0:"float"===i?0:"double"===i?0:"boolean"===i?!0:{};return t[i]=s,e?[s]:s},getStringSignature=function(e,t){var r="";return"undefined"!=typeof e.$ref?r+=simpleRef(e.$ref):"undefined"==typeof e.type?r+="object":"array"===e.type?t?r+=getStringSignature(e.items||e.$ref||{}):(r+="Array[",r+=getStringSignature(e.items||e.$ref||{}),r+="]"):r+="integer"===e.type&&"int32"===e.format?"integer":"integer"===e.type&&"int64"===e.format?"long":"integer"===e.type&&"undefined"==typeof e.format?"long":"string"===e.type&&"date-time"===e.format?"date-time":"string"===e.type&&"date"===e.format?"date":"string"===e.type&&"undefined"==typeof e.format?"string":"number"===e.type&&"float"===e.format?"float":"number"===e.type&&"double"===e.format?"double":"number"===e.type&&"undefined"==typeof e.format?"double":"boolean"===e.type?"boolean":e.$ref?simpleRef(e.$ref):e.type,r},simpleRef=function(e){return"undefined"==typeof e?null:0===e.indexOf("#/definitions/")?e.substring("#/definitions/".length):e},y.prototype.toString=function(){var e=getStringSignature(this.obj);""!==e?(e='<span class="propName '+this.required+'">'+this.name+'</span> (<span class="propType">'+e+"</span>",this.required||(e+=', <span class="propOptKey">optional</span>'),e+=")"):e=this.name+" ("+JSON.stringify(this.obj)+")","undefined"!=typeof this.description&&(e+=": "+this.description),this["enum"]&&(e+=' = <span class="propVals">[\''+this["enum"].join("' or '")+"']</span>"),this.descr&&(e+=': <span class="propDesc">'+this.descr+"</span>");var t,r="",s="array"===this.schema.type;switch(t=s?this.schema.items?this.schema.items.type:"":this.schema.type,this["default"]&&(r+=optionHtml("Default",this["default"])),t){case"string":this.minLength&&(r+=optionHtml("Min. Length",this.minLength)),this.maxLength&&(r+=optionHtml("Max. Length",this.maxLength)),this.pattern&&(r+=optionHtml("Reg. Exp.",this.pattern));break;case"integer":case"number":this.minimum&&(r+=optionHtml("Min. Value",this.minimum)),this.exclusiveMinimum&&(r+=optionHtml("Exclusive Min.","true")),this.maximum&&(r+=optionHtml("Max. Value",this.maximum)),this.exclusiveMaximum&&(r+=optionHtml("Exclusive Max.","true")),this.multipleOf&&(r+=optionHtml("Multiple Of",this.multipleOf))}if(s&&(this.minItems&&(r+=optionHtml("Min. Items",this.minItems)),this.maxItems&&(r+=optionHtml("Max. Items",this.maxItems)),this.uniqueItems&&(r+=optionHtml("Unique Items","true")),this.collectionFormat&&(r+=optionHtml("Coll. Format",this.collectionFormat))),this["enum"]){var i;i="number"===t||"integer"===t?this["enum"].join(", "):'"'+this["enum"].join('", "')+'"',r+=optionHtml("Enum",i)}return r.length>0&&(e='<span class="propWrap">'+e+'<table class="optionsWrapper"><tr><th colspan="2">'+this.name+"</th></tr>"+r+"</table></span>"),e},optionHtml=function(e,t){return'<tr><td class="optionName">'+e+":</td><td>"+t+"</td></tr>"},typeFromJsonSchema=function(e,t){var r;return"integer"===e&&"int32"===t?r="integer":"integer"===e&&"int64"===t?r="long":"integer"===e&&"undefined"==typeof t?r="long":"string"===e&&"date-time"===t?r="date-time":"string"===e&&"date"===t?r="date":"number"===e&&"float"===t?r="float":"number"===e&&"double"===t?r="double":"number"===e&&"undefined"==typeof t?r="double":"boolean"===e?r="boolean":"string"===e&&(r="string"),r};var g={},v={};f.prototype.buildFrom1_2Spec=function(e){null!==e.apiVersion&&(this.apiVersion=e.apiVersion),this.apis={},this.apisArray=[],this.consumes=e.consumes,this.produces=e.produces,this.authSchemes=e.authorizations,this.info=this.convertInfo(e.info);var t,r,s=!1;for(t=0;t<e.apis.length;t++){var i=e.apis[t];if(i.operations){var n;for(n=0;n<i.operations.length;n++)operation=i.operations[n],s=!0}}if(this.basePath=e.basePath?e.basePath:this.url.indexOf("?")>0?this.url.substring(0,this.url.lastIndexOf("?")):this.url,s){var a=e.resourcePath.replace(/\//g,"");this.resourcePath=e.resourcePath,r=new b(e,this),this.apis[a]=r,this.apisArray.push(r),this.finish()}else{var o;for(this.expectedResourceCount=e.apis.length,o=0;o<e.apis.length;o++){var p=e.apis[o];r=new b(p,this),this.apis[r.name]=r,this.apisArray.push(r)}}return this.isValid=!0,this},f.prototype.finish=function(){"function"==typeof this.success&&(this.isValid=!0,this.ready=!0,this.isBuilt=!0,this.selfReflect(),this.success())},f.prototype.buildFrom1_1Spec=function(e){log("This API is using a deprecated version of Swagger! Please see http://github.com/wordnik/swagger-core/wiki for more info"),null!==e.apiVersion&&(this.apiVersion=e.apiVersion),this.apis={},this.apisArray=[],this.produces=e.produces,this.info=this.convertInfo(e.info);for(var t,r=!1,s=0;s<e.apis.length;s++){var i=e.apis[s];if(i.operations)for(var n=0;n<i.operations.length;n++)operation=i.operations[n],r=!0}if(this.basePath=e.basePath?e.basePath:this.url.indexOf("?")>0?this.url.substring(0,this.url.lastIndexOf("?")):this.url,r){var a=e.resourcePath.replace(/\//g,"");this.resourcePath=e.resourcePath,t=new b(e,this),this.apis[a]=t,this.apisArray.push(t),this.finish()}else for(this.expectedResourceCount=e.apis.length,k=0;k<e.apis.length;k++)resource=e.apis[k],t=new b(resource,this),this.apis[t.name]=t,this.apisArray.push(t);return this.isValid=!0,this},f.prototype.convertInfo=function(e){if("object"==typeof e){var t={};return t.title=e.title,t.description=e.description,t.termsOfService=e.termsOfServiceUrl,t.contact={},t.contact.name=e.contact,t.license={},t.license.name=e.license,t.license.url=e.licenseUrl,t}},f.prototype.selfReflect=function(){var e,t;if(null===this.apis)return!1;t=this.apis;for(e in t){if(api=t[e],null===api.ready)return!1;this[e]=api,this[e].help=a(api.help,api)}this.setConsolidatedModels(),this.ready=!0},f.prototype.setConsolidatedModels=function(){var e,t,r,s,i,n,a,o;this.models={},n=this.apis;for(s in n){r=n[s];for(t in r.models)"undefined"==typeof this.models[t]&&(this.models[t]=r.models[t],this.modelsArray.push(r.models[t]))}for(a=this.modelsArray,o=[],i=0;i<a.length;i++)e=a[i],o.push(e.setReferencedModels(this.models));return o};var b=function(e,t){var r=this;this.api=t,this.swaggerRequstHeaders=t.swaggerRequstHeaders,this.path="string"==typeof this.api.resourcePath?this.api.resourcePath:e.path,this.description=e.description,this.authorizations=e.authorizations||{};var s=this.path.split("/");if(this.name=s[s.length-1].replace(".{format}",""),this.basePath=this.api.basePath,this.operations={},this.operationsArray=[],this.modelsArray=[],this.models=t.models||{},this.rawModels={},this.useJQuery="undefined"!=typeof t.useJQuery?t.useJQuery:null,e.apis&&this.api.resourcePath)this.addApiDeclaration(e);else{"undefined"==typeof this.path&&this.api.fail("SwaggerResources must have a path."),this.url="http"===this.path.substring(0,4)?this.path.replace("{format}","json"):this.api.basePath+this.path.replace("{format}","json"),this.api.progress("fetching resource "+this.name+": "+this.url);var i={url:this.url,method:"GET",useJQuery:this.useJQuery,headers:{accept:this.swaggerRequstHeaders},on:{response:function(e){var t=e.obj||JSON.parse(e.data);return r.api.resourceCount+=1,r.addApiDeclaration(t)},error:function(e){return r.api.resourceCount+=1,r.api.fail("Unable to read api '"+r.name+"' from path "+r.url+" (server returned "+e.statusText+")")}}},n="undefined"!=typeof window?window:exports;n.authorizations.apply(i),(new T).execute(i)}};b.prototype.help=function(e){var t,r='operations for the "'+this.name+'" tag';for(t=0;t<this.operationsArray.length;t++){var s=this.operationsArray[t];r+="\n * "+s.nickname+": "+s.description}return e?r:(log(r),r)},b.prototype.getAbsoluteBasePath=function(e){var t,r;r=this.api.basePath,t=r.lastIndexOf(e);var s=r.split("/"),i=s[0]+"//"+s[2];if(0===e.indexOf("http"))return e;if("/"===e)return i;if("/"==e.substring(0,1))return i+e;t=this.basePath.lastIndexOf("/");var n=this.basePath.substring(0,t);return"/"==n.substring(n.length-1)?n+e:n+"/"+e},b.prototype.addApiDeclaration=function(e){if("string"==typeof e.produces&&(this.produces=e.produces),"string"==typeof e.consumes&&(this.consumes=e.consumes),"string"==typeof e.basePath&&e.basePath.replace(/\s/g,"").length>0&&(this.basePath=-1===e.basePath.indexOf("http")?this.getAbsoluteBasePath(e.basePath):e.basePath),this.resourcePath=e.resourcePath,this.addModels(e.models),e.apis)for(var t=0;t<e.apis.length;t++){var r=e.apis[t];this.addOperations(r.path,r.operations,e.consumes,e.produces)}return this.api[this.name]=this,this.ready=!0,this.api.resourceCount===this.api.expectedResourceCount&&this.api.finish(),this},b.prototype.addModels=function(e){if("object"==typeof e){var t;for(t in e)if("undefined"==typeof this.models[t]){var r=new w(t,e[t]);this.modelsArray.push(r),this.models[t]=r,this.rawModels[t]=e[t]}for(var s=[],i=0;i<this.modelsArray.length;i++){var n=this.modelsArray[i];s.push(n.setReferencedModels(this.models))}return s}},b.prototype.addOperations=function(e,t,s,i){if(t){for(var n=[],a=0;a<t.length;a++){var o=t[a];s=this.consumes,i=this.produces,s="undefined"!=typeof o.consumes?o.consumes:this.consumes,i="undefined"!=typeof o.produces?o.produces:this.produces;var p=o.type||o.responseClass;"array"===p&&(ref=null,o.items&&(ref=o.items.type||o.items.$ref),p="array["+ref+"]");var u=o.responseMessages,h=o.method; | ||
if(o.httpMethod&&(h=o.httpMethod),o.supportedContentTypes&&(s=o.supportedContentTypes),o.errorResponses){u=o.errorResponses;for(var l=0;l<u.length;l++)r=u[l],r.message=r.reason,r.reason=null}o.nickname=this.sanitize(o.nickname);var f=new x(o.nickname,e,h,o.parameters,o.summary,o.notes,p,u,this,s,i,o.authorizations,o.deprecated);this.operations[f.nickname]=f,n.push(this.operationsArray.push(f))}return n}},b.prototype.sanitize=function(e){var t;return t=e.replace(/[\s!@#$%^&*()_+=\[{\]};:<>|.\/?,\\'""-]/g,"_"),t=t.replace(/((_){2,})/g,"_"),t=t.replace(/^(_)*/g,""),t=t.replace(/([_])*$/g,"")};var w=function(e,t){this.name="undefined"!=typeof t.id?t.id:e,this.properties=[];var r;for(r in t.properties){if(t.required){var s;for(s in t.required)r===t.required[s]&&(t.properties[r].required=!0)}var i=new S(r,t.properties[r],this);this.properties.push(i)}};w.prototype.setReferencedModels=function(e){for(var t=[],r=0;r<this.properties.length;r++){var s=this.properties[r],i=s.type||s.dataType;t.push(e[i]?s.refModel=e[i]:s.refDataType&&e[s.refDataType]?s.refModel=e[s.refDataType]:void 0)}return t},w.prototype.getMockSignature=function(e){var t,r,s=[];for(t=0;t<this.properties.length;t++)r=this.properties[t],s.push(r.toString());var i='<span class="strong">',n="</span>",a=i+this.name+" {"+n,o=i+"}"+n,p=a+"<div>"+s.join(",</div><div>")+"</div>"+o;for(e||(e=[]),e.push(this.name),t=0;t<this.properties.length;t++)r=this.properties[t],r.refModel&&-1===e.indexOf(r.refModel.name)&&(p+="<br>"+r.refModel.getMockSignature(e));return p},w.prototype.createJSONSample=function(e){if(g[this.name])return g[this.name];var t={};e=e||[],e.push(this.name);for(var r=0;r<this.properties.length;r++){var s=this.properties[r];t[s.name]=s.getSampleValue(e)}return e.pop(this.name),t};var S=function(e,t,r){this.name=e,this.dataType=t.type||t.dataType||t.$ref,this.isCollection=this.dataType&&("array"===this.dataType.toLowerCase()||"list"===this.dataType.toLowerCase()||"set"===this.dataType.toLowerCase()),this.descr=t.description,this.required=t.required,this.defaultValue=p(t,r),t.items&&(t.items.type&&(this.refDataType=t.items.type),t.items.$ref&&(this.refDataType=t.items.$ref)),this.dataTypeWithRef=this.refDataType?this.dataType+"["+this.refDataType+"]":this.dataType,t.allowableValues&&(this.valueType=t.allowableValues.valueType,this.values=t.allowableValues.values,this.values&&(this.valuesString="'"+this.values.join("' or '")+"'")),t["enum"]&&(this.valueType="string",this.values=t["enum"],this.values&&(this.valueString="'"+this.values.join("' or '")+"'"))};S.prototype.getSampleValue=function(e){var t;return t=this.refModel&&-1===e.indexOf(this.refModel.name)?this.refModel.createJSONSample(e):this.toSampleValue(this.isCollection?this.refDataType:this.dataType),this.isCollection?[t]:t},S.prototype.toSampleValue=function(e){var t;return t="undefined"!=typeof this.defaultValue&&this.defaultValue?this.defaultValue:"integer"===e?0:"boolean"===e?!1:"double"===e||"number"===e?0:"string"===e?"":e},S.prototype.toString=function(){var e=this.required?"propReq":"propOpt",t='<span class="propName '+e+'">'+this.name+'</span> (<span class="propType">'+this.dataTypeWithRef+"</span>";return this.required||(t+=', <span class="propOptKey">optional</span>'),t+=")",this.values&&(t+=' = <span class="propVals">[\''+this.values.join("' or '")+"']</span>"),this.descr&&(t+=': <span class="propDesc">'+this.descr+"</span>"),t};var x=function(e,t,r,s,i,n,p,u,h,l,f,d,c){var m=this,y=[];if(this.nickname=e||y.push("SwaggerOperations must have a nickname."),this.path=t||y.push("SwaggerOperation "+e+" is missing path."),this.method=r||y.push("SwaggerOperation "+e+" is missing method."),this.parameters=s?s:[],this.summary=i,this.notes=n,this.type=p,this.responseMessages=u||[],this.resource=h||y.push("Resource is required"),this.consumes=l,this.produces=f,this.authorizations="undefined"!=typeof d?d:h.authorizations,this.deprecated=c,this["do"]=a(this["do"],this),"string"==typeof this.deprecated)switch(this.deprecated.toLowerCase()){case"true":case"yes":case"1":this.deprecated=!0;break;case"false":case"no":case"0":case null:this.deprecated=!1;break;default:this.deprecated=Boolean(this.deprecated)}y.length>0&&(console.error("SwaggerOperation errors",y,arguments),this.resource.api.fail(y)),this.path=this.path.replace("{format}","json"),this.method=this.method.toLowerCase(),this.isGetMethod="get"===this.method;var g,v,b;for(this.resourceName=this.resource.name,"undefined"!=typeof this.type&&"void"===this.type?this.type=null:(this.responseClassSignature=this.getSignature(this.type,this.resource.models),this.responseSampleJSON=this.getSampleJSON(this.type,this.resource.models)),g=0;g<this.parameters.length;g++){var w=this.parameters[g];w.name=w.name||w.type||w.dataType,p=w.type||w.dataType,"array"===p&&(p="array["+(w.items.$ref?w.items.$ref:w.items.type)+"]"),w.type=p,p&&"boolean"===p.toLowerCase()&&(w.allowableValues={},w.allowableValues.values=["true","false"]),w.signature=this.getSignature(p,this.resource.models),w.sampleJSON=this.getSampleJSON(p,this.resource.models);var S=w["enum"];if("undefined"!=typeof S)for(w.isList=!0,w.allowableValues={},w.allowableValues.descriptiveValues=[],v=0;v<S.length;v++)b=S[v],w.allowableValues.descriptiveValues.push(w.defaultValue?{value:String(b),isDefault:b===w.defaultValue}:{value:String(b),isDefault:!1});else if(w.allowableValues&&("RANGE"===w.allowableValues.valueType?w.isRange=!0:w.isList=!0,w.allowableValues&&(w.allowableValues.descriptiveValues=[],w.allowableValues.values)))for(v=0;v<w.allowableValues.values.length;v++)b=w.allowableValues.values[v],w.allowableValues.descriptiveValues.push(null!==w.defaultValue?{value:String(b),isDefault:b===w.defaultValue}:{value:String(b),isDefault:!1});w.defaultValue=o(this,w)}var x=this.resource.api.defaultSuccessCallback||null,C=this.resource.api.defaultErrorCallback||null;this.resource[this.nickname]=function(e,t,r,s){var i,n,a,o;return"function"==typeof e?(i={},n={},a=e,o=t):"object"==typeof e&&"function"==typeof t?(i=e,n={},a=t,o=r):(i=e,n=t,a=r,o=s),m["do"](i||{},n||{},a||x,o||C)},this.resource[this.nickname].help=function(e){return m.help(e)},this.resource[this.nickname].asCurl=function(e){return m.asCurl(e)}};x.prototype.isListType=function(e){return e&&e.indexOf("[")>=0?e.substring(e.indexOf("[")+1,e.indexOf("]")):void 0},x.prototype.getSignature=function(e,t){var r,s;return s=this.isListType(e),r="undefined"!=typeof s&&t[s]||"undefined"!=typeof t[e]?!1:!0,r?e:"undefined"!=typeof s?t[s].getMockSignature():t[e].getMockSignature()},x.prototype.getSampleJSON=function(e,t){var r,s,i;if(s=this.isListType(e),r="undefined"!=typeof s&&t[s]||"undefined"!=typeof t[e]?!1:!0,i=r?void 0:s?t[s].createJSONSample():t[e].createJSONSample()){if(i=s?[i]:i,"string"==typeof i)return i;if("object"==typeof i){var n=i;if(i instanceof Array&&i.length>0&&(n=i[0]),n.nodeName){var a=(new XMLSerializer).serializeToString(n);return this.formatXml(a)}return JSON.stringify(i,null,2)}return i}},x.prototype["do"]=function(e,t,r,s){var i,n,a,o,p,u=[];"function"!=typeof s&&(s=function(e,t,r){return log(e,t,r)}),"function"!=typeof r&&(r=function(e){var t;return t=null,t=null!==e?e.data:"no data",log("default callback: "+t)}),a={},a.headers=[],e.headers&&(a.headers=e.headers,delete e.headers),t&&t.responseContentType&&(a.headers["Content-Type"]=t.responseContentType),t&&t.requestContentType&&(a.headers.Accept=t.requestContentType);for(var h=0;h<this.parameters.length;h++)if(n=this.parameters[h],"header"===n.paramType)"undefined"!=typeof e[n.name]&&(a.headers[n.name]=e[n.name]);else if("form"===n.paramType||"file"===n.paramType.toLowerCase())u.push(n);else if("body"===n.paramType&&"body"!==n.name&&"undefined"!=typeof e[n.name]){if(e.body)throw new Error("Saw two body params in an API listing; expecting a max of one.");e.body=e[n.name]}if("undefined"!=typeof e.body&&(a.body=e.body,delete e.body),u)for(i in u)p=u[i],e[p.name]&&(a[p.name]=e[p.name]);return o=new C(this.method,this.urlify(e),a,t,r,s,this),t.mock?o:!0},x.prototype.pathJson=function(){return this.path.replace("{format}","json")},x.prototype.pathXml=function(){return this.path.replace("{format}","xml")},x.prototype.encodePathParam=function(e){var t,r,s,i,n;if(e=e.toString(),-1===e.indexOf("/"))return encodeURIComponent(e);for(s=e.split("/"),t=[],i=0,n=s.length;n>i;i++)r=s[i],t.push(encodeURIComponent(r));return t.join("/")},x.prototype.urlify=function(e){var t,r,s,i;i=this.resource.basePath.length>1&&"/"===this.resource.basePath.slice(-1)&&"/"===this.pathJson().charAt(0)?this.resource.basePath+this.pathJson().substring(1):this.resource.basePath+this.pathJson();var n=this.parameters;for(t=0;t<n.length;t++)if(s=n[t],"path"===s.paramType){if("undefined"==typeof e[s.name])throw""+s.name+" is a required path param.";var a=new RegExp("\\{\\s*?"+s.name+"[^\\{\\}\\/]*(?:\\{.*?\\}[^\\{\\}\\/]*)*\\}(?=(\\/?|$))","gi");i=i.replace(a,this.encodePathParam(e[s.name])),delete e[s.name]}var o="";for(t=0;t<n.length;t++)if(s=n[t],"query"===s.paramType)if(""!==o&&(o+="&"),Array.isArray(s)){var p="";for(r=0;r<s.length;r++)r>0&&(p+=","),p+=encodeURIComponent(s[r]);o+=encodeURIComponent(s.name)+"="+p}else if("undefined"!=typeof e[s.name])o+=encodeURIComponent(s.name)+"="+encodeURIComponent(e[s.name]);else if(s.required)throw""+s.name+" is a required query param.";return o&&o.length>0&&(i+="?"+o),i},x.prototype.supportHeaderParams=function(){return this.resource.api.supportHeaderParams},x.prototype.supportedSubmitMethods=function(){return this.resource.api.supportedSubmitMethods},x.prototype.getQueryParams=function(e){return this.getMatchingParams(["query"],e)},x.prototype.getHeaderParams=function(e){return this.getMatchingParams(["header"],e)},x.prototype.getMatchingParams=function(e,t){for(var r={},s=this.parameters,i=0;i<s.length;i++)param=s[i],t&&t[param.name]&&(r[param.name]=t[param.name]);var n,a=this.resource.api.headers;for(n in a){var o=a[n];r[n]=o}return r},x.prototype.help=function(e){for(var t=this.nickname+": "+this.summary,r=this.parameters,s=0;s<r.length;s++){var i=r[s];t+="\n* "+i.name+(i.required?" (required)":"")+" - "+i.description}return e?t:(console.log(t),t)},x.prototype.asCurl=function(e){var t,r=[],s=C.prototype.setHeaders(e,{},this);for(t=0;t<this.parameters.length;t++){var i=this.parameters[t];i.paramType&&"header"===i.paramType&&e[i.name]&&(s[i.name]=e[i.name])}var n;for(n in s)r.push('--header "'+n+": "+s[n]+'"');return"curl "+r.join(" ")+" "+this.urlify(e)},x.prototype.formatXml=function(e){var t,r,s,i,n,a,o,p,u,h,l,f,d;for(p=/(>)(<)(\/*)/g,h=/[ ]*(.*)[ ]+\n/g,t=/(<.+>)(.+\n)/g,e=e.replace(p,"$1\n$2$3").replace(h,"$1\n").replace(t,"$1\n$2"),o=0,r="",n=e.split("\n"),s=0,i="other",u={"single->single":0,"single->closing":-1,"single->opening":0,"single->other":0,"closing->single":0,"closing->closing":-1,"closing->opening":0,"closing->other":0,"opening->single":1,"opening->closing":0,"opening->opening":1,"opening->other":1,"other->single":0,"other->closing":-1,"other->opening":0,"other->other":0},l=function(e){var t,n,a,o,p,h,l;h={single:Boolean(e.match(/<.+\/>/)),closing:Boolean(e.match(/<\/.+>/)),opening:Boolean(e.match(/<[^!?].*>/))},p=function(){var e;e=[];for(a in h)l=h[a],l&&e.push(a);return e}()[0],p=void 0===p?"other":p,t=i+"->"+p,i=p,o="",s+=u[t],o=function(){var e,t,r;for(r=[],n=e=0,t=s;t>=0?t>e:e>t;n=t>=0?++e:--e)r.push(" ");return r}().join(""),"opening->closing"===t?r=r.substr(0,r.length-1)+e+"\n":r+=o+e+"\n"},f=0,d=n.length;d>f;f++)a=n[f],l(a);return r};var C=function(e,t,r,s,i,n,a,o){var p=this,u=[];if(this.useJQuery="undefined"!=typeof a.resource.useJQuery?a.resource.useJQuery:null,this.type=e||u.push("SwaggerRequest type is required (get/post/put/delete/patch/options)."),this.url=t||u.push("SwaggerRequest url is required."),this.params=r,this.opts=s,this.successCallback=i||u.push("SwaggerRequest successCallback is required."),this.errorCallback=n||u.push("SwaggerRequest error callback is required."),this.operation=a||u.push("SwaggerRequest operation is required."),this.execution=o,this.headers=r.headers||{},u.length>0)throw u;this.type=this.type.toUpperCase();var h=this.setHeaders(r,s,this.operation),l=r.body;if(h["Content-Type"]){var f,d,c,m={},y=this.operation.parameters;for(c=0;c<y.length;c++){var g=y[c];"form"===g.paramType&&(m[g.name]=g)}if(0===h["Content-Type"].indexOf("application/x-www-form-urlencoded")){var v="";for(f in m)d=this.params[f],"undefined"!=typeof d&&(""!==v&&(v+="&"),v+=encodeURIComponent(f)+"="+encodeURIComponent(d));l=v}else if(0===h["Content-Type"].indexOf("multipart/form-data")){var b="",w="----SwaggerFormBoundary"+Date.now();for(f in m)d=this.params[f],"undefined"!=typeof d&&(b+="--"+w+"\n",b+='Content-Disposition: form-data; name="'+f+'"',b+="\n\n",b+=d+"\n");b+="--"+w+"--\n",h["Content-Type"]="multipart/form-data; boundary="+w,l=b}}var S;if(!this.headers||!this.headers.mock){S={url:this.url,method:this.type,headers:h,body:l,useJQuery:this.useJQuery,on:{error:function(e){return p.errorCallback(e,p.opts.parent)},redirect:function(e){return p.successCallback(e,p.opts.parent)},307:function(e){return p.successCallback(e,p.opts.parent)},response:function(e){return p.successCallback(e,p.opts.parent)}}};var x=!1;if(this.operation.resource&&this.operation.resource.api&&this.operation.resource.api.clientAuthorizations)x=this.operation.resource.api.clientAuthorizations.apply(S,this.operation.authorizations);else{var C;C="undefined"!=typeof window?window:exports,x=C.authorizations.apply(S,this.operation.authorizations)}if(s.mock)return S;x!==!1?(new T).execute(S):S.canceled=!0}return S};C.prototype.setHeaders=function(e,t,r){var s,i=t.responseContentType||"application/json",n=t.requestContentType||"application/json",a=r.parameters,o=[],p=[],u=e.body,h={};for(s=0;s<a.length;s++){var l=a[s];if("form"===l.paramType)o.push(l);else if("file"===l.paramType)p.push(l);else if("header"===l.paramType&&this.params.headers){var f=l.name,d=this.params.headers[l.name];"undefined"!=typeof this.params.headers[l.name]&&(h[f]=d)}}return!u||"POST"!==this.type&&"PUT"!==this.type&&"PATCH"!==this.type&&"DELETE"!==this.type?o.length>0?n=p.length>0?"multipart/form-data":"application/x-www-form-urlencoded":"DELETE"===this.type?u="{}":"DELETE"!=this.type&&(n=null):this.opts.requestContentType&&(n=this.opts.requestContentType),n&&this.operation.consumes&&-1===this.operation.consumes.indexOf(n)&&log("server doesn't consume "+n+", try "+JSON.stringify(this.operation.consumes)),i=this.opts&&this.opts.responseContentType?this.opts.responseContentType:"application/json",i&&r.produces&&-1===r.produces.indexOf(i)&&log("server can't produce "+i),(n&&""!==u||"application/x-www-form-urlencoded"===n)&&(h["Content-Type"]=n),i&&(h.Accept=i),h};var T=function(){};T.prototype.execute=function(e,t){return this.useJQuery=e&&"boolean"==typeof e.useJQuery?e.useJQuery:this.isIE8(),e&&"object"==typeof e.body&&(e.body.type&&"formData"!==e.body.type?e.body=JSON.stringify(e.body):(e.contentType=!1,e.processData=!1,delete e.headers["Content-Type"])),this.useJQuery?new O(t).execute(e):new P(t).execute(e)},T.prototype.isIE8=function(){var e=!1;if("undefined"!=typeof navigator&&navigator.userAgent&&(nav=navigator.userAgent.toLowerCase(),-1!==nav.indexOf("msie"))){var t=parseInt(nav.split("msie")[1]);8>=t&&(e=!0)}return e};var O=function(){"use strict";if(!e)var e=window.jQuery};O.prototype.execute=function(e){var t=e.on,r=e;return e.type=e.method,e.cache=!1,delete e.useJQuery,e.data=e.body,delete e.body,e.complete=function(e){for(var s={},i=e.getAllResponseHeaders().split("\n"),n=0;n<i.length;n++){var a=i[n].trim();if(0!==a.length){var o=a.indexOf(":");if(-1!==o){var p=a.substring(0,o).trim(),u=a.substring(o+1).trim();s[p]=u}else s[a]=null}}var h={url:r.url,method:r.method,status:e.status,statusText:e.statusText,data:e.responseText,headers:s},l=s["content-type"]||s["Content-Type"]||null;if(l&&(0===l.indexOf("application/json")||l.indexOf("+json")>0))try{h.obj=e.responseJSON||JSON.parse(h.data)||{}}catch(f){log("unable to parse JSON content")}if(e.status>=200&&e.status<300)t.response(h);else{if(!(0===e.status||e.status>=400&&e.status<599))return t.response(h);t.error(h)}},jQuery.support.cors=!0,jQuery.ajax(e)};var P=function(e){this.opts=e||{},this.isInitialized=!1;"undefined"!=typeof window?(this.Shred=require("./shred"),this.content=require("./shred/content")):this.Shred=require("shred"),this.shred=new this.Shred(e)};P.prototype.initShred=function(){this.isInitialized=!0,this.registerProcessors(this.shred)},P.prototype.registerProcessors=function(){var e=function(e){return e},t=function(e){return e.toString()};"undefined"!=typeof window?this.content.registerProcessor(["application/json; charset=utf-8","application/json","json"],{parser:e,stringify:t}):this.Shred.registerProcessor(["application/json; charset=utf-8","application/json","json"],{parser:e,stringify:t})},P.prototype.execute=function(e){this.isInitialized||this.initShred();var t,r=e.on,s=function(e){var t={headers:e._headers,url:e.request.url,method:e.request.method,status:e.status,data:e.content.data},r=e._headers.normalized||e._headers,s=r["content-type"]||r["Content-Type"]||null;if(s&&(0===s.indexOf("application/json")||s.indexOf("+json")>0))if(e.content.data&&""!==e.content.data)try{t.obj=JSON.parse(e.content.data)}catch(i){}else t.obj={};return t},i=function(e){var t={status:0,data:e.message||e};return e.code&&(t.obj=e,("ENOTFOUND"===e.code||"ECONNREFUSED"===e.code)&&(t.status=404)),t};return t={error:function(t){return e?r.error(s(t)):void 0},request_error:function(t){return e?r.error(i(t)):void 0},response:function(t){return e?r.response(s(t)):void 0}},e&&(e.on=t),this.shred.request(e)};var A="undefined"!=typeof window?window:exports;A.authorizations=authorizations=new t,A.ApiKeyAuthorization=s,A.PasswordAuthorization=n,A.CookieAuthorization=i,A.SwaggerClient=f,A.SwaggerApi=f,A.Operation=c,A.Model=m,A.addModel=l,A.Resolver=h}(); |
@@ -5,3 +5,3 @@ { | ||
"description": "swagger.js is a javascript client for use with swaggering APIs.", | ||
"version": "2.1.8-M1", | ||
"version": "2.1.9-M1", | ||
"homepage": "http://swagger.io", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -89,3 +89,3 @@ var addModel = function(name, model) { | ||
self.swaggerVersion = responseObj.swagger; | ||
self.buildFromSpec(responseObj); | ||
new Resolver().resolve(responseObj, self.buildFromSpec, self); | ||
self.isValid = true; | ||
@@ -104,3 +104,5 @@ } | ||
if(this.spec) { | ||
setTimeout(function() { self.buildFromSpec(self.spec); }, 10); | ||
setTimeout(function() { | ||
new Resolver().resolve(self.spec, self.buildFromSpec, self); | ||
}, 10); | ||
} | ||
@@ -107,0 +109,0 @@ else { |
@@ -13,1 +13,2 @@ | ||
e.addModel = addModel; | ||
e.Resolver = Resolver; |
@@ -916,3 +916,13 @@ { | ||
} | ||
}, | ||
"parameters": { | ||
"sharedSkip": { | ||
"name": "skip", | ||
"in": "query", | ||
"description": "Results to skip", | ||
"required": false, | ||
"type": "integer", | ||
"format": "int32" | ||
} | ||
} | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1090844
68
18140