You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 10 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 10 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 10 година
пре 9 година
пре 10 година
пре 10 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 10 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 10 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 10 година
пре 9 година
пре 10 година
пре 9 година
пре 10 година
пре 9 година
пре 10 година
пре 9 година
пре 10 година
пре 9 година
пре 10 година
пре 9 година
пре 10 година
пре 10 година
пре 9 година
пре 10 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 10 година
пре 9 година
пре 10 година
пре 9 година
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296
  1. /**
  2. * swagger-ui - Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API
  3. * @version v2.1.8-M1
  4. * @link http://swagger.io
  5. * @license Apache 2.0
  6. */
  7. this["Handlebars"] = this["Handlebars"] || {};
  8. this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
  9. this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  10. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  11. return "<!--div class='auth_button' id='apikey_button'><img class='auth_icon' alt='apply api key' src='images/apikey.jpeg'></div-->\n<div class='auth_container' id='apikey_container'>\n <div class='key_input_container'>\n <div class='auth_label'>"
  12. + escapeExpression(((helper = (helper = helpers.keyName || (depth0 != null ? depth0.keyName : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"keyName","hash":{},"data":data}) : helper)))
  13. + "</div>\n <input placeholder=\"api_key\" class=\"auth_input\" id=\"input_apiKey_entry\" name=\"apiKey\" type=\"text\"/>\n <div class='auth_submit'><a class='auth_submit_button' id=\"apply_api_key\" href=\"#\">apply</a></div>\n </div>\n</div>\n\n";
  14. },"useData":true});
  15. this["Handlebars"]["templates"]["basic_auth_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  16. return "<div class='auth_button' id='basic_auth_button'><img class='auth_icon' src='images/password.jpeg'></div>\n<div class='auth_container' id='basic_auth_container'>\n <div class='key_input_container'>\n <div class=\"auth_label\">Username</div>\n <input placeholder=\"username\" class=\"auth_input\" id=\"input_username\" name=\"username\" type=\"text\"/>\n <div class=\"auth_label\">Password</div>\n <input placeholder=\"password\" class=\"auth_input\" id=\"input_password\" name=\"password\" type=\"password\"/>\n <div class='auth_submit'><a class='auth_submit_button' id=\"apply_basic_auth\" href=\"#\">apply</a></div>\n </div>\n</div>\n\n";
  17. },"useData":true});
  18. this["Handlebars"]["templates"]["content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  19. var stack1, buffer = "";
  20. stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
  21. if (stack1 != null) { buffer += stack1; }
  22. return buffer;
  23. },"2":function(depth0,helpers,partials,data) {
  24. var stack1, lambda=this.lambda, buffer = " <option value=\"";
  25. stack1 = lambda(depth0, depth0);
  26. if (stack1 != null) { buffer += stack1; }
  27. buffer += "\">";
  28. stack1 = lambda(depth0, depth0);
  29. if (stack1 != null) { buffer += stack1; }
  30. return buffer + "</option>\n";
  31. },"4":function(depth0,helpers,partials,data) {
  32. return " <option value=\"application/json\">application/json</option>\n";
  33. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  34. var stack1, buffer = "<label for=\"contentType\"></label>\n<select name=\"contentType\">\n";
  35. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
  36. if (stack1 != null) { buffer += stack1; }
  37. return buffer + "</select>\n";
  38. },"useData":true});
  39. $(function() {
  40. // Helper function for vertically aligning DOM elements
  41. // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
  42. $.fn.vAlign = function() {
  43. return this.each(function(i){
  44. var ah = $(this).height();
  45. var ph = $(this).parent().height();
  46. var mh = (ph - ah) / 2;
  47. $(this).css('margin-top', mh);
  48. });
  49. };
  50. $.fn.stretchFormtasticInputWidthToParent = function() {
  51. return this.each(function(i){
  52. var p_width = $(this).closest("form").innerWidth();
  53. var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);
  54. var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
  55. $(this).css('width', p_width - p_padding - this_padding);
  56. });
  57. };
  58. $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
  59. // Vertically center these paragraphs
  60. // Parent may need a min-height for this to work..
  61. $('ul.downplayed li div.content p').vAlign();
  62. // When a sandbox form is submitted..
  63. $("form.sandbox").submit(function(){
  64. var error_free = true;
  65. // Cycle through the forms required inputs
  66. $(this).find("input.required").each(function() {
  67. // Remove any existing error styles from the input
  68. $(this).removeClass('error');
  69. // Tack the error style on if the input is empty..
  70. if ($(this).val() == '') {
  71. $(this).addClass('error');
  72. $(this).wiggle();
  73. error_free = false;
  74. }
  75. });
  76. return error_free;
  77. });
  78. });
  79. function clippyCopiedCallback(a) {
  80. $('#api_key_copied').fadeIn().delay(1000).fadeOut();
  81. // var b = $("#clippy_tooltip_" + a);
  82. // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
  83. // b.attr("title", "copy to clipboard")
  84. // },
  85. // 500))
  86. }
  87. // Logging function that accounts for browsers that don't have window.console
  88. log = function(){
  89. log.history = log.history || [];
  90. log.history.push(arguments);
  91. if(this.console){
  92. console.log( Array.prototype.slice.call(arguments)[0] );
  93. }
  94. };
  95. // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
  96. if (Function.prototype.bind && console && typeof console.log == "object") {
  97. [
  98. "log","info","warn","error","assert","dir","clear","profile","profileEnd"
  99. ].forEach(function (method) {
  100. console[method] = this.bind(console[method], console);
  101. }, Function.prototype.call);
  102. }
  103. var Docs = {
  104. shebang: function() {
  105. // If shebang has an operation nickname in it..
  106. // e.g. /docs/#!/words/get_search
  107. var fragments = $.param.fragment().split('/');
  108. fragments.shift(); // get rid of the bang
  109. switch (fragments.length) {
  110. case 1:
  111. // Expand all operations for the resource and scroll to it
  112. var dom_id = 'resource_' + fragments[0];
  113. Docs.expandEndpointListForResource(fragments[0]);
  114. $("#"+dom_id).slideto({highlight: false});
  115. break;
  116. case 2:
  117. // Refer to the endpoint DOM element, e.g. #words_get_search
  118. // Expand Resource
  119. Docs.expandEndpointListForResource(fragments[0]);
  120. $("#"+dom_id).slideto({highlight: false});
  121. // Expand operation
  122. var li_dom_id = fragments.join('_');
  123. var li_content_dom_id = li_dom_id + "_content";
  124. Docs.expandOperation($('#'+li_content_dom_id));
  125. $('#'+li_dom_id).slideto({highlight: false});
  126. break;
  127. }
  128. },
  129. toggleEndpointListForResource: function(resource) {
  130. var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
  131. if (elem.is(':visible')) {
  132. Docs.collapseEndpointListForResource(resource);
  133. } else {
  134. Docs.expandEndpointListForResource(resource);
  135. }
  136. },
  137. // Expand resource
  138. expandEndpointListForResource: function(resource) {
  139. var resource = Docs.escapeResourceName(resource);
  140. if (resource == '') {
  141. $('.resource ul.endpoints').slideDown();
  142. return;
  143. }
  144. $('li#resource_' + resource).addClass('active');
  145. var elem = $('li#resource_' + resource + ' ul.endpoints');
  146. elem.slideDown();
  147. },
  148. // Collapse resource and mark as explicitly closed
  149. collapseEndpointListForResource: function(resource) {
  150. var resource = Docs.escapeResourceName(resource);
  151. if (resource == '') {
  152. $('.resource ul.endpoints').slideUp();
  153. return;
  154. }
  155. $('li#resource_' + resource).removeClass('active');
  156. var elem = $('li#resource_' + resource + ' ul.endpoints');
  157. elem.slideUp();
  158. },
  159. expandOperationsForResource: function(resource) {
  160. // Make sure the resource container is open..
  161. Docs.expandEndpointListForResource(resource);
  162. if (resource == '') {
  163. $('.resource ul.endpoints li.operation div.content').slideDown();
  164. return;
  165. }
  166. $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
  167. Docs.expandOperation($(this));
  168. });
  169. },
  170. collapseOperationsForResource: function(resource) {
  171. // Make sure the resource container is open..
  172. Docs.expandEndpointListForResource(resource);
  173. if (resource == '') {
  174. $('.resource ul.endpoints li.operation div.content').slideUp();
  175. return;
  176. }
  177. $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
  178. Docs.collapseOperation($(this));
  179. });
  180. },
  181. escapeResourceName: function(resource) {
  182. return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
  183. },
  184. expandOperation: function(elem) {
  185. elem.slideDown();
  186. },
  187. collapseOperation: function(elem) {
  188. elem.slideUp();
  189. }
  190. };
  191. Handlebars.registerHelper('sanitize', function(html) {
  192. html = html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
  193. return new Handlebars.SafeString(html);
  194. });
  195. this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  196. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div class=\"info_title\">"
  197. + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
  198. + "</div>\n <div class=\"info_description markdown\">";
  199. stack1 = lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.description : stack1), depth0);
  200. if (stack1 != null) { buffer += stack1; }
  201. buffer += "</div>\n";
  202. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.externalDocs : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
  203. if (stack1 != null) { buffer += stack1; }
  204. buffer += " ";
  205. stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.noop,"data":data});
  206. if (stack1 != null) { buffer += stack1; }
  207. buffer += "\n ";
  208. stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), {"name":"if","hash":{},"fn":this.program(6, data),"inverse":this.noop,"data":data});
  209. if (stack1 != null) { buffer += stack1; }
  210. buffer += "\n ";
  211. stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), {"name":"if","hash":{},"fn":this.program(8, data),"inverse":this.noop,"data":data});
  212. if (stack1 != null) { buffer += stack1; }
  213. buffer += "\n ";
  214. stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
  215. if (stack1 != null) { buffer += stack1; }
  216. buffer += "\n ";
  217. stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1), {"name":"if","hash":{},"fn":this.program(12, data),"inverse":this.noop,"data":data});
  218. if (stack1 != null) { buffer += stack1; }
  219. return buffer + "\n";
  220. },"2":function(depth0,helpers,partials,data) {
  221. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  222. return " <h5>More documentations</h5>\n <p>"
  223. + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.externalDocs : depth0)) != null ? stack1.description : stack1), depth0))
  224. + "</p>\n <a href=\""
  225. + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.externalDocs : depth0)) != null ? stack1.url : stack1), depth0))
  226. + "\" target=\"_blank\">"
  227. + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.externalDocs : depth0)) != null ? stack1.url : stack1), depth0))
  228. + "</a>\n";
  229. },"4":function(depth0,helpers,partials,data) {
  230. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  231. return "<div class=\"info_tos\"><a href=\""
  232. + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), depth0))
  233. + "\">Terms of service</a></div>";
  234. },"6":function(depth0,helpers,partials,data) {
  235. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  236. return "<div class='info_name'>Created by "
  237. + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), depth0))
  238. + "</div>";
  239. },"8":function(depth0,helpers,partials,data) {
  240. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  241. return "<div class='info_url'>See more at <a href=\""
  242. + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
  243. + "\">"
  244. + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
  245. + "</a></div>";
  246. },"10":function(depth0,helpers,partials,data) {
  247. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  248. return "<div class='info_email'><a href=\"mailto:"
  249. + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), depth0))
  250. + "?subject="
  251. + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
  252. + "\">Contact the developer</a></div>";
  253. },"12":function(depth0,helpers,partials,data) {
  254. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  255. return "<div class='info_license'><a href='"
  256. + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.url : stack1), depth0))
  257. + "'>"
  258. + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.name : stack1), depth0))
  259. + "</a></div>";
  260. },"14":function(depth0,helpers,partials,data) {
  261. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
  262. return " , <span style=\"font-variant: small-caps\">api version</span>: "
  263. + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), depth0))
  264. + "\n ";
  265. },"16":function(depth0,helpers,partials,data) {
  266. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  267. return " <span style=\"float:right\"><a href=\""
  268. + escapeExpression(((helper = (helper = helpers.validatorUrl || (depth0 != null ? depth0.validatorUrl : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"validatorUrl","hash":{},"data":data}) : helper)))
  269. + "/debug?url="
  270. + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
  271. + "\"><img id=\"validator\" src=\""
  272. + escapeExpression(((helper = (helper = helpers.validatorUrl || (depth0 != null ? depth0.validatorUrl : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"validatorUrl","hash":{},"data":data}) : helper)))
  273. + "?url="
  274. + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
  275. + "\"></a>\n </span>\n";
  276. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  277. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div class='info' id='api_info'>\n";
  278. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.info : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
  279. if (stack1 != null) { buffer += stack1; }
  280. buffer += "</div>\n<div class='container' id='resources_container'>\n <ul id='resources'></ul>\n\n <div class=\"footer\">\n <br>\n <br>\n <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: "
  281. + escapeExpression(((helper = (helper = helpers.basePath || (depth0 != null ? depth0.basePath : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"basePath","hash":{},"data":data}) : helper)))
  282. + "\n";
  283. stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), {"name":"if","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data});
  284. if (stack1 != null) { buffer += stack1; }
  285. buffer += "]\n";
  286. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.validatorUrl : depth0), {"name":"if","hash":{},"fn":this.program(16, data),"inverse":this.noop,"data":data});
  287. if (stack1 != null) { buffer += stack1; }
  288. return buffer + " </h4>\n </div>\n</div>\n";
  289. },"useData":true});
  290. this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  291. return "deprecated";
  292. },"3":function(depth0,helpers,partials,data) {
  293. return " <h4>Warning: Deprecated</h4>\n";
  294. },"5":function(depth0,helpers,partials,data) {
  295. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, buffer = " <h4>Implementation Notes</h4>\n <p class=\"markdown\">";
  296. stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
  297. if (stack1 != null) { buffer += stack1; }
  298. return buffer + "</p>\n";
  299. },"7":function(depth0,helpers,partials,data) {
  300. return " <div class=\"auth\">\n <span class=\"api-ic ic-error\"></span>";
  301. },"9":function(depth0,helpers,partials,data) {
  302. var stack1, buffer = " <div id=\"api_information_panel\" style=\"top: 526px; left: 776px; display: none;\">\n";
  303. stack1 = helpers.each.call(depth0, depth0, {"name":"each","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
  304. if (stack1 != null) { buffer += stack1; }
  305. return buffer + " </div>\n";
  306. },"10":function(depth0,helpers,partials,data) {
  307. var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div title='";
  308. stack1 = lambda((depth0 != null ? depth0.description : depth0), depth0);
  309. if (stack1 != null) { buffer += stack1; }
  310. return buffer + "'>"
  311. + escapeExpression(lambda((depth0 != null ? depth0.scope : depth0), depth0))
  312. + "</div>\n";
  313. },"12":function(depth0,helpers,partials,data) {
  314. return "</div>";
  315. },"14":function(depth0,helpers,partials,data) {
  316. return " <div class='access'>\n <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n </div>\n";
  317. },"16":function(depth0,helpers,partials,data) {
  318. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  319. return " <h4>Response Class (Status "
  320. + escapeExpression(((helper = (helper = helpers.successCode || (depth0 != null ? depth0.successCode : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"successCode","hash":{},"data":data}) : helper)))
  321. + ")</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n";
  322. },"18":function(depth0,helpers,partials,data) {
  323. return " <h4>Parameters</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th style=\"width: 100px; max-width: 100px\">Parameter</th>\n <th style=\"width: 310px; max-width: 310px\">Value</th>\n <th style=\"width: 200px; max-width: 200px\">Description</th>\n <th style=\"width: 100px; max-width: 100px\">Parameter Type</th>\n <th style=\"width: 220px; max-width: 230px\">Data Type</th>\n </tr>\n </thead>\n <tbody class=\"operation-params\">\n\n </tbody>\n </table>\n";
  324. },"20":function(depth0,helpers,partials,data) {
  325. return " <div style='margin:0;padding:0;display:inline'></div>\n <h4>Response Messages</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n <th>Response Model</th>\n <th>Headers</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n\n </tbody>\n </table>\n";
  326. },"22":function(depth0,helpers,partials,data) {
  327. return "";
  328. },"24":function(depth0,helpers,partials,data) {
  329. return " <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <span class='response_throbber' style='display:none'></span>\n </div>\n";
  330. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  331. var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "\n <ul class='operations' >\n <li class='"
  332. + escapeExpression(((helper = (helper = helpers.method || (depth0 != null ? depth0.method : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"method","hash":{},"data":data}) : helper)))
  333. + " operation' id='"
  334. + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
  335. + "_"
  336. + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
  337. + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/"
  338. + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
  339. + "/"
  340. + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
  341. + "' class=\"toggleOperation\">"
  342. + escapeExpression(((helper = (helper = helpers.method || (depth0 != null ? depth0.method : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"method","hash":{},"data":data}) : helper)))
  343. + "</a>\n </span>\n <span class='path'>\n <a href='#!/"
  344. + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
  345. + "/"
  346. + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
  347. + "' class=\"toggleOperation ";
  348. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
  349. if (stack1 != null) { buffer += stack1; }
  350. buffer += "\">"
  351. + escapeExpression(((helper = (helper = helpers.path || (depth0 != null ? depth0.path : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"path","hash":{},"data":data}) : helper)))
  352. + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/"
  353. + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
  354. + "/"
  355. + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
  356. + "' class=\"toggleOperation\">";
  357. stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"summary","hash":{},"data":data}) : helper));
  358. if (stack1 != null) { buffer += stack1; }
  359. buffer += "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='"
  360. + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
  361. + "_"
  362. + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
  363. + "_content' style='display:none'>\n";
  364. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data});
  365. if (stack1 != null) { buffer += stack1; }
  366. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.description : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.noop,"data":data});
  367. if (stack1 != null) { buffer += stack1; }
  368. stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(7, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
  369. if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  370. if (stack1 != null) { buffer += stack1; }
  371. buffer += "\n";
  372. stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.oauth : depth0), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
  373. if (stack1 != null) { buffer += stack1; }
  374. buffer += " ";
  375. stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(12, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
  376. if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  377. if (stack1 != null) { buffer += stack1; }
  378. buffer += "\n";
  379. stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
  380. if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  381. if (stack1 != null) { buffer += stack1; }
  382. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.type : depth0), {"name":"if","hash":{},"fn":this.program(16, data),"inverse":this.noop,"data":data});
  383. if (stack1 != null) { buffer += stack1; }
  384. buffer += " <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n";
  385. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.parameters : depth0), {"name":"if","hash":{},"fn":this.program(18, data),"inverse":this.noop,"data":data});
  386. if (stack1 != null) { buffer += stack1; }
  387. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.responseMessages : depth0), {"name":"if","hash":{},"fn":this.program(20, data),"inverse":this.noop,"data":data});
  388. if (stack1 != null) { buffer += stack1; }
  389. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isReadOnly : depth0), {"name":"if","hash":{},"fn":this.program(22, data),"inverse":this.program(24, data),"data":data});
  390. if (stack1 != null) { buffer += stack1; }
  391. return buffer + " </form>\n <div class='response' style='display:none'>\n <h4>Request URL</h4>\n <div class='block request_url'></div>\n <h4>Response Body</h4>\n <div class='block response_body'></div>\n <h4>Response Code</h4>\n <div class='block response_code'></div>\n <h4>Response Headers</h4>\n <div class='block response_headers'></div>\n </div>\n </div>\n </li>\n </ul>\n";
  392. },"useData":true});
  393. this["Handlebars"]["templates"]["param_list"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  394. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  395. return "<td class='code required'>"
  396. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  397. + "</td>\n";
  398. },"3":function(depth0,helpers,partials,data) {
  399. return " multiple='multiple'";
  400. },"5":function(depth0,helpers,partials,data) {
  401. return "";
  402. },"7":function(depth0,helpers,partials,data) {
  403. var stack1, buffer = "";
  404. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(8, data),"data":data});
  405. if (stack1 != null) { buffer += stack1; }
  406. return buffer;
  407. },"8":function(depth0,helpers,partials,data) {
  408. var stack1, helperMissing=helpers.helperMissing, buffer = "";
  409. stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(5, data),"inverse":this.program(9, data),"data":data}));
  410. if (stack1 != null) { buffer += stack1; }
  411. return buffer;
  412. },"9":function(depth0,helpers,partials,data) {
  413. return " <option selected=\"\" value=''></option>\n";
  414. },"11":function(depth0,helpers,partials,data) {
  415. var stack1, buffer = "";
  416. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isDefault : depth0), {"name":"if","hash":{},"fn":this.program(12, data),"inverse":this.program(14, data),"data":data});
  417. if (stack1 != null) { buffer += stack1; }
  418. return buffer;
  419. },"12":function(depth0,helpers,partials,data) {
  420. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  421. return " <option selected=\"\" value='"
  422. + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
  423. + "'>"
  424. + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
  425. + " (default)</option>\n";
  426. },"14":function(depth0,helpers,partials,data) {
  427. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  428. return " <option value='"
  429. + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
  430. + "'>"
  431. + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
  432. + "</option>\n";
  433. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  434. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "";
  435. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
  436. if (stack1 != null) { buffer += stack1; }
  437. buffer += "<td class='code'>"
  438. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  439. + "</td>\n<td>\n <select ";
  440. stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data}));
  441. if (stack1 != null) { buffer += stack1; }
  442. buffer += " class='parameter' name='"
  443. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  444. + "'>\n";
  445. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
  446. if (stack1 != null) { buffer += stack1; }
  447. stack1 = helpers.each.call(depth0, ((stack1 = (depth0 != null ? depth0.allowableValues : depth0)) != null ? stack1.descriptiveValues : stack1), {"name":"each","hash":{},"fn":this.program(11, data),"inverse":this.noop,"data":data});
  448. if (stack1 != null) { buffer += stack1; }
  449. buffer += " </select>\n</td>\n<td class=\"markdown\">";
  450. stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
  451. if (stack1 != null) { buffer += stack1; }
  452. buffer += "</td>\n<td>";
  453. stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
  454. if (stack1 != null) { buffer += stack1; }
  455. return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>";
  456. },"useData":true});
  457. this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  458. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  459. return " <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
  460. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  461. + "'>"
  462. + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
  463. + "</textarea>\n";
  464. },"3":function(depth0,helpers,partials,data) {
  465. var stack1, buffer = "";
  466. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
  467. if (stack1 != null) { buffer += stack1; }
  468. return buffer;
  469. },"4":function(depth0,helpers,partials,data) {
  470. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  471. return " "
  472. + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
  473. + "\n";
  474. },"6":function(depth0,helpers,partials,data) {
  475. return " (empty)\n";
  476. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  477. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
  478. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  479. + "</td>\n<td>\n";
  480. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
  481. if (stack1 != null) { buffer += stack1; }
  482. buffer += "</td>\n<td class=\"markdown\">";
  483. stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
  484. if (stack1 != null) { buffer += stack1; }
  485. buffer += "</td>\n<td>";
  486. stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
  487. if (stack1 != null) { buffer += stack1; }
  488. return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
  489. },"useData":true});
  490. this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  491. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  492. return " <textarea class='body-textarea' readonly='readonly' name='"
  493. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  494. + "'>"
  495. + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
  496. + "</textarea>\n";
  497. },"3":function(depth0,helpers,partials,data) {
  498. var stack1, buffer = "";
  499. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
  500. if (stack1 != null) { buffer += stack1; }
  501. return buffer;
  502. },"4":function(depth0,helpers,partials,data) {
  503. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  504. return " "
  505. + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
  506. + "\n";
  507. },"6":function(depth0,helpers,partials,data) {
  508. return " (empty)\n";
  509. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  510. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
  511. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  512. + "</td>\n<td>\n";
  513. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
  514. if (stack1 != null) { buffer += stack1; }
  515. buffer += "</td>\n<td class=\"markdown\">";
  516. stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
  517. if (stack1 != null) { buffer += stack1; }
  518. buffer += "</td>\n<td>";
  519. stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
  520. if (stack1 != null) { buffer += stack1; }
  521. return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
  522. },"useData":true});
  523. this["Handlebars"]["templates"]["param_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  524. var stack1, buffer = "";
  525. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
  526. if (stack1 != null) { buffer += stack1; }
  527. return buffer;
  528. },"2":function(depth0,helpers,partials,data) {
  529. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  530. return " <input type=\"file\" name='"
  531. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  532. + "'/>\n";
  533. },"4":function(depth0,helpers,partials,data) {
  534. var stack1, buffer = "";
  535. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
  536. if (stack1 != null) { buffer += stack1; }
  537. return buffer;
  538. },"5":function(depth0,helpers,partials,data) {
  539. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  540. return " <textarea class='body-textarea required' placeholder='(required)' name='"
  541. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  542. + "'>"
  543. + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
  544. + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
  545. },"7":function(depth0,helpers,partials,data) {
  546. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  547. return " <textarea class='body-textarea required' placeholder='(required)' name='"
  548. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  549. + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
  550. },"9":function(depth0,helpers,partials,data) {
  551. var stack1, buffer = "";
  552. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
  553. if (stack1 != null) { buffer += stack1; }
  554. return buffer;
  555. },"10":function(depth0,helpers,partials,data) {
  556. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  557. return " <input class='parameter' class='required' type='file' name='"
  558. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  559. + "'/>\n";
  560. },"12":function(depth0,helpers,partials,data) {
  561. var stack1, buffer = "";
  562. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(13, data),"inverse":this.program(15, data),"data":data});
  563. if (stack1 != null) { buffer += stack1; }
  564. return buffer;
  565. },"13":function(depth0,helpers,partials,data) {
  566. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  567. return " <input class='parameter required' minlength='1' name='"
  568. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  569. + "' placeholder='(required)' type='text' value='"
  570. + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
  571. + "'/>\n";
  572. },"15":function(depth0,helpers,partials,data) {
  573. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  574. return " <input class='parameter required' minlength='1' name='"
  575. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  576. + "' placeholder='(required)' type='text' value=''/>\n";
  577. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  578. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
  579. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  580. + "</td>\n<td>\n";
  581. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
  582. if (stack1 != null) { buffer += stack1; }
  583. buffer += "</td>\n<td>\n <strong><span class=\"markdown\">";
  584. stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
  585. if (stack1 != null) { buffer += stack1; }
  586. buffer += "</span></strong>\n</td>\n<td>";
  587. stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
  588. if (stack1 != null) { buffer += stack1; }
  589. return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
  590. },"useData":true});
  591. this["Handlebars"]["templates"]["param"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  592. var stack1, buffer = "";
  593. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
  594. if (stack1 != null) { buffer += stack1; }
  595. return buffer;
  596. },"2":function(depth0,helpers,partials,data) {
  597. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  598. return " <input type=\"file\" name='"
  599. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  600. + "'/>\n <div class=\"parameter-content-type\" />\n";
  601. },"4":function(depth0,helpers,partials,data) {
  602. var stack1, buffer = "";
  603. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
  604. if (stack1 != null) { buffer += stack1; }
  605. return buffer;
  606. },"5":function(depth0,helpers,partials,data) {
  607. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  608. return " <textarea class='body-textarea' name='"
  609. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  610. + "'>"
  611. + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
  612. + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
  613. },"7":function(depth0,helpers,partials,data) {
  614. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  615. return " <textarea class='body-textarea' name='"
  616. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  617. + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
  618. },"9":function(depth0,helpers,partials,data) {
  619. var stack1, buffer = "";
  620. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(10, data),"data":data});
  621. if (stack1 != null) { buffer += stack1; }
  622. return buffer;
  623. },"10":function(depth0,helpers,partials,data) {
  624. var stack1, buffer = "";
  625. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(11, data),"inverse":this.program(13, data),"data":data});
  626. if (stack1 != null) { buffer += stack1; }
  627. return buffer;
  628. },"11":function(depth0,helpers,partials,data) {
  629. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  630. return " <input class='parameter' minlength='0' name='"
  631. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  632. + "' placeholder='' type='text' value='"
  633. + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
  634. + "'/>\n";
  635. },"13":function(depth0,helpers,partials,data) {
  636. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  637. return " <input class='parameter' minlength='0' name='"
  638. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  639. + "' placeholder='' type='text' value=''/>\n";
  640. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  641. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
  642. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  643. + "</td>\n<td>\n\n";
  644. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
  645. if (stack1 != null) { buffer += stack1; }
  646. buffer += "\n</td>\n<td class=\"markdown\">";
  647. stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
  648. if (stack1 != null) { buffer += stack1; }
  649. buffer += "</td>\n<td>";
  650. stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
  651. if (stack1 != null) { buffer += stack1; }
  652. return buffer + "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n";
  653. },"useData":true});
  654. this["Handlebars"]["templates"]["parameter_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  655. var stack1, buffer = "";
  656. stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
  657. if (stack1 != null) { buffer += stack1; }
  658. return buffer;
  659. },"2":function(depth0,helpers,partials,data) {
  660. var stack1, lambda=this.lambda, buffer = " <option value=\"";
  661. stack1 = lambda(depth0, depth0);
  662. if (stack1 != null) { buffer += stack1; }
  663. buffer += "\">";
  664. stack1 = lambda(depth0, depth0);
  665. if (stack1 != null) { buffer += stack1; }
  666. return buffer + "</option>\n";
  667. },"4":function(depth0,helpers,partials,data) {
  668. return " <option value=\"application/json\">application/json</option>\n";
  669. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  670. var stack1, buffer = "<label for=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
  671. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
  672. if (stack1 != null) { buffer += stack1; }
  673. return buffer + "</select>\n";
  674. },"useData":true});
  675. this["Handlebars"]["templates"]["resource"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  676. return " : ";
  677. },"3":function(depth0,helpers,partials,data) {
  678. var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
  679. return " <li>\n <a href='"
  680. + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
  681. + "'>Raw</a>\n </li>\n";
  682. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  683. var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "<div class='heading'>\n <h2>\n <a href='#!/"
  684. + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
  685. + "' class=\"toggleEndpointList\" data-id=\""
  686. + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
  687. + "\">"
  688. + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
  689. + "</a> ";
  690. stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(options={"name":"summary","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
  691. if (!helpers.summary) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  692. if (stack1 != null) { buffer += stack1; }
  693. stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"summary","hash":{},"data":data}) : helper));
  694. if (stack1 != null) { buffer += stack1; }
  695. buffer += "\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/"
  696. + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
  697. + "' id='endpointListTogger_"
  698. + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
  699. + "' class=\"toggleEndpointList\" data-id=\""
  700. + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
  701. + "\">Show/Hide</a>\n </li>\n <li>\n <a href='#' class=\"collapseResource\" data-id=\""
  702. + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
  703. + "\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' class=\"expandResource\" data-id=\""
  704. + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
  705. + "\">\n Expand Operations\n </a>\n </li>\n";
  706. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.url : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data});
  707. if (stack1 != null) { buffer += stack1; }
  708. return buffer + " </ul>\n</div>\n<ul class='endpoints' id='"
  709. + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
  710. + "_endpoint_list' style='display:none'>\n\n</ul>\n";
  711. },"useData":true});
  712. this["Handlebars"]["templates"]["response_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  713. var stack1, buffer = "";
  714. stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
  715. if (stack1 != null) { buffer += stack1; }
  716. return buffer;
  717. },"2":function(depth0,helpers,partials,data) {
  718. var stack1, lambda=this.lambda, buffer = " <option value=\"";
  719. stack1 = lambda(depth0, depth0);
  720. if (stack1 != null) { buffer += stack1; }
  721. buffer += "\">";
  722. stack1 = lambda(depth0, depth0);
  723. if (stack1 != null) { buffer += stack1; }
  724. return buffer + "</option>\n";
  725. },"4":function(depth0,helpers,partials,data) {
  726. return " <option value=\"application/json\">application/json</option>\n";
  727. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  728. var stack1, buffer = "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
  729. stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
  730. if (stack1 != null) { buffer += stack1; }
  731. return buffer + "</select>\n";
  732. },"useData":true});
  733. this["Handlebars"]["templates"]["signature"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  734. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div>\n<ul class=\"signature-nav\">\n <li><a class=\"description-link\" href=\"#\">Model</a></li>\n <li><a class=\"snippet-link\" href=\"#\">Model Schema</a></li>\n</ul>\n<div>\n\n<div class=\"signature-container\">\n <div class=\"description\">\n ";
  735. stack1 = ((helper = (helper = helpers.signature || (depth0 != null ? depth0.signature : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signature","hash":{},"data":data}) : helper));
  736. if (stack1 != null) { buffer += stack1; }
  737. return buffer + "\n </div>\n\n <div class=\"snippet\">\n <pre><code>"
  738. + escapeExpression(((helper = (helper = helpers.sampleJSON || (depth0 != null ? depth0.sampleJSON : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"sampleJSON","hash":{},"data":data}) : helper)))
  739. + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
  740. },"useData":true});
  741. this["Handlebars"]["templates"]["status_code"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
  742. var lambda=this.lambda, escapeExpression=this.escapeExpression;
  743. return " <tr>\n <td>"
  744. + escapeExpression(lambda((data && data.key), depth0))
  745. + "</td>\n <td>"
  746. + escapeExpression(lambda((depth0 != null ? depth0.description : depth0), depth0))
  747. + "</td>\n <td>"
  748. + escapeExpression(lambda((depth0 != null ? depth0.type : depth0), depth0))
  749. + "</td>\n </tr>\n";
  750. },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
  751. var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td width='15%' class='code'>"
  752. + escapeExpression(((helper = (helper = helpers.code || (depth0 != null ? depth0.code : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"code","hash":{},"data":data}) : helper)))
  753. + "</td>\n<td>";
  754. stack1 = ((helper = (helper = helpers.message || (depth0 != null ? depth0.message : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"message","hash":{},"data":data}) : helper));
  755. if (stack1 != null) { buffer += stack1; }
  756. buffer += "</td>\n<td width='50%'><span class=\"model-signature\" /></td>\n<td class=\"headers\">\n <table>\n <tbody>\n";
  757. stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.headers : depth0), {"name":"each","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
  758. if (stack1 != null) { buffer += stack1; }
  759. return buffer + " </tbody>\n </table>\n</td>";
  760. },"useData":true});
  761. var SwaggerUi,
  762. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  763. hasProp = {}.hasOwnProperty;
  764. SwaggerUi = (function(superClass) {
  765. extend(SwaggerUi, superClass);
  766. function SwaggerUi() {
  767. return SwaggerUi.__super__.constructor.apply(this, arguments);
  768. }
  769. SwaggerUi.prototype.domEl = $('#swagger_ui');
  770. SwaggerUi.prototype.options = null;
  771. SwaggerUi.prototype.api = null;
  772. SwaggerUi.prototype.headerView = null;
  773. SwaggerUi.prototype.mainView = null;
  774. SwaggerUi.prototype.initialize = function(options) {
  775. if (options == null) {
  776. options = {};
  777. }
  778. if (options.dom_id != null) {
  779. this.domEl = $('#' + options.dom_id);
  780. delete options.dom_id;
  781. } else if (options.domEl != null) {
  782. this.domEl = options.domEl;
  783. }
  784. if (options.supportedSubmitMethods == null) {
  785. options.supportedSubmitMethods = ['get', 'put', 'post', 'delete', 'head', 'options', 'patch'];
  786. }
  787. this.domEl = $(this.domEl);
  788. if (!$.contains(document.documentElement, this.domEl.get(0))) {
  789. $('body').append(this.domEl);
  790. }
  791. this.options = options;
  792. marked.setOptions({
  793. gfm: true
  794. });
  795. this.options.success = (function(_this) {
  796. return function() {
  797. return _this.render();
  798. };
  799. })(this);
  800. this.options.progress = (function(_this) {
  801. return function(d) {
  802. return _this.showMessage(d);
  803. };
  804. })(this);
  805. this.options.failure = (function(_this) {
  806. return function(d) {
  807. return _this.onLoadFailure(d);
  808. };
  809. })(this);
  810. if ($('#header').length) {
  811. this.headerView = new HeaderView({
  812. el: $('#header')
  813. });
  814. return this.headerView.on('update-swagger-ui', (function(_this) {
  815. return function(data) {
  816. return _this.updateSwaggerUi(data);
  817. };
  818. })(this));
  819. }
  820. };
  821. SwaggerUi.prototype.setOption = function(option, value) {
  822. return this.options[option] = value;
  823. };
  824. SwaggerUi.prototype.getOption = function(option) {
  825. return this.options[option];
  826. };
  827. SwaggerUi.prototype.updateSwaggerUi = function(data) {
  828. this.options.url = data.url;
  829. return this.load();
  830. };
  831. SwaggerUi.prototype.load = function() {
  832. var ref, url;
  833. if ((ref = this.mainView) != null) {
  834. ref.clear();
  835. }
  836. url = this.options.url;
  837. if (url && url.indexOf("http") !== 0) {
  838. url = this.buildUrl(window.location.href.toString(), url);
  839. }
  840. this.options.url = url;
  841. if (this.headerView) {
  842. this.headerView.update(url);
  843. }
  844. return this.api = new SwaggerClient(this.options);
  845. };
  846. SwaggerUi.prototype.collapseAll = function() {
  847. return Docs.collapseEndpointListForResource('');
  848. };
  849. SwaggerUi.prototype.listAll = function() {
  850. return Docs.collapseOperationsForResource('');
  851. };
  852. SwaggerUi.prototype.expandAll = function() {
  853. return Docs.expandOperationsForResource('');
  854. };
  855. SwaggerUi.prototype.render = function() {
  856. this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
  857. this.mainView = new MainView({
  858. model: this.api,
  859. el: this.domEl,
  860. swaggerOptions: this.options,
  861. router: this
  862. }).render();
  863. this.showMessage();
  864. switch (this.options.docExpansion) {
  865. case "full":
  866. this.expandAll();
  867. break;
  868. case "list":
  869. this.listAll();
  870. }
  871. this.renderGFM();
  872. if (this.options.onComplete) {
  873. this.options.onComplete(this.api, this);
  874. }
  875. return setTimeout((function(_this) {
  876. return function() {
  877. return Docs.shebang();
  878. };
  879. })(this), 100);
  880. };
  881. SwaggerUi.prototype.buildUrl = function(base, url) {
  882. var endOfPath, parts;
  883. if (url.indexOf("/") === 0) {
  884. parts = base.split("/");
  885. base = parts[0] + "//" + parts[2];
  886. return base + url;
  887. } else {
  888. endOfPath = base.length;
  889. if (base.indexOf("?") > -1) {
  890. endOfPath = Math.min(endOfPath, base.indexOf("?"));
  891. }
  892. if (base.indexOf("#") > -1) {
  893. endOfPath = Math.min(endOfPath, base.indexOf("#"));
  894. }
  895. base = base.substring(0, endOfPath);
  896. if (base.indexOf("/", base.length - 1) !== -1) {
  897. return base + url;
  898. }
  899. return base + "/" + url;
  900. }
  901. };
  902. SwaggerUi.prototype.showMessage = function(data) {
  903. if (data == null) {
  904. data = '';
  905. }
  906. $('#message-bar').removeClass('message-fail');
  907. $('#message-bar').addClass('message-success');
  908. return $('#message-bar').html(data);
  909. };
  910. SwaggerUi.prototype.onLoadFailure = function(data) {
  911. var val;
  912. if (data == null) {
  913. data = '';
  914. }
  915. $('#message-bar').removeClass('message-success');
  916. $('#message-bar').addClass('message-fail');
  917. val = $('#message-bar').html(data);
  918. if (this.options.onFailure != null) {
  919. this.options.onFailure(data);
  920. }
  921. return val;
  922. };
  923. SwaggerUi.prototype.renderGFM = function(data) {
  924. if (data == null) {
  925. data = '';
  926. }
  927. return $('.markdown').each(function(index) {
  928. return $(this).html(marked($(this).html()));
  929. });
  930. };
  931. return SwaggerUi;
  932. })(Backbone.Router);
  933. window.SwaggerUi = SwaggerUi;
  934. var ApiKeyButton,
  935. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  936. hasProp = {}.hasOwnProperty;
  937. ApiKeyButton = (function(superClass) {
  938. extend(ApiKeyButton, superClass);
  939. function ApiKeyButton() {
  940. return ApiKeyButton.__super__.constructor.apply(this, arguments);
  941. }
  942. ApiKeyButton.prototype.initialize = function() {};
  943. ApiKeyButton.prototype.render = function() {
  944. var template;
  945. template = this.template();
  946. $(this.el).html(template(this.model));
  947. return this;
  948. };
  949. ApiKeyButton.prototype.events = {
  950. "click #apikey_button": "toggleApiKeyContainer",
  951. "click #apply_api_key": "applyApiKey"
  952. };
  953. ApiKeyButton.prototype.applyApiKey = function() {
  954. var elem;
  955. window.authorizations.add(this.model.name, new ApiKeyAuthorization(this.model.name, $("#input_apiKey_entry").val(), this.model["in"]));
  956. window.swaggerUi.load();
  957. return elem = $('#apikey_container').show();
  958. };
  959. ApiKeyButton.prototype.toggleApiKeyContainer = function() {
  960. var elem;
  961. if ($('#apikey_container').length > 0) {
  962. elem = $('#apikey_container').first();
  963. if (elem.is(':visible')) {
  964. return elem.hide();
  965. } else {
  966. $('.auth_container').hide();
  967. return elem.show();
  968. }
  969. }
  970. };
  971. ApiKeyButton.prototype.template = function() {
  972. return Handlebars.templates.apikey_button_view;
  973. };
  974. return ApiKeyButton;
  975. })(Backbone.View);
  976. var BasicAuthButton,
  977. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  978. hasProp = {}.hasOwnProperty;
  979. BasicAuthButton = (function(superClass) {
  980. extend(BasicAuthButton, superClass);
  981. function BasicAuthButton() {
  982. return BasicAuthButton.__super__.constructor.apply(this, arguments);
  983. }
  984. BasicAuthButton.prototype.initialize = function() {};
  985. BasicAuthButton.prototype.render = function() {
  986. var template;
  987. template = this.template();
  988. $(this.el).html(template(this.model));
  989. return this;
  990. };
  991. BasicAuthButton.prototype.events = {
  992. "click #basic_auth_button": "togglePasswordContainer",
  993. "click #apply_basic_auth": "applyPassword"
  994. };
  995. BasicAuthButton.prototype.applyPassword = function() {
  996. var elem, password, username;
  997. username = $(".input_username").val();
  998. password = $(".input_password").val();
  999. window.authorizations.add(this.model.type, new PasswordAuthorization("basic", username, password));
  1000. window.swaggerUi.load();
  1001. return elem = $('#basic_auth_container').hide();
  1002. };
  1003. BasicAuthButton.prototype.togglePasswordContainer = function() {
  1004. var elem;
  1005. if ($('#basic_auth_container').length > 0) {
  1006. elem = $('#basic_auth_container').show();
  1007. if (elem.is(':visible')) {
  1008. return elem.slideUp();
  1009. } else {
  1010. $('.auth_container').hide();
  1011. return elem.show();
  1012. }
  1013. }
  1014. };
  1015. BasicAuthButton.prototype.template = function() {
  1016. return Handlebars.templates.basic_auth_button_view;
  1017. };
  1018. return BasicAuthButton;
  1019. })(Backbone.View);
  1020. var ContentTypeView,
  1021. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  1022. hasProp = {}.hasOwnProperty;
  1023. ContentTypeView = (function(superClass) {
  1024. extend(ContentTypeView, superClass);
  1025. function ContentTypeView() {
  1026. return ContentTypeView.__super__.constructor.apply(this, arguments);
  1027. }
  1028. ContentTypeView.prototype.initialize = function() {};
  1029. ContentTypeView.prototype.render = function() {
  1030. var template;
  1031. template = this.template();
  1032. $(this.el).html(template(this.model));
  1033. $('label[for=contentType]', $(this.el)).text('Response Content Type');
  1034. return this;
  1035. };
  1036. ContentTypeView.prototype.template = function() {
  1037. return Handlebars.templates.content_type;
  1038. };
  1039. return ContentTypeView;
  1040. })(Backbone.View);
  1041. var HeaderView,
  1042. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  1043. hasProp = {}.hasOwnProperty;
  1044. HeaderView = (function(superClass) {
  1045. extend(HeaderView, superClass);
  1046. function HeaderView() {
  1047. return HeaderView.__super__.constructor.apply(this, arguments);
  1048. }
  1049. HeaderView.prototype.events = {
  1050. 'click #show-pet-store-icon': 'showPetStore',
  1051. 'click #show-wordnik-dev-icon': 'showWordnikDev',
  1052. 'click #explore': 'showCustom',
  1053. 'keyup #input_baseUrl': 'showCustomOnKeyup',
  1054. 'keyup #input_apiKey': 'showCustomOnKeyup'
  1055. };
  1056. HeaderView.prototype.initialize = function() {};
  1057. HeaderView.prototype.showPetStore = function(e) {
  1058. return this.trigger('update-swagger-ui', {
  1059. url: "http://petstore.swagger.wordnik.com/api/api-docs"
  1060. });
  1061. };
  1062. HeaderView.prototype.showWordnikDev = function(e) {
  1063. return this.trigger('update-swagger-ui', {
  1064. url: "http://api.wordnik.com/v4/resources.json"
  1065. });
  1066. };
  1067. HeaderView.prototype.showCustomOnKeyup = function(e) {
  1068. if (e.keyCode === 13) {
  1069. return this.showCustom();
  1070. }
  1071. };
  1072. HeaderView.prototype.showCustom = function(e) {
  1073. if (e != null) {
  1074. e.preventDefault();
  1075. }
  1076. return this.trigger('update-swagger-ui', {
  1077. url: $('#input_baseUrl').val(),
  1078. apiKey: $('#input_apiKey').val()
  1079. });
  1080. };
  1081. HeaderView.prototype.update = function(url, apiKey, trigger) {
  1082. if (trigger == null) {
  1083. trigger = false;
  1084. }
  1085. $('#input_baseUrl').val(url);
  1086. if (trigger) {
  1087. return this.trigger('update-swagger-ui', {
  1088. url: url
  1089. });
  1090. }
  1091. };
  1092. return HeaderView;
  1093. })(Backbone.View);
  1094. var MainView,
  1095. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  1096. hasProp = {}.hasOwnProperty;
  1097. MainView = (function(superClass) {
  1098. var sorters;
  1099. extend(MainView, superClass);
  1100. function MainView() {
  1101. return MainView.__super__.constructor.apply(this, arguments);
  1102. }
  1103. sorters = {
  1104. 'alpha': function(a, b) {
  1105. return a.path.localeCompare(b.path);
  1106. },
  1107. 'method': function(a, b) {
  1108. return a.method.localeCompare(b.method);
  1109. }
  1110. };
  1111. MainView.prototype.initialize = function(opts) {
  1112. var auth, key, ref, value;
  1113. if (opts == null) {
  1114. opts = {};
  1115. }
  1116. this.model.auths = [];
  1117. ref = this.model.securityDefinitions;
  1118. for (key in ref) {
  1119. value = ref[key];
  1120. auth = {
  1121. name: key,
  1122. type: value.type,
  1123. value: value
  1124. };
  1125. this.model.auths.push(auth);
  1126. }
  1127. if (this.model.swaggerVersion === "2.0") {
  1128. if ("validatorUrl" in opts.swaggerOptions) {
  1129. return this.model.validatorUrl = opts.swaggerOptions.validatorUrl;
  1130. } else if (this.model.url.indexOf("localhost") > 0) {
  1131. return this.model.validatorUrl = null;
  1132. } else {
  1133. return this.model.validatorUrl = "http://online.swagger.io/validator";
  1134. }
  1135. }
  1136. };
  1137. MainView.prototype.render = function() {
  1138. var auth, button, counter, i, id, len, name, ref, resource, resources;
  1139. if (this.model.securityDefinitions) {
  1140. for (name in this.model.securityDefinitions) {
  1141. auth = this.model.securityDefinitions[name];
  1142. if (auth.type === "apiKey" && $("#apikey_button").length === 0) {
  1143. button = new ApiKeyButton({
  1144. model: auth
  1145. }).render().el;
  1146. $('.auth_main_container').append(button);
  1147. }
  1148. if (auth.type === "basicAuth" && $("#basic_auth_button").length === 0) {
  1149. button = new BasicAuthButton({
  1150. model: auth
  1151. }).render().el;
  1152. $('.auth_main_container').append(button);
  1153. }
  1154. }
  1155. }
  1156. $(this.el).html(Handlebars.templates.main(this.model));
  1157. resources = {};
  1158. counter = 0;
  1159. ref = this.model.apisArray;
  1160. for (i = 0, len = ref.length; i < len; i++) {
  1161. resource = ref[i];
  1162. id = resource.name;
  1163. while (typeof resources[id] !== 'undefined') {
  1164. id = id + "_" + counter;
  1165. counter += 1;
  1166. }
  1167. resource.id = id;
  1168. resources[id] = resource;
  1169. this.addResource(resource, this.model.auths);
  1170. }
  1171. $('.propWrap').hover(function() {
  1172. return $('.optionsWrapper', $(this)).show();
  1173. }, function() {
  1174. return $('.optionsWrapper', $(this)).hide();
  1175. });
  1176. return this;
  1177. };
  1178. MainView.prototype.addResource = function(resource, auths) {
  1179. var resourceView;
  1180. resource.id = resource.id.replace(/\s/g, '_');
  1181. resourceView = new ResourceView({
  1182. model: resource,
  1183. tagName: 'li',
  1184. id: 'resource_' + resource.id,
  1185. className: 'resource',
  1186. auths: auths,
  1187. swaggerOptions: this.options.swaggerOptions,
  1188. parent: this
  1189. });
  1190. return $('#resources', this.el).append(resourceView.render().el);
  1191. };
  1192. MainView.prototype.clear = function() {
  1193. return $(this.el).html('');
  1194. };
  1195. return MainView;
  1196. })(Backbone.View);
  1197. var OperationView,
  1198. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  1199. hasProp = {}.hasOwnProperty;
  1200. OperationView = (function(superClass) {
  1201. extend(OperationView, superClass);
  1202. function OperationView() {
  1203. return OperationView.__super__.constructor.apply(this, arguments);
  1204. }
  1205. OperationView.prototype.invocationUrl = null;
  1206. OperationView.prototype.events = {
  1207. 'submit .sandbox': 'submitOperation',
  1208. 'click .submit': 'submitOperation',
  1209. 'click .response_hider': 'hideResponse',
  1210. 'click .toggleOperation': 'toggleOperationContent',
  1211. 'mouseenter .api-ic': 'mouseEnter',
  1212. 'mouseout .api-ic': 'mouseExit'
  1213. };
  1214. OperationView.prototype.initialize = function(opts) {
  1215. if (opts == null) {
  1216. opts = {};
  1217. }
  1218. this.auths = opts.auths;
  1219. this.parentId = this.model.parentId;
  1220. this.nickname = this.model.nickname;
  1221. return this;
  1222. };
  1223. OperationView.prototype.mouseEnter = function(e) {
  1224. var elem, hgh, pos, scMaxX, scMaxY, scX, scY, wd, x, y;
  1225. elem = $(this.el).find('.content');
  1226. x = e.pageX;
  1227. y = e.pageY;
  1228. scX = $(window).scrollLeft();
  1229. scY = $(window).scrollTop();
  1230. scMaxX = scX + $(window).width();
  1231. scMaxY = scY + $(window).height();
  1232. wd = elem.width();
  1233. hgh = elem.height();
  1234. if (x + wd > scMaxX) {
  1235. x = scMaxX - wd;
  1236. }
  1237. if (x < scX) {
  1238. x = scX;
  1239. }
  1240. if (y + hgh > scMaxY) {
  1241. y = scMaxY - hgh;
  1242. }
  1243. if (y < scY) {
  1244. y = scY;
  1245. }
  1246. pos = {};
  1247. pos.top = y;
  1248. pos.left = x;
  1249. elem.css(pos);
  1250. return $(e.currentTarget.parentNode).find('#api_information_panel').show();
  1251. };
  1252. OperationView.prototype.mouseExit = function(e) {
  1253. return $(e.currentTarget.parentNode).find('#api_information_panel').hide();
  1254. };
  1255. OperationView.prototype.render = function() {
  1256. var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, l, len, len1, len2, len3, len4, m, modelAuths, n, o, p, param, q, ref, ref1, ref2, ref3, ref4, ref5, responseContentTypeView, responseSignatureView, schema, schemaObj, scopeIndex, signatureModel, statusCode, successResponse, type, v, value;
  1257. isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
  1258. if (!isMethodSubmissionSupported) {
  1259. this.model.isReadOnly = true;
  1260. }
  1261. this.model.description = this.model.description || this.model.notes;
  1262. if (this.model.description) {
  1263. this.model.description = this.model.description.replace(/(?:\r\n|\r|\n)/g, '<br />');
  1264. }
  1265. this.model.oauth = null;
  1266. modelAuths = this.model.authorizations || this.model.security;
  1267. if (modelAuths) {
  1268. if (Array.isArray(modelAuths)) {
  1269. for (l = 0, len = modelAuths.length; l < len; l++) {
  1270. auths = modelAuths[l];
  1271. for (key in auths) {
  1272. auth = auths[key];
  1273. for (a in this.auths) {
  1274. auth = this.auths[a];
  1275. if (auth.type === 'oauth2') {
  1276. this.model.oauth = {};
  1277. this.model.oauth.scopes = [];
  1278. ref1 = auth.value.scopes;
  1279. for (k in ref1) {
  1280. v = ref1[k];
  1281. scopeIndex = auths[key].indexOf(k);
  1282. if (scopeIndex >= 0) {
  1283. o = {
  1284. scope: k,
  1285. description: v
  1286. };
  1287. this.model.oauth.scopes.push(o);
  1288. }
  1289. }
  1290. }
  1291. }
  1292. }
  1293. }
  1294. } else {
  1295. for (k in modelAuths) {
  1296. v = modelAuths[k];
  1297. if (k === "oauth2") {
  1298. if (this.model.oauth === null) {
  1299. this.model.oauth = {};
  1300. }
  1301. if (this.model.oauth.scopes === void 0) {
  1302. this.model.oauth.scopes = [];
  1303. }
  1304. for (m = 0, len1 = v.length; m < len1; m++) {
  1305. o = v[m];
  1306. this.model.oauth.scopes.push(o);
  1307. }
  1308. }
  1309. }
  1310. }
  1311. }
  1312. if (typeof this.model.responses !== 'undefined') {
  1313. this.model.responseMessages = [];
  1314. ref2 = this.model.responses;
  1315. for (code in ref2) {
  1316. value = ref2[code];
  1317. schema = null;
  1318. schemaObj = this.model.responses[code].schema;
  1319. if (schemaObj && schemaObj['$ref']) {
  1320. schema = schemaObj['$ref'];
  1321. if (schema.indexOf('#/definitions/') === 0) {
  1322. schema = schema.substring('#/definitions/'.length);
  1323. }
  1324. }
  1325. this.model.responseMessages.push({
  1326. code: code,
  1327. message: value.description,
  1328. responseModel: schema
  1329. });
  1330. }
  1331. }
  1332. if (typeof this.model.responseMessages === 'undefined') {
  1333. this.model.responseMessages = [];
  1334. }
  1335. signatureModel = null;
  1336. if (this.model.successResponse) {
  1337. successResponse = this.model.successResponse;
  1338. for (key in successResponse) {
  1339. value = successResponse[key];
  1340. this.model.successCode = key;
  1341. if (typeof value === 'object' && typeof value.createJSONSample === 'function') {
  1342. signatureModel = {
  1343. sampleJSON: JSON.stringify(value.createJSONSample(), void 0, 2),
  1344. isParam: false,
  1345. signature: value.getMockSignature()
  1346. };
  1347. }
  1348. }
  1349. } else if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
  1350. signatureModel = {
  1351. sampleJSON: this.model.responseSampleJSON,
  1352. isParam: false,
  1353. signature: this.model.responseClassSignature
  1354. };
  1355. }
  1356. $(this.el).html(Handlebars.templates.operation(this.model));
  1357. if (signatureModel) {
  1358. responseSignatureView = new SignatureView({
  1359. model: signatureModel,
  1360. tagName: 'div',
  1361. parent: this
  1362. });
  1363. $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
  1364. } else {
  1365. this.model.responseClassSignature = 'string';
  1366. $('.model-signature', $(this.el)).html(this.model.type);
  1367. }
  1368. contentTypeModel = {
  1369. isParam: false
  1370. };
  1371. contentTypeModel.consumes = this.model.consumes;
  1372. contentTypeModel.produces = this.model.produces;
  1373. ref3 = this.model.parameters;
  1374. for (n = 0, len2 = ref3.length; n < len2; n++) {
  1375. param = ref3[n];
  1376. type = param.type || param.dataType || '';
  1377. if (typeof type === 'undefined') {
  1378. schema = param.schema;
  1379. if (schema && schema['$ref']) {
  1380. ref = schema['$ref'];
  1381. if (ref.indexOf('#/definitions/') === 0) {
  1382. type = ref.substring('#/definitions/'.length);
  1383. } else {
  1384. type = ref;
  1385. }
  1386. }
  1387. }
  1388. if (type && type.toLowerCase() === 'file') {
  1389. if (!contentTypeModel.consumes) {
  1390. contentTypeModel.consumes = 'multipart/form-data';
  1391. }
  1392. }
  1393. param.type = type;
  1394. }
  1395. responseContentTypeView = new ResponseContentTypeView({
  1396. model: contentTypeModel,
  1397. parent: this
  1398. });
  1399. $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
  1400. ref4 = this.model.parameters;
  1401. for (p = 0, len3 = ref4.length; p < len3; p++) {
  1402. param = ref4[p];
  1403. this.addParameter(param, contentTypeModel.consumes);
  1404. }
  1405. ref5 = this.model.responseMessages;
  1406. for (q = 0, len4 = ref5.length; q < len4; q++) {
  1407. statusCode = ref5[q];
  1408. this.addStatusCode(statusCode);
  1409. }
  1410. return this;
  1411. };
  1412. OperationView.prototype.addParameter = function(param, consumes) {
  1413. var paramView;
  1414. param.consumes = consumes;
  1415. paramView = new ParameterView({
  1416. model: param,
  1417. tagName: 'tr',
  1418. readOnly: this.model.isReadOnly,
  1419. parent: this
  1420. });
  1421. return $('.operation-params', $(this.el)).append(paramView.render().el);
  1422. };
  1423. OperationView.prototype.addStatusCode = function(statusCode) {
  1424. var statusCodeView;
  1425. statusCodeView = new StatusCodeView({
  1426. model: statusCode,
  1427. tagName: 'tr',
  1428. parent: this
  1429. });
  1430. return $('.operation-status', $(this.el)).append(statusCodeView.render().el);
  1431. };
  1432. OperationView.prototype.submitOperation = function(e) {
  1433. var error_free, form, isFileUpload, l, len, len1, len2, m, map, n, o, opts, ref1, ref2, ref3, val;
  1434. if (e != null) {
  1435. e.preventDefault();
  1436. }
  1437. form = $('.sandbox', $(this.el));
  1438. error_free = true;
  1439. form.find("input.required").each(function() {
  1440. $(this).removeClass("error");
  1441. if (jQuery.trim($(this).val()) === "") {
  1442. $(this).addClass("error");
  1443. $(this).wiggle({
  1444. callback: (function(_this) {
  1445. return function() {
  1446. return $(_this).focus();
  1447. };
  1448. })(this)
  1449. });
  1450. return error_free = false;
  1451. }
  1452. });
  1453. form.find("textarea.required").each(function() {
  1454. $(this).removeClass("error");
  1455. if (jQuery.trim($(this).val()) === "") {
  1456. $(this).addClass("error");
  1457. $(this).wiggle({
  1458. callback: (function(_this) {
  1459. return function() {
  1460. return $(_this).focus();
  1461. };
  1462. })(this)
  1463. });
  1464. return error_free = false;
  1465. }
  1466. });
  1467. if (error_free) {
  1468. map = {};
  1469. opts = {
  1470. parent: this
  1471. };
  1472. isFileUpload = false;
  1473. ref1 = form.find("input");
  1474. for (l = 0, len = ref1.length; l < len; l++) {
  1475. o = ref1[l];
  1476. if ((o.value != null) && jQuery.trim(o.value).length > 0) {
  1477. map[o.name] = o.value;
  1478. }
  1479. if (o.type === "file") {
  1480. map[o.name] = o.files[0];
  1481. isFileUpload = true;
  1482. }
  1483. }
  1484. ref2 = form.find("textarea");
  1485. for (m = 0, len1 = ref2.length; m < len1; m++) {
  1486. o = ref2[m];
  1487. if ((o.value != null) && jQuery.trim(o.value).length > 0) {
  1488. map[o.name] = o.value;
  1489. }
  1490. }
  1491. ref3 = form.find("select");
  1492. for (n = 0, len2 = ref3.length; n < len2; n++) {
  1493. o = ref3[n];
  1494. val = this.getSelectedValue(o);
  1495. if ((val != null) && jQuery.trim(val).length > 0) {
  1496. map[o.name] = val;
  1497. }
  1498. }
  1499. opts.responseContentType = $("div select[name=responseContentType]", $(this.el)).val();
  1500. opts.requestContentType = $("div select[name=parameterContentType]", $(this.el)).val();
  1501. $(".response_throbber", $(this.el)).show();
  1502. if (isFileUpload) {
  1503. return this.handleFileUpload(map, form);
  1504. } else {
  1505. return this.model["do"](map, opts, this.showCompleteStatus, this.showErrorStatus, this);
  1506. }
  1507. }
  1508. };
  1509. OperationView.prototype.success = function(response, parent) {
  1510. return parent.showCompleteStatus(response);
  1511. };
  1512. OperationView.prototype.handleFileUpload = function(map, form) {
  1513. var bodyParam, el, headerParams, l, len, len1, len2, len3, m, n, o, obj, p, param, params, ref1, ref2, ref3, ref4;
  1514. ref1 = form.serializeArray();
  1515. for (l = 0, len = ref1.length; l < len; l++) {
  1516. o = ref1[l];
  1517. if ((o.value != null) && jQuery.trim(o.value).length > 0) {
  1518. map[o.name] = o.value;
  1519. }
  1520. }
  1521. bodyParam = new FormData();
  1522. params = 0;
  1523. ref2 = this.model.parameters;
  1524. for (m = 0, len1 = ref2.length; m < len1; m++) {
  1525. param = ref2[m];
  1526. if (param.paramType === 'form' || param["in"] === 'formData') {
  1527. if (param.type.toLowerCase() !== 'file' && map[param.name] !== void 0) {
  1528. bodyParam.append(param.name, map[param.name]);
  1529. }
  1530. }
  1531. }
  1532. headerParams = {};
  1533. ref3 = this.model.parameters;
  1534. for (n = 0, len2 = ref3.length; n < len2; n++) {
  1535. param = ref3[n];
  1536. if (param.paramType === 'header') {
  1537. headerParams[param.name] = map[param.name];
  1538. }
  1539. }
  1540. ref4 = form.find('input[type~="file"]');
  1541. for (p = 0, len3 = ref4.length; p < len3; p++) {
  1542. el = ref4[p];
  1543. if (typeof el.files[0] !== 'undefined') {
  1544. bodyParam.append($(el).attr('name'), el.files[0]);
  1545. params += 1;
  1546. }
  1547. }
  1548. this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), delete headerParams['Content-Type'], this.model.urlify(map, false)) : this.model.urlify(map, true);
  1549. $(".request_url", $(this.el)).html("<pre></pre>");
  1550. $(".request_url pre", $(this.el)).text(this.invocationUrl);
  1551. obj = {
  1552. type: this.model.method,
  1553. url: this.invocationUrl,
  1554. headers: headerParams,
  1555. data: bodyParam,
  1556. dataType: 'json',
  1557. contentType: false,
  1558. processData: false,
  1559. error: (function(_this) {
  1560. return function(data, textStatus, error) {
  1561. return _this.showErrorStatus(_this.wrap(data), _this);
  1562. };
  1563. })(this),
  1564. success: (function(_this) {
  1565. return function(data) {
  1566. return _this.showResponse(data, _this);
  1567. };
  1568. })(this),
  1569. complete: (function(_this) {
  1570. return function(data) {
  1571. return _this.showCompleteStatus(_this.wrap(data), _this);
  1572. };
  1573. })(this)
  1574. };
  1575. if (window.authorizations) {
  1576. window.authorizations.apply(obj);
  1577. }
  1578. if (params === 0) {
  1579. obj.data.append("fake", "true");
  1580. }
  1581. jQuery.ajax(obj);
  1582. return false;
  1583. };
  1584. OperationView.prototype.wrap = function(data) {
  1585. var h, headerArray, headers, i, l, len, o;
  1586. headers = {};
  1587. headerArray = data.getAllResponseHeaders().split("\r");
  1588. for (l = 0, len = headerArray.length; l < len; l++) {
  1589. i = headerArray[l];
  1590. h = i.match(/^([^:]*?):(.*)$/);
  1591. if (!h) {
  1592. h = [];
  1593. }
  1594. h.shift();
  1595. if (h[0] !== void 0 && h[1] !== void 0) {
  1596. headers[h[0].trim()] = h[1].trim();
  1597. }
  1598. }
  1599. o = {};
  1600. o.content = {};
  1601. o.content.data = data.responseText;
  1602. o.headers = headers;
  1603. o.request = {};
  1604. o.request.url = this.invocationUrl;
  1605. o.status = data.status;
  1606. return o;
  1607. };
  1608. OperationView.prototype.getSelectedValue = function(select) {
  1609. var l, len, opt, options, ref1;
  1610. if (!select.multiple) {
  1611. return select.value;
  1612. } else {
  1613. options = [];
  1614. ref1 = select.options;
  1615. for (l = 0, len = ref1.length; l < len; l++) {
  1616. opt = ref1[l];
  1617. if (opt.selected) {
  1618. options.push(opt.value);
  1619. }
  1620. }
  1621. if (options.length > 0) {
  1622. return options;
  1623. } else {
  1624. return null;
  1625. }
  1626. }
  1627. };
  1628. OperationView.prototype.hideResponse = function(e) {
  1629. if (e != null) {
  1630. e.preventDefault();
  1631. }
  1632. $(".response", $(this.el)).slideUp();
  1633. return $(".response_hider", $(this.el)).fadeOut();
  1634. };
  1635. OperationView.prototype.showResponse = function(response) {
  1636. var prettyJson;
  1637. prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");
  1638. return $(".response_body", $(this.el)).html(escape(prettyJson));
  1639. };
  1640. OperationView.prototype.showErrorStatus = function(data, parent) {
  1641. return parent.showStatus(data);
  1642. };
  1643. OperationView.prototype.showCompleteStatus = function(data, parent) {
  1644. return parent.showStatus(data);
  1645. };
  1646. OperationView.prototype.formatXml = function(xml) {
  1647. var contexp, fn, formatted, indent, l, lastType, len, lines, ln, pad, reg, transitions, wsexp;
  1648. reg = /(>)(<)(\/*)/g;
  1649. wsexp = /[ ]*(.*)[ ]+\n/g;
  1650. contexp = /(<.+>)(.+\n)/g;
  1651. xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
  1652. pad = 0;
  1653. formatted = '';
  1654. lines = xml.split('\n');
  1655. indent = 0;
  1656. lastType = 'other';
  1657. transitions = {
  1658. 'single->single': 0,
  1659. 'single->closing': -1,
  1660. 'single->opening': 0,
  1661. 'single->other': 0,
  1662. 'closing->single': 0,
  1663. 'closing->closing': -1,
  1664. 'closing->opening': 0,
  1665. 'closing->other': 0,
  1666. 'opening->single': 1,
  1667. 'opening->closing': 0,
  1668. 'opening->opening': 1,
  1669. 'opening->other': 1,
  1670. 'other->single': 0,
  1671. 'other->closing': -1,
  1672. 'other->opening': 0,
  1673. 'other->other': 0
  1674. };
  1675. fn = function(ln) {
  1676. var fromTo, j, key, padding, type, types, value;
  1677. types = {
  1678. single: Boolean(ln.match(/<.+\/>/)),
  1679. closing: Boolean(ln.match(/<\/.+>/)),
  1680. opening: Boolean(ln.match(/<[^!?].*>/))
  1681. };
  1682. type = ((function() {
  1683. var results;
  1684. results = [];
  1685. for (key in types) {
  1686. value = types[key];
  1687. if (value) {
  1688. results.push(key);
  1689. }
  1690. }
  1691. return results;
  1692. })())[0];
  1693. type = type === void 0 ? 'other' : type;
  1694. fromTo = lastType + '->' + type;
  1695. lastType = type;
  1696. padding = '';
  1697. indent += transitions[fromTo];
  1698. padding = ((function() {
  1699. var m, ref1, results;
  1700. results = [];
  1701. for (j = m = 0, ref1 = indent; 0 <= ref1 ? m < ref1 : m > ref1; j = 0 <= ref1 ? ++m : --m) {
  1702. results.push(' ');
  1703. }
  1704. return results;
  1705. })()).join('');
  1706. if (fromTo === 'opening->closing') {
  1707. return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
  1708. } else {
  1709. return formatted += padding + ln + '\n';
  1710. }
  1711. };
  1712. for (l = 0, len = lines.length; l < len; l++) {
  1713. ln = lines[l];
  1714. fn(ln);
  1715. }
  1716. return formatted;
  1717. };
  1718. OperationView.prototype.showStatus = function(response) {
  1719. var code, content, contentType, e, headers, json, opts, pre, response_body, response_body_el, supportsAudioPlayback, url;
  1720. if (response.content === void 0) {
  1721. content = response.data;
  1722. url = response.url;
  1723. } else {
  1724. content = response.content.data;
  1725. url = response.request.url;
  1726. }
  1727. headers = response.headers;
  1728. contentType = null;
  1729. if (headers) {
  1730. contentType = headers["Content-Type"] || headers["content-type"];
  1731. if (contentType) {
  1732. contentType = contentType.split(";")[0].trim();
  1733. }
  1734. }
  1735. $(".response_body", $(this.el)).removeClass('json');
  1736. $(".response_body", $(this.el)).removeClass('xml');
  1737. supportsAudioPlayback = function(contentType) {
  1738. var audioElement;
  1739. audioElement = document.createElement('audio');
  1740. return !!(audioElement.canPlayType && audioElement.canPlayType(contentType).replace(/no/, ''));
  1741. };
  1742. if (!content) {
  1743. code = $('<code />').text("no content");
  1744. pre = $('<pre class="json" />').append(code);
  1745. } else if (contentType === "application/json" || /\+json$/.test(contentType)) {
  1746. json = null;
  1747. try {
  1748. json = JSON.stringify(JSON.parse(content), null, " ");
  1749. } catch (_error) {
  1750. e = _error;
  1751. json = "can't parse JSON. Raw result:\n\n" + content;
  1752. }
  1753. code = $('<code />').text(json);
  1754. pre = $('<pre class="json" />').append(code);
  1755. } else if (contentType === "application/xml" || /\+xml$/.test(contentType)) {
  1756. code = $('<code />').text(this.formatXml(content));
  1757. pre = $('<pre class="xml" />').append(code);
  1758. } else if (contentType === "text/html") {
  1759. code = $('<code />').html(_.escape(content));
  1760. pre = $('<pre class="xml" />').append(code);
  1761. } else if (/^image\//.test(contentType)) {
  1762. pre = $('<img>').attr('src', url);
  1763. } else if (/^audio\//.test(contentType) && supportsAudioPlayback(contentType)) {
  1764. pre = $('<audio controls>').append($('<source>').attr('src', url).attr('type', contentType));
  1765. } else {
  1766. code = $('<code />').text(content);
  1767. pre = $('<pre class="json" />').append(code);
  1768. }
  1769. response_body = pre;
  1770. $(".request_url", $(this.el)).html("<pre></pre>");
  1771. $(".request_url pre", $(this.el)).text(url);
  1772. $(".response_code", $(this.el)).html("<pre>" + response.status + "</pre>");
  1773. $(".response_body", $(this.el)).html(response_body);
  1774. $(".response_headers", $(this.el)).html("<pre>" + _.escape(JSON.stringify(response.headers, null, " ")).replace(/\n/g, "<br>") + "</pre>");
  1775. $(".response", $(this.el)).slideDown();
  1776. $(".response_hider", $(this.el)).show();
  1777. $(".response_throbber", $(this.el)).hide();
  1778. response_body_el = $('.response_body', $(this.el))[0];
  1779. opts = this.options.swaggerOptions;
  1780. if (opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold) {
  1781. return response_body_el;
  1782. } else {
  1783. return hljs.highlightBlock(response_body_el);
  1784. }
  1785. };
  1786. OperationView.prototype.toggleOperationContent = function() {
  1787. var elem;
  1788. elem = $('#' + Docs.escapeResourceName(this.parentId + "_" + this.nickname + "_content"));
  1789. if (elem.is(':visible')) {
  1790. return Docs.collapseOperation(elem);
  1791. } else {
  1792. return Docs.expandOperation(elem);
  1793. }
  1794. };
  1795. return OperationView;
  1796. })(Backbone.View);
  1797. var ParameterContentTypeView,
  1798. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  1799. hasProp = {}.hasOwnProperty;
  1800. ParameterContentTypeView = (function(superClass) {
  1801. extend(ParameterContentTypeView, superClass);
  1802. function ParameterContentTypeView() {
  1803. return ParameterContentTypeView.__super__.constructor.apply(this, arguments);
  1804. }
  1805. ParameterContentTypeView.prototype.initialize = function() {};
  1806. ParameterContentTypeView.prototype.render = function() {
  1807. var template;
  1808. template = this.template();
  1809. $(this.el).html(template(this.model));
  1810. $('label[for=parameterContentType]', $(this.el)).text('Parameter content type:');
  1811. return this;
  1812. };
  1813. ParameterContentTypeView.prototype.template = function() {
  1814. return Handlebars.templates.parameter_content_type;
  1815. };
  1816. return ParameterContentTypeView;
  1817. })(Backbone.View);
  1818. var ParameterView,
  1819. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  1820. hasProp = {}.hasOwnProperty;
  1821. ParameterView = (function(superClass) {
  1822. extend(ParameterView, superClass);
  1823. function ParameterView() {
  1824. return ParameterView.__super__.constructor.apply(this, arguments);
  1825. }
  1826. ParameterView.prototype.initialize = function() {
  1827. return Handlebars.registerHelper('isArray', function(param, opts) {
  1828. if (param.type.toLowerCase() === 'array' || param.allowMultiple) {
  1829. return opts.fn(this);
  1830. } else {
  1831. return opts.inverse(this);
  1832. }
  1833. });
  1834. };
  1835. ParameterView.prototype.render = function() {
  1836. var contentTypeModel, isParam, parameterContentTypeView, ref, responseContentTypeView, schema, signatureModel, signatureView, template, type;
  1837. type = this.model.type || this.model.dataType;
  1838. if (typeof type === 'undefined') {
  1839. schema = this.model.schema;
  1840. if (schema && schema['$ref']) {
  1841. ref = schema['$ref'];
  1842. if (ref.indexOf('#/definitions/') === 0) {
  1843. type = ref.substring('#/definitions/'.length);
  1844. } else {
  1845. type = ref;
  1846. }
  1847. }
  1848. }
  1849. this.model.type = type;
  1850. this.model.paramType = this.model["in"] || this.model.paramType;
  1851. if (this.model.paramType === 'body' || this.model["in"] === 'body') {
  1852. this.model.isBody = true;
  1853. }
  1854. if (type && type.toLowerCase() === 'file') {
  1855. this.model.isFile = true;
  1856. }
  1857. this.model["default"] = this.model["default"] || this.model.defaultValue;
  1858. if (this.model.allowableValues) {
  1859. this.model.isList = true;
  1860. }
  1861. template = this.template();
  1862. $(this.el).html(template(this.model));
  1863. signatureModel = {
  1864. sampleJSON: this.model.sampleJSON,
  1865. isParam: true,
  1866. signature: this.model.signature
  1867. };
  1868. if (this.model.sampleJSON) {
  1869. signatureView = new SignatureView({
  1870. model: signatureModel,
  1871. tagName: 'div'
  1872. });
  1873. $('.model-signature', $(this.el)).append(signatureView.render().el);
  1874. } else {
  1875. $('.model-signature', $(this.el)).html(this.model.signature);
  1876. }
  1877. isParam = false;
  1878. if (this.model.isBody) {
  1879. isParam = true;
  1880. }
  1881. contentTypeModel = {
  1882. isParam: isParam
  1883. };
  1884. contentTypeModel.consumes = this.model.consumes;
  1885. if (isParam) {
  1886. parameterContentTypeView = new ParameterContentTypeView({
  1887. model: contentTypeModel
  1888. });
  1889. $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
  1890. } else {
  1891. responseContentTypeView = new ResponseContentTypeView({
  1892. model: contentTypeModel
  1893. });
  1894. $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
  1895. }
  1896. return this;
  1897. };
  1898. ParameterView.prototype.template = function() {
  1899. if (this.model.isList) {
  1900. return Handlebars.templates.param_list;
  1901. } else {
  1902. if (this.options.readOnly) {
  1903. if (this.model.required) {
  1904. return Handlebars.templates.param_readonly_required;
  1905. } else {
  1906. return Handlebars.templates.param_readonly;
  1907. }
  1908. } else {
  1909. if (this.model.required) {
  1910. return Handlebars.templates.param_required;
  1911. } else {
  1912. return Handlebars.templates.param;
  1913. }
  1914. }
  1915. }
  1916. };
  1917. return ParameterView;
  1918. })(Backbone.View);
  1919. var ResourceView,
  1920. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  1921. hasProp = {}.hasOwnProperty;
  1922. ResourceView = (function(superClass) {
  1923. extend(ResourceView, superClass);
  1924. function ResourceView() {
  1925. return ResourceView.__super__.constructor.apply(this, arguments);
  1926. }
  1927. ResourceView.prototype.initialize = function(opts) {
  1928. if (opts == null) {
  1929. opts = {};
  1930. }
  1931. this.auths = opts.auths;
  1932. if ("" === this.model.description) {
  1933. this.model.description = null;
  1934. }
  1935. if (this.model.description != null) {
  1936. return this.model.summary = this.model.description;
  1937. }
  1938. };
  1939. ResourceView.prototype.render = function() {
  1940. var counter, i, id, len, methods, operation, ref;
  1941. methods = {};
  1942. $(this.el).html(Handlebars.templates.resource(this.model));
  1943. ref = this.model.operationsArray;
  1944. for (i = 0, len = ref.length; i < len; i++) {
  1945. operation = ref[i];
  1946. counter = 0;
  1947. id = operation.nickname;
  1948. while (typeof methods[id] !== 'undefined') {
  1949. id = id + "_" + counter;
  1950. counter += 1;
  1951. }
  1952. methods[id] = operation;
  1953. operation.nickname = id;
  1954. operation.parentId = this.model.id;
  1955. this.addOperation(operation);
  1956. }
  1957. $('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'));
  1958. $('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource'));
  1959. $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource'));
  1960. return this;
  1961. };
  1962. ResourceView.prototype.addOperation = function(operation) {
  1963. var operationView;
  1964. operation.number = this.number;
  1965. operationView = new OperationView({
  1966. model: operation,
  1967. tagName: 'li',
  1968. className: 'endpoint',
  1969. swaggerOptions: this.options.swaggerOptions,
  1970. auths: this.auths,
  1971. parent: this
  1972. });
  1973. $('.endpoints', $(this.el)).append(operationView.render().el);
  1974. return this.number++;
  1975. };
  1976. ResourceView.prototype.callDocs = function(fnName, e) {
  1977. e.preventDefault();
  1978. return Docs[fnName](e.currentTarget.getAttribute('data-id'));
  1979. };
  1980. return ResourceView;
  1981. })(Backbone.View);
  1982. var ResponseContentTypeView,
  1983. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  1984. hasProp = {}.hasOwnProperty;
  1985. ResponseContentTypeView = (function(superClass) {
  1986. extend(ResponseContentTypeView, superClass);
  1987. function ResponseContentTypeView() {
  1988. return ResponseContentTypeView.__super__.constructor.apply(this, arguments);
  1989. }
  1990. ResponseContentTypeView.prototype.initialize = function() {};
  1991. ResponseContentTypeView.prototype.render = function() {
  1992. var template;
  1993. template = this.template();
  1994. $(this.el).html(template(this.model));
  1995. $('label[for=responseContentType]', $(this.el)).text('Response Content Type');
  1996. return this;
  1997. };
  1998. ResponseContentTypeView.prototype.template = function() {
  1999. return Handlebars.templates.response_content_type;
  2000. };
  2001. return ResponseContentTypeView;
  2002. })(Backbone.View);
  2003. var SignatureView,
  2004. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  2005. hasProp = {}.hasOwnProperty;
  2006. SignatureView = (function(superClass) {
  2007. extend(SignatureView, superClass);
  2008. function SignatureView() {
  2009. return SignatureView.__super__.constructor.apply(this, arguments);
  2010. }
  2011. SignatureView.prototype.events = {
  2012. 'click a.description-link': 'switchToDescription',
  2013. 'click a.snippet-link': 'switchToSnippet',
  2014. 'mousedown .snippet': 'snippetToTextArea'
  2015. };
  2016. SignatureView.prototype.initialize = function() {};
  2017. SignatureView.prototype.render = function() {
  2018. var template;
  2019. template = this.template();
  2020. $(this.el).html(template(this.model));
  2021. this.switchToSnippet();
  2022. this.isParam = this.model.isParam;
  2023. if (this.isParam) {
  2024. $('.notice', $(this.el)).text('Click to set as parameter value');
  2025. }
  2026. return this;
  2027. };
  2028. SignatureView.prototype.template = function() {
  2029. return Handlebars.templates.signature;
  2030. };
  2031. SignatureView.prototype.switchToDescription = function(e) {
  2032. if (e != null) {
  2033. e.preventDefault();
  2034. }
  2035. $(".snippet", $(this.el)).hide();
  2036. $(".description", $(this.el)).show();
  2037. $('.description-link', $(this.el)).addClass('selected');
  2038. return $('.snippet-link', $(this.el)).removeClass('selected');
  2039. };
  2040. SignatureView.prototype.switchToSnippet = function(e) {
  2041. if (e != null) {
  2042. e.preventDefault();
  2043. }
  2044. $(".description", $(this.el)).hide();
  2045. $(".snippet", $(this.el)).show();
  2046. $('.snippet-link', $(this.el)).addClass('selected');
  2047. return $('.description-link', $(this.el)).removeClass('selected');
  2048. };
  2049. SignatureView.prototype.snippetToTextArea = function(e) {
  2050. var textArea;
  2051. if (this.isParam) {
  2052. if (e != null) {
  2053. e.preventDefault();
  2054. }
  2055. textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
  2056. if ($.trim(textArea.val()) === '') {
  2057. return textArea.val(this.model.sampleJSON);
  2058. }
  2059. }
  2060. };
  2061. return SignatureView;
  2062. })(Backbone.View);
  2063. var StatusCodeView,
  2064. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  2065. hasProp = {}.hasOwnProperty;
  2066. StatusCodeView = (function(superClass) {
  2067. extend(StatusCodeView, superClass);
  2068. function StatusCodeView() {
  2069. return StatusCodeView.__super__.constructor.apply(this, arguments);
  2070. }
  2071. StatusCodeView.prototype.initialize = function() {};
  2072. StatusCodeView.prototype.render = function() {
  2073. var models, responseModel, responseModelView, template;
  2074. template = this.template();
  2075. $(this.el).html(template(this.model));
  2076. models = this.options.parent.options.parent.options.parent.model.models;
  2077. if (models.hasOwnProperty(this.model.responseModel)) {
  2078. models = this.options.parent.options.parent.options.parent.model.models;
  2079. responseModel = {
  2080. sampleJSON: JSON.stringify(models[this.model.responseModel].createJSONSample(), null, 2),
  2081. isParam: false,
  2082. signature: models[this.model.responseModel].getMockSignature()
  2083. };
  2084. responseModelView = new SignatureView({
  2085. model: responseModel,
  2086. tagName: 'div'
  2087. });
  2088. $('.model-signature', this.$el).append(responseModelView.render().el);
  2089. } else {
  2090. $('.model-signature', this.$el).html('');
  2091. }
  2092. return this;
  2093. };
  2094. StatusCodeView.prototype.template = function() {
  2095. return Handlebars.templates.status_code;
  2096. };
  2097. return StatusCodeView;
  2098. })(Backbone.View);