\n\n
\n
\n ';if(c=d.signature){c=c.call(k,{hash:{},data:i})}else{c=k.signature;c=typeof c===f?c.apply(k):c}if(c||c===0){g+=c}g+='\n
\n\n
\n
';if(c=d.sampleJSON){c=c.call(k,{hash:{},data:i})}else{c=k.sampleJSON;c=typeof c===f?c.apply(k):c}g+=h(c)+'
\n
\n
\n
\n\n';return g})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.status_code=b(function(e,k,d,j,i){this.compilerInfo=[2,">= 1.0.0-rc.3"];d=d||e.helpers;i=i||{};var g="",c,f="function",h=this.escapeExpression;g+="
";if(c=d.code){c=c.call(k,{hash:{},data:i})}else{c=k.code;c=typeof c===f?c.apply(k):c}g+=h(c)+" | \n
";if(c=d.reason){c=c.call(k,{hash:{},data:i})}else{c=k.reason;c=typeof c===f?c.apply(k):c}if(c||c===0){g+=c}g+=" | \n\n";return g})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param_readonly=b(function(g,m,f,l,k){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||g.helpers;k=k||{};var i="",d,h="function",j=this.escapeExpression,n=this;function e(r,q){var o="",p;o+="\n
\n ";return o}function c(r,q){var o="",p;o+="\n ";if(p=f.defaultValue){p=p.call(r,{hash:{},data:q})}else{p=r.defaultValue;p=typeof p===h?p.apply(r):p}o+=j(p)+"\n ";return o}i+="
";if(d=f.name){d=d.call(m,{hash:{},data:k})}else{d=m.name;d=typeof d===h?d.apply(m):d}i+=j(d)+" | \n
\n ";d=f["if"].call(m,m.isBody,{hash:{},inverse:n.program(3,c,k),fn:n.program(1,e,k),data:k});if(d||d===0){i+=d}i+="\n | \n
";if(d=f.description){d=d.call(m,{hash:{},data:k})}else{d=m.description;d=typeof d===h?d.apply(m):d}if(d||d===0){i+=d}i+=' | \n
| \n';return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.content_type=b(function(g,l,f,k,j){this.compilerInfo=[2,">= 1.0.0-rc.3"];f=f||g.helpers;j=j||{};var i="",c,h="function",m=this;function e(r,q){var o="",p;o+="\n ";p=f.each.call(r,r.produces,{hash:{},inverse:m.noop,fn:m.program(2,d,q),data:q});if(p||p===0){o+=p}o+="\n";return o}function d(r,q){var o="",p;o+='\n
\n ";return o}function n(p,o){return'\n
\n'}i+='
\n
\n";return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.resource=b(function(e,k,d,j,i){this.compilerInfo=[2,">= 1.0.0-rc.3"];d=d||e.helpers;i=i||{};var g="",c,f="function",h=this.escapeExpression;g+="
\n
\n";return g})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.operation=b(function(h,n,g,m,l){this.compilerInfo=[2,">= 1.0.0-rc.3"];g=g||h.helpers;l=l||{};var j="",d,i="function",k=this.escapeExpression,r=this;function f(w,v){var t="",u;t+="\n
Implementation Notes hide
\n
\n
";if(u=g.notes){u=u.call(w,{hash:{},data:v})}else{u=w.notes;u=typeof u===i?u.apply(w):u}if(u||u===0){t+=u}t+="
\n
\n ";return t}function c(w,v){var t="",u;t+="\n
Examples show
\n
\n
";if(u=g.examples){u=u.call(w,{hash:{},data:v})}else{u=w.examples;u=typeof u===i?u.apply(w):u}if(u||u===0){t+=u}t+="
\n
\n ";return t}function q(u,t){return'\n
Response Class
\n
\n
\n
\n '}function p(u,t){return'\n
Parameters
\n
\n \n \n Parameter | \n Value | \n Description | \n Data Type | \n
\n \n \n\n \n
\n '}function o(u,t){return"\n
\n
Status Codes
\n
\n \n \n HTTP Status Code | \n Reason | \n
\n \n \n \n
\n "}function e(u,t){return"\n "}function s(u,t){return"\n
\n "}j+="\n
\n - \n \n
\n ";d=g["if"].call(n,n.notes,{hash:{},inverse:r.noop,fn:r.program(1,f,l),data:l});if(d||d===0){j+=d}j+="\n ";d=g["if"].call(n,n.examples,{hash:{},inverse:r.noop,fn:r.program(3,c,l),data:l});if(d||d===0){j+=d}j+="\n ";d=g["if"].call(n,n.responseClass,{hash:{},inverse:r.noop,fn:r.program(5,q,l),data:l});if(d||d===0){j+=d}j+="\n
\n
\n
Request URL
\n
\n
Response Body
\n
\n
Response Code
\n
\n
Response Headers
\n \n
\n
\n \n
\n";return j})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param_list=b(function(g,r,p,k,t){this.compilerInfo=[2,">= 1.0.0-rc.3"];p=p||g.helpers;t=t||{};var q="",i,e,o=this,d="function",c=this.escapeExpression;function n(v,u){return"\n "}function m(x,w){var u="",v;u+="\n ";v=p["if"].call(x,x.defaultValue,{hash:{},inverse:o.program(6,j,w),fn:o.program(4,l,w),data:w});if(v||v===0){u+=v}u+="\n ";return u}function l(v,u){return"\n "}function j(v,u){return"\n
\n "}function h(x,w){var u="",v;u+="\n ";v=p["if"].call(x,x.isDefault,{hash:{},inverse:o.program(11,s,w),fn:o.program(9,f,w),data:w});if(v||v===0){u+=v}u+="\n ";return u}function f(x,w){var u="",v;u+="\n
\n ";return u}function s(x,w){var u="",v;u+="\n
\n ";return u}q+="
";if(i=p.name){i=i.call(r,{hash:{},data:t})}else{i=r.name;i=typeof i===d?i.apply(r):i}q+=c(i)+" | \n
\n \n | \n
";if(e=p.description){e=e.call(r,{hash:{},data:t})}else{e=r.description;e=typeof e===d?e.apply(r):e}if(e||e===0){q+=e}q+=' | \n
| \n';return q})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param=b(function(f,q,o,j,s){this.compilerInfo=[2,">= 1.0.0-rc.3"];o=o||f.helpers;s=s||{};var p="",g,d="function",c=this.escapeExpression,n=this;function m(x,w){var u="",v;u+="\n ";v=o["if"].call(x,x.isFile,{hash:{},inverse:n.program(4,k,w),fn:n.program(2,l,w),data:w});if(v||v===0){u+=v}u+="\n ";return u}function l(x,w){var u="",v;u+='\n
\n ";return u}function k(x,w){var u="",v;u+="\n ";v=o["if"].call(x,x.defaultValue,{hash:{},inverse:n.program(7,h,w),fn:n.program(5,i,w),data:w});if(v||v===0){u+=v}u+="\n ";return u}function i(x,w){var u="",v;u+="\n
\n ";return u}function h(x,w){var u="",v;u+="\n
\n
\n
\n ';return u}function e(x,w){var u="",v;u+="\n ";v=o["if"].call(x,x.defaultValue,{hash:{},inverse:n.program(12,r,w),fn:n.program(10,t,w),data:w});if(v||v===0){u+=v}u+="\n ";return u}function t(x,w){var u="",v;u+="\n
\n ";return u}function r(x,w){var u="",v;u+="\n
\n ";return u}p+="
";if(g=o.name){g=g.call(q,{hash:{},data:s})}else{g=q.name;g=typeof g===d?g.apply(q):g}p+=c(g)+" | \n
\n\n ";g=o["if"].call(q,q.isBody,{hash:{},inverse:n.program(9,e,s),fn:n.program(1,m,s),data:s});if(g||g===0){p+=g}p+="\n\n | \n
";if(g=o.description){g=g.call(q,{hash:{},data:s})}else{g=q.description;g=typeof g===d?g.apply(q):g}if(g||g===0){p+=g}p+=' | \n
\n \n | \n\n';return p})})();(function(){var i,o,r,l,j,k,h,m,p,n,g,f,e,d,c,b,a,t,q={}.hasOwnProperty,s=function(x,v){for(var u in v){if(q.call(v,u)){x[u]=v[u]}}function w(){this.constructor=x}w.prototype=v.prototype;x.prototype=new w();x.__super__=v.prototype;return x};p=(function(v){s(u,v);function u(){n=u.__super__.constructor.apply(this,arguments);return n}u.prototype.dom_id="swagger_ui";u.prototype.options=null;u.prototype.api=null;u.prototype.headerView=null;u.prototype.mainView=null;u.prototype.initialize=function(w){var x=this;if(w==null){w={}}if(w.dom_id!=null){this.dom_id=w.dom_id;delete w.dom_id}if($("#"+this.dom_id)==null){$("body").append('
')}this.options=w;this.options.success=function(){return x.render()};this.options.progress=function(y){return x.showMessage(y)};this.options.failure=function(y){return x.onLoadFailure(y)};this.headerView=new o({el:$("#header")});return this.headerView.on("update-swagger-ui",function(y){return x.updateSwaggerUi(y)})};u.prototype.updateSwaggerUi=function(w){this.options.discoveryUrl=w.discoveryUrl;this.options.apiKey=w.apiKey;return this.load()};u.prototype.load=function(){var w;if((w=this.mainView)!=null){w.clear()}this.headerView.update(this.options.discoveryUrl,this.options.apiKey);return this.api=new SwaggerApi(this.options)};u.prototype.render=function(){var w=this;this.showMessage("Finished Loading Resource Information. Rendering Swagger UI...");this.mainView=new r({model:this.api,el:$("#"+this.dom_id)}).render();this.showMessage();switch(this.options.docExpansion){case"full":Docs.expandOperationsForResource("");break;case"list":Docs.collapseOperationsForResource("")}if(this.options.onComplete){this.options.onComplete(this.api,this)}return setTimeout(function(){return Docs.shebang()},400)};u.prototype.showMessage=function(w){if(w==null){w=""}$("#message-bar").removeClass("message-fail");$("#message-bar").addClass("message-success");return $("#message-bar").html(w)};u.prototype.onLoadFailure=function(w){var x;if(w==null){w=""}$("#message-bar").removeClass("message-success");$("#message-bar").addClass("message-fail");x=$("#message-bar").html(w);if(this.options.onFailure!=null){this.options.onFailure(w)}return x};return u})(Backbone.Router);window.SwaggerUi=p;o=(function(v){s(u,v);function u(){g=u.__super__.constructor.apply(this,arguments);return g}u.prototype.events={"click #show-pet-store-icon":"showPetStore","click #show-wordnik-dev-icon":"showWordnikDev","click #explore":"showCustom","keyup #input_baseUrl":"showCustomOnKeyup","keyup #input_apiKey":"showCustomOnKeyup"};u.prototype.initialize=function(){};u.prototype.showPetStore=function(w){return this.trigger("update-swagger-ui",{discoveryUrl:"http://petstore.swagger.wordnik.com/api/api-docs.json",apiKey:"special-key"})};u.prototype.showWordnikDev=function(w){return this.trigger("update-swagger-ui",{discoveryUrl:"http://api.wordnik.com/v4/resources.json",apiKey:""})};u.prototype.showCustomOnKeyup=function(w){if(w.keyCode===13){return this.showCustom()}};u.prototype.showCustom=function(w){if(w!=null){w.preventDefault()}return this.trigger("update-swagger-ui",{discoveryUrl:$("#input_baseUrl").val(),apiKey:$("#input_apiKey").val()})};u.prototype.update=function(x,y,w){if(w==null){w=false}$("#input_baseUrl").val(x);$("#input_apiKey").val(y);if(w){return this.trigger("update-swagger-ui",{discoveryUrl:x,apiKey:y})}};return u})(Backbone.View);r=(function(u){s(v,u);function v(){f=v.__super__.constructor.apply(this,arguments);return f}v.prototype.initialize=function(){};v.prototype.render=function(){var y,x,w,z;$(this.el).html(Handlebars.templates.main(this.model));z=this.model.apisArray;for(x=0,w=z.length;x
=0;if(!H){this.model.isReadOnly=true}$(this.el).html(Handlebars.templates.operation(this.model));if(this.model.responseClassSignature&&this.model.responseClassSignature!=="string"){I={sampleJSON:this.model.responseSampleJSON,isParam:false,signature:this.model.responseClassSignature};D=new h({model:I,tagName:"div"});$(".model-signature",$(this.el)).append(D.render().el)}else{$(".model-signature",$(this.el)).html(this.model.responseClass)}w={isParam:false};if(this.model.supportedContentTypes){w.produces=this.model.supportedContentTypes}if(this.model.produces){w.produces=this.model.produces}G=new i({model:w});$(".content-type",$(this.el)).append(G.render().el);z=this.model.parameters;for(C=0,F=z.length;C0){W[N.name]=N.value}}V=F.children().find('input[type~="file"]').size()!==0;P=false;R="application/json";if(this.model.consumes&&this.model.consumes.length>0){R=this.model.consumes[0]}else{y=this.model.parameters;for(E=0,Z=y.length;E"+H+"");$(".response_throbber",$(this.el)).show();J={type:this.model.httpMethod,url:H,headers:A,data:L,contentType:R,dataType:"json",processData:false,error:function(ac,ad,ab){return O.showErrorStatus(ac,ad,ab)},success:function(ab){return O.showResponse(ab)},complete:function(ab){return O.showCompleteStatus(ab)}};M=$("td select[name=contentType]",$(this.el)).val();if(M){J.contentType=M}D=$(".content > .content-type > div > select[name=contentType]",$(this.el)).val();if(D){J.headers=J.headers!=null?J.headers:{};J.headers.accept=D}jQuery.ajax(J);return false}};u.prototype.hideResponse=function(w){if(w!=null){w.preventDefault()}$(".response",$(this.el)).slideUp();return $(".response_hider",$(this.el)).fadeOut()};u.prototype.toggleText=function(x){var w;if(x!=null){x.preventDefault()}w=this.$(x.target);if(w.html()==="show"){w.html("hide")}else{w.html("show")}return w.parent().next("div").slideToggle()};u.prototype.showResponse=function(w){var x;x=JSON.stringify(w,null,"\t").replace(/\n/g,"
");return $(".response_body",$(this.el)).html(escape(x))};u.prototype.showErrorStatus=function(w){return this.showStatus(w)};u.prototype.showCompleteStatus=function(w){return this.showStatus(w)};u.prototype.formatXml=function(D){var z,C,x,E,J,F,y,w,H,I,B,A,G;w=/(>)(<)(\/*)/g;I=/[ ]*(.*)[ ]+\n/g;z=/(<.+>)(.+\n)/g;D=D.replace(w,"$1\n$2$3").replace(I,"$1\n").replace(z,"$1\n$2");y=0;C="";J=D.split("\n");x=0;E="other";H={"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};B=function(P){var L,K,N,R,O,M,Q;M={single:Boolean(P.match(/<.+\/>/)),closing:Boolean(P.match(/<\/.+>/)),opening:Boolean(P.match(/<[^!?].*>/))};O=((function(){var S;S=[];for(N in M){Q=M[N];if(Q){S.push(N)}}return S})())[0];O=O===void 0?"other":O;L=E+"->"+O;E=O;R="";x+=H[L];R=((function(){var T,U,S;S=[];for(K=T=0,U=x;0<=U?TU;K=0<=U?++T:--T){S.push(" ")}return S})()).join("");if(L==="opening->closing"){return C=C.substr(0,C.length-1)+P+"\n"}else{return C+=R+P+"\n"}};for(A=0,G=J.length;A").text(JSON.stringify(JSON.parse(z.responseText),null,2));A=$('').append(y)}catch(B){x=B;y=$("
").text(this.formatXml(z.responseText));A=$('').append(y)}w=A;$(".response_code",$(this.el)).html(""+z.status+"
");$(".response_body",$(this.el)).html(w);$(".response_headers",$(this.el)).html(""+z.getAllResponseHeaders()+"
");$(".response",$(this.el)).slideDown();$(".response_hider",$(this.el)).show();$(".response_throbber",$(this.el)).hide();return hljs.highlightBlock($(".response_body",$(this.el))[0])};u.prototype.toggleOperationContent=function(){var w;w=$("#"+Docs.escapeResourceName(this.model.resourceName)+"_"+this.model.nickname+"_"+this.model.httpMethod+"_"+this.model.number+"_content");if(w.is(":visible")){return Docs.collapseOperation(w)}else{return Docs.expandOperation(w)}};return u})(Backbone.View);m=(function(v){s(u,v);function u(){c=u.__super__.constructor.apply(this,arguments);return c}u.prototype.initialize=function(){};u.prototype.render=function(){var w;w=this.template();$(this.el).html(w(this.model));return this};u.prototype.template=function(){return Handlebars.templates.status_code};return u})(Backbone.View);j=(function(v){s(u,v);function u(){b=u.__super__.constructor.apply(this,arguments);return b}u.prototype.initialize=function(){};u.prototype.render=function(){var z,x,w,A,y;if(this.model.paramType==="body"){this.model.isBody=true}if(this.model.dataType==="file"){this.model.isFile=true}y=this.template();$(this.el).html(y(this.model));w={sampleJSON:this.model.sampleJSON,isParam:true,signature:this.model.signature};if(this.model.sampleJSON){A=new h({model:w,tagName:"div"});$(".model-signature",$(this.el)).append(A.render().el)}else{$(".model-signature",$(this.el)).html(this.model.signature)}z={isParam:false};if(this.model.supportedContentTypes){z.produces=this.model.supportedContentTypes}if(this.model.produces){z.produces=this.model.produces}x=new i({model:z});$(".content-type",$(this.el)).append(x.render().el);return this};u.prototype.template=function(){if(this.model.isList){return Handlebars.templates.param_list}else{if(this.options.readOnly){if(this.model.required){return Handlebars.templates.param_readonly_required}else{return Handlebars.templates.param_readonly}}else{if(this.model.required){return Handlebars.templates.param_required}else{return Handlebars.templates.param}}}};return u})(Backbone.View);h=(function(v){s(u,v);function u(){a=u.__super__.constructor.apply(this,arguments);return a}u.prototype.events={"click a.description-link":"switchToDescription","click a.snippet-link":"switchToSnippet","mousedown .snippet":"snippetToTextArea"};u.prototype.initialize=function(){};u.prototype.render=function(){var w;w=this.template();$(this.el).html(w(this.model));this.switchToDescription();this.isParam=this.model.isParam;if(this.isParam){$(".notice",$(this.el)).text("Click to set as parameter value")}return this};u.prototype.template=function(){return Handlebars.templates.signature};u.prototype.switchToDescription=function(w){if(w!=null){w.preventDefault()}$(".snippet",$(this.el)).hide();$(".description",$(this.el)).show();$(".description-link",$(this.el)).addClass("selected");return $(".snippet-link",$(this.el)).removeClass("selected")};u.prototype.switchToSnippet=function(w){if(w!=null){w.preventDefault()}$(".description",$(this.el)).hide();$(".snippet",$(this.el)).show();$(".snippet-link",$(this.el)).addClass("selected");return $(".description-link",$(this.el)).removeClass("selected")};u.prototype.snippetToTextArea=function(w){var x;if(this.isParam){if(w!=null){w.preventDefault()}x=$("textarea",$(this.el.parentNode.parentNode.parentNode));if($.trim(x.val())===""){return x.val(this.model.sampleJSON)}}};return u})(Backbone.View);i=(function(u){s(v,u);function v(){t=v.__super__.constructor.apply(this,arguments);return t}v.prototype.initialize=function(){};v.prototype.render=function(){var w;w=this.template();$(this.el).html(w(this.model));this.isParam=this.model.isParam;if(this.isParam){$("label[for=contentType]",$(this.el)).text("Parameter content type:")}else{$("label[for=contentType]",$(this.el)).text("Response Content Type")}return this};v.prototype.template=function(){return Handlebars.templates.content_type};return v})(Backbone.View)}).call(this);