Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

swagger-ui.js 76 KiB

11 anni fa
11 anni fa
11 anni fa
11 anni fa
11 anni fa
11 anni fa
11 anni fa
11 anni fa
11 anni fa
11 anni fa
11 anni fa
11 anni fa
11 anni fa
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943
  1. $(function() {
  2. // Helper function for vertically aligning DOM elements
  3. // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
  4. $.fn.vAlign = function() {
  5. return this.each(function(i){
  6. var ah = $(this).height();
  7. var ph = $(this).parent().height();
  8. var mh = (ph - ah) / 2;
  9. $(this).css('margin-top', mh);
  10. });
  11. };
  12. $.fn.stretchFormtasticInputWidthToParent = function() {
  13. return this.each(function(i){
  14. var p_width = $(this).closest("form").innerWidth();
  15. var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);
  16. var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
  17. $(this).css('width', p_width - p_padding - this_padding);
  18. });
  19. };
  20. $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
  21. // Vertically center these paragraphs
  22. // Parent may need a min-height for this to work..
  23. $('ul.downplayed li div.content p').vAlign();
  24. // When a sandbox form is submitted..
  25. $("form.sandbox").submit(function(){
  26. var error_free = true;
  27. // Cycle through the forms required inputs
  28. $(this).find("input.required").each(function() {
  29. // Remove any existing error styles from the input
  30. $(this).removeClass('error');
  31. // Tack the error style on if the input is empty..
  32. if ($(this).val() == '') {
  33. $(this).addClass('error');
  34. $(this).wiggle();
  35. error_free = false;
  36. }
  37. });
  38. return error_free;
  39. });
  40. });
  41. function clippyCopiedCallback(a) {
  42. $('#api_key_copied').fadeIn().delay(1000).fadeOut();
  43. // var b = $("#clippy_tooltip_" + a);
  44. // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
  45. // b.attr("title", "copy to clipboard")
  46. // },
  47. // 500))
  48. }
  49. // Logging function that accounts for browsers that don't have window.console
  50. function log() {
  51. if (window.console) console.log.apply(console,arguments);
  52. }
  53. // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
  54. if (Function.prototype.bind && console && typeof console.log == "object") {
  55. [
  56. "log","info","warn","error","assert","dir","clear","profile","profileEnd"
  57. ].forEach(function (method) {
  58. console[method] = this.bind(console[method], console);
  59. }, Function.prototype.call);
  60. }
  61. var Docs = {
  62. shebang: function() {
  63. // If shebang has an operation nickname in it..
  64. // e.g. /docs/#!/words/get_search
  65. var fragments = $.param.fragment().split('/');
  66. fragments.shift(); // get rid of the bang
  67. switch (fragments.length) {
  68. case 1:
  69. // Expand all operations for the resource and scroll to it
  70. // log('shebang resource:' + fragments[0]);
  71. var dom_id = 'resource_' + fragments[0];
  72. Docs.expandEndpointListForResource(fragments[0]);
  73. $("#"+dom_id).slideto({highlight: false});
  74. break;
  75. case 2:
  76. // Refer to the endpoint DOM element, e.g. #words_get_search
  77. // log('shebang endpoint: ' + fragments.join('_'));
  78. // Expand Resource
  79. Docs.expandEndpointListForResource(fragments[0]);
  80. $("#"+dom_id).slideto({highlight: false});
  81. // Expand operation
  82. var li_dom_id = fragments.join('_');
  83. var li_content_dom_id = li_dom_id + "_content";
  84. // log("li_dom_id " + li_dom_id);
  85. // log("li_content_dom_id " + li_content_dom_id);
  86. Docs.expandOperation($('#'+li_content_dom_id));
  87. $('#'+li_dom_id).slideto({highlight: false});
  88. break;
  89. }
  90. },
  91. toggleEndpointListForResource: function(resource) {
  92. var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
  93. if (elem.is(':visible')) {
  94. Docs.collapseEndpointListForResource(resource);
  95. } else {
  96. Docs.expandEndpointListForResource(resource);
  97. }
  98. },
  99. // Expand resource
  100. expandEndpointListForResource: function(resource) {
  101. var resource = Docs.escapeResourceName(resource);
  102. if (resource == '') {
  103. $('.resource ul.endpoints').slideDown();
  104. return;
  105. }
  106. $('li#resource_' + resource).addClass('active');
  107. var elem = $('li#resource_' + resource + ' ul.endpoints');
  108. elem.slideDown();
  109. },
  110. // Collapse resource and mark as explicitly closed
  111. collapseEndpointListForResource: function(resource) {
  112. var resource = Docs.escapeResourceName(resource);
  113. $('li#resource_' + resource).removeClass('active');
  114. var elem = $('li#resource_' + resource + ' ul.endpoints');
  115. elem.slideUp();
  116. },
  117. expandOperationsForResource: function(resource) {
  118. // Make sure the resource container is open..
  119. Docs.expandEndpointListForResource(resource);
  120. if (resource == '') {
  121. $('.resource ul.endpoints li.operation div.content').slideDown();
  122. return;
  123. }
  124. $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
  125. Docs.expandOperation($(this));
  126. });
  127. },
  128. collapseOperationsForResource: function(resource) {
  129. // Make sure the resource container is open..
  130. Docs.expandEndpointListForResource(resource);
  131. $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
  132. Docs.collapseOperation($(this));
  133. });
  134. },
  135. escapeResourceName: function(resource) {
  136. return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
  137. },
  138. expandOperation: function(elem) {
  139. elem.slideDown();
  140. },
  141. collapseOperation: function(elem) {
  142. elem.slideUp();
  143. }
  144. };
  145. (function() {
  146. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  147. templates['content_type'] = template(function (Handlebars,depth0,helpers,partials,data) {
  148. helpers = helpers || Handlebars.helpers;
  149. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0;
  150. function program1(depth0,data) {
  151. var buffer = "", stack1, stack2;
  152. buffer += "\n ";
  153. foundHelper = helpers.produces;
  154. stack1 = foundHelper || depth0.produces;
  155. stack2 = helpers.each;
  156. tmp1 = self.program(2, program2, data);
  157. tmp1.hash = {};
  158. tmp1.fn = tmp1;
  159. tmp1.inverse = self.noop;
  160. stack1 = stack2.call(depth0, stack1, tmp1);
  161. if(stack1 || stack1 === 0) { buffer += stack1; }
  162. buffer += "\n";
  163. return buffer;}
  164. function program2(depth0,data) {
  165. var buffer = "", stack1;
  166. buffer += "\n <option value=\"";
  167. stack1 = depth0;
  168. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  169. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "this", { hash: {} }); }
  170. if(stack1 || stack1 === 0) { buffer += stack1; }
  171. buffer += "\">";
  172. stack1 = depth0;
  173. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  174. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "this", { hash: {} }); }
  175. if(stack1 || stack1 === 0) { buffer += stack1; }
  176. buffer += "</option>\n ";
  177. return buffer;}
  178. function program4(depth0,data) {
  179. return "\n <option value=\"application/json\">application/json</option>\n";}
  180. buffer += "<label for=\"contentType\"></label>\n<select name=\"contentType\">\n";
  181. foundHelper = helpers.produces;
  182. stack1 = foundHelper || depth0.produces;
  183. stack2 = helpers['if'];
  184. tmp1 = self.program(1, program1, data);
  185. tmp1.hash = {};
  186. tmp1.fn = tmp1;
  187. tmp1.inverse = self.program(4, program4, data);
  188. stack1 = stack2.call(depth0, stack1, tmp1);
  189. if(stack1 || stack1 === 0) { buffer += stack1; }
  190. buffer += "\n</select>\n";
  191. return buffer;});
  192. })();
  193. (function() {
  194. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  195. templates['main'] = template(function (Handlebars,depth0,helpers,partials,data) {
  196. helpers = helpers || Handlebars.helpers;
  197. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  198. function program1(depth0,data) {
  199. var buffer = "", stack1;
  200. buffer += "\n , <span style=\"font-variant: small-caps\">api version</span>: ";
  201. foundHelper = helpers.apiVersion;
  202. stack1 = foundHelper || depth0.apiVersion;
  203. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  204. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "apiVersion", { hash: {} }); }
  205. buffer += escapeExpression(stack1) + "\n ";
  206. return buffer;}
  207. buffer += "\n<div class='container' id='resources_container'>\n <ul id='resources'>\n </ul>\n\n <div class=\"footer\">\n <br>\n <br>\n <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: ";
  208. foundHelper = helpers.basePath;
  209. stack1 = foundHelper || depth0.basePath;
  210. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  211. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "basePath", { hash: {} }); }
  212. buffer += escapeExpression(stack1) + "\n ";
  213. foundHelper = helpers.apiVersion;
  214. stack1 = foundHelper || depth0.apiVersion;
  215. stack2 = helpers['if'];
  216. tmp1 = self.program(1, program1, data);
  217. tmp1.hash = {};
  218. tmp1.fn = tmp1;
  219. tmp1.inverse = self.noop;
  220. stack1 = stack2.call(depth0, stack1, tmp1);
  221. if(stack1 || stack1 === 0) { buffer += stack1; }
  222. buffer += "]</h4>\n </div>\n</div>\n";
  223. return buffer;});
  224. })();
  225. (function() {
  226. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  227. templates['operation'] = template(function (Handlebars,depth0,helpers,partials,data) {
  228. helpers = helpers || Handlebars.helpers;
  229. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  230. function program1(depth0,data) {
  231. var buffer = "", stack1;
  232. buffer += "\n <h4>Implementation Notes</h4>\n <p>";
  233. foundHelper = helpers.notes;
  234. stack1 = foundHelper || depth0.notes;
  235. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  236. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "notes", { hash: {} }); }
  237. if(stack1 || stack1 === 0) { buffer += stack1; }
  238. buffer += "</p>\n ";
  239. return buffer;}
  240. function program3(depth0,data) {
  241. return "\n <h4>Response Class</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"content-type\" />\n ";}
  242. function program5(depth0,data) {
  243. return "\n <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: 320px; max-width: 330px\">Data Type</th>\n </tr>\n </thead>\n <tbody class=\"operation-params\">\n\n </tbody>\n </table>\n ";}
  244. function program7(depth0,data) {
  245. return "\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Status Codes</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n ";}
  246. function program9(depth0,data) {
  247. return "\n ";}
  248. function program11(depth0,data) {
  249. return "\n <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 <img alt='Throbber' class='response_throbber' src='images/throbber.gif' style='display:none' />\n </div>\n ";}
  250. buffer += "\n <ul class='operations' >\n <li class='";
  251. foundHelper = helpers.httpMethod;
  252. stack1 = foundHelper || depth0.httpMethod;
  253. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  254. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
  255. buffer += escapeExpression(stack1) + " operation' id='";
  256. foundHelper = helpers.resourceName;
  257. stack1 = foundHelper || depth0.resourceName;
  258. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  259. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
  260. buffer += escapeExpression(stack1) + "_";
  261. foundHelper = helpers.nickname;
  262. stack1 = foundHelper || depth0.nickname;
  263. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  264. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
  265. buffer += escapeExpression(stack1) + "_";
  266. foundHelper = helpers.httpMethod;
  267. stack1 = foundHelper || depth0.httpMethod;
  268. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  269. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
  270. buffer += escapeExpression(stack1) + "_";
  271. foundHelper = helpers.number;
  272. stack1 = foundHelper || depth0.number;
  273. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  274. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "number", { hash: {} }); }
  275. buffer += escapeExpression(stack1) + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/";
  276. foundHelper = helpers.resourceName;
  277. stack1 = foundHelper || depth0.resourceName;
  278. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  279. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
  280. buffer += escapeExpression(stack1) + "/";
  281. foundHelper = helpers.nickname;
  282. stack1 = foundHelper || depth0.nickname;
  283. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  284. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
  285. buffer += escapeExpression(stack1) + "_";
  286. foundHelper = helpers.httpMethod;
  287. stack1 = foundHelper || depth0.httpMethod;
  288. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  289. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
  290. buffer += escapeExpression(stack1) + "_";
  291. foundHelper = helpers.number;
  292. stack1 = foundHelper || depth0.number;
  293. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  294. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "number", { hash: {} }); }
  295. buffer += escapeExpression(stack1) + "' class=\"toggleOperation\">";
  296. foundHelper = helpers.httpMethod;
  297. stack1 = foundHelper || depth0.httpMethod;
  298. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  299. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
  300. buffer += escapeExpression(stack1) + "</a>\n </span>\n <span class='path'>\n <a href='#!/";
  301. foundHelper = helpers.resourceName;
  302. stack1 = foundHelper || depth0.resourceName;
  303. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  304. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
  305. buffer += escapeExpression(stack1) + "/";
  306. foundHelper = helpers.nickname;
  307. stack1 = foundHelper || depth0.nickname;
  308. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  309. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
  310. buffer += escapeExpression(stack1) + "_";
  311. foundHelper = helpers.httpMethod;
  312. stack1 = foundHelper || depth0.httpMethod;
  313. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  314. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
  315. buffer += escapeExpression(stack1) + "_";
  316. foundHelper = helpers.number;
  317. stack1 = foundHelper || depth0.number;
  318. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  319. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "number", { hash: {} }); }
  320. buffer += escapeExpression(stack1) + "' class=\"toggleOperation\">";
  321. foundHelper = helpers.path;
  322. stack1 = foundHelper || depth0.path;
  323. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  324. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "path", { hash: {} }); }
  325. buffer += escapeExpression(stack1) + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/";
  326. foundHelper = helpers.resourceName;
  327. stack1 = foundHelper || depth0.resourceName;
  328. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  329. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
  330. buffer += escapeExpression(stack1) + "/";
  331. foundHelper = helpers.nickname;
  332. stack1 = foundHelper || depth0.nickname;
  333. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  334. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
  335. buffer += escapeExpression(stack1) + "_";
  336. foundHelper = helpers.httpMethod;
  337. stack1 = foundHelper || depth0.httpMethod;
  338. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  339. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
  340. buffer += escapeExpression(stack1) + "_";
  341. foundHelper = helpers.number;
  342. stack1 = foundHelper || depth0.number;
  343. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  344. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "number", { hash: {} }); }
  345. buffer += escapeExpression(stack1) + "' class=\"toggleOperation\">";
  346. foundHelper = helpers.summary;
  347. stack1 = foundHelper || depth0.summary;
  348. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  349. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "summary", { hash: {} }); }
  350. if(stack1 || stack1 === 0) { buffer += stack1; }
  351. buffer += "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='";
  352. foundHelper = helpers.resourceName;
  353. stack1 = foundHelper || depth0.resourceName;
  354. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  355. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
  356. buffer += escapeExpression(stack1) + "_";
  357. foundHelper = helpers.nickname;
  358. stack1 = foundHelper || depth0.nickname;
  359. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  360. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
  361. buffer += escapeExpression(stack1) + "_";
  362. foundHelper = helpers.httpMethod;
  363. stack1 = foundHelper || depth0.httpMethod;
  364. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  365. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
  366. buffer += escapeExpression(stack1) + "_";
  367. foundHelper = helpers.number;
  368. stack1 = foundHelper || depth0.number;
  369. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  370. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "number", { hash: {} }); }
  371. buffer += escapeExpression(stack1) + "_content' style='display:none'>\n ";
  372. foundHelper = helpers.notes;
  373. stack1 = foundHelper || depth0.notes;
  374. stack2 = helpers['if'];
  375. tmp1 = self.program(1, program1, data);
  376. tmp1.hash = {};
  377. tmp1.fn = tmp1;
  378. tmp1.inverse = self.noop;
  379. stack1 = stack2.call(depth0, stack1, tmp1);
  380. if(stack1 || stack1 === 0) { buffer += stack1; }
  381. buffer += "\n ";
  382. foundHelper = helpers.responseClass;
  383. stack1 = foundHelper || depth0.responseClass;
  384. stack2 = helpers['if'];
  385. tmp1 = self.program(3, program3, data);
  386. tmp1.hash = {};
  387. tmp1.fn = tmp1;
  388. tmp1.inverse = self.noop;
  389. stack1 = stack2.call(depth0, stack1, tmp1);
  390. if(stack1 || stack1 === 0) { buffer += stack1; }
  391. buffer += "\n <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n ";
  392. foundHelper = helpers.parameters;
  393. stack1 = foundHelper || depth0.parameters;
  394. stack2 = helpers['if'];
  395. tmp1 = self.program(5, program5, data);
  396. tmp1.hash = {};
  397. tmp1.fn = tmp1;
  398. tmp1.inverse = self.noop;
  399. stack1 = stack2.call(depth0, stack1, tmp1);
  400. if(stack1 || stack1 === 0) { buffer += stack1; }
  401. buffer += "\n ";
  402. foundHelper = helpers.errorResponses;
  403. stack1 = foundHelper || depth0.errorResponses;
  404. stack2 = helpers['if'];
  405. tmp1 = self.program(7, program7, data);
  406. tmp1.hash = {};
  407. tmp1.fn = tmp1;
  408. tmp1.inverse = self.noop;
  409. stack1 = stack2.call(depth0, stack1, tmp1);
  410. if(stack1 || stack1 === 0) { buffer += stack1; }
  411. buffer += "\n ";
  412. foundHelper = helpers.isReadOnly;
  413. stack1 = foundHelper || depth0.isReadOnly;
  414. stack2 = helpers['if'];
  415. tmp1 = self.program(9, program9, data);
  416. tmp1.hash = {};
  417. tmp1.fn = tmp1;
  418. tmp1.inverse = self.program(11, program11, data);
  419. stack1 = stack2.call(depth0, stack1, tmp1);
  420. if(stack1 || stack1 === 0) { buffer += stack1; }
  421. buffer += "\n </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";
  422. return buffer;});
  423. })();
  424. (function() {
  425. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  426. templates['param'] = template(function (Handlebars,depth0,helpers,partials,data) {
  427. helpers = helpers || Handlebars.helpers;
  428. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  429. function program1(depth0,data) {
  430. var buffer = "", stack1, stack2;
  431. buffer += "\n ";
  432. foundHelper = helpers.isFile;
  433. stack1 = foundHelper || depth0.isFile;
  434. stack2 = helpers['if'];
  435. tmp1 = self.program(2, program2, data);
  436. tmp1.hash = {};
  437. tmp1.fn = tmp1;
  438. tmp1.inverse = self.program(4, program4, data);
  439. stack1 = stack2.call(depth0, stack1, tmp1);
  440. if(stack1 || stack1 === 0) { buffer += stack1; }
  441. buffer += "\n ";
  442. return buffer;}
  443. function program2(depth0,data) {
  444. var buffer = "", stack1;
  445. buffer += "\n <input type=\"file\" name='";
  446. foundHelper = helpers.name;
  447. stack1 = foundHelper || depth0.name;
  448. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  449. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  450. buffer += escapeExpression(stack1) + "'/>\n ";
  451. return buffer;}
  452. function program4(depth0,data) {
  453. var buffer = "", stack1, stack2;
  454. buffer += "\n ";
  455. foundHelper = helpers.defaultValue;
  456. stack1 = foundHelper || depth0.defaultValue;
  457. stack2 = helpers['if'];
  458. tmp1 = self.program(5, program5, data);
  459. tmp1.hash = {};
  460. tmp1.fn = tmp1;
  461. tmp1.inverse = self.program(7, program7, data);
  462. stack1 = stack2.call(depth0, stack1, tmp1);
  463. if(stack1 || stack1 === 0) { buffer += stack1; }
  464. buffer += "\n ";
  465. return buffer;}
  466. function program5(depth0,data) {
  467. var buffer = "", stack1;
  468. buffer += "\n <textarea class='body-textarea' name='";
  469. foundHelper = helpers.name;
  470. stack1 = foundHelper || depth0.name;
  471. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  472. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  473. buffer += escapeExpression(stack1) + "'>";
  474. foundHelper = helpers.defaultValue;
  475. stack1 = foundHelper || depth0.defaultValue;
  476. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  477. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  478. buffer += escapeExpression(stack1) + "</textarea>\n ";
  479. return buffer;}
  480. function program7(depth0,data) {
  481. var buffer = "", stack1;
  482. buffer += "\n <textarea class='body-textarea' name='";
  483. foundHelper = helpers.name;
  484. stack1 = foundHelper || depth0.name;
  485. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  486. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  487. buffer += escapeExpression(stack1) + "'></textarea>\n <br />\n <div class=\"content-type\" />\n ";
  488. return buffer;}
  489. function program9(depth0,data) {
  490. var buffer = "", stack1, stack2;
  491. buffer += "\n ";
  492. foundHelper = helpers.defaultValue;
  493. stack1 = foundHelper || depth0.defaultValue;
  494. stack2 = helpers['if'];
  495. tmp1 = self.program(10, program10, data);
  496. tmp1.hash = {};
  497. tmp1.fn = tmp1;
  498. tmp1.inverse = self.program(12, program12, data);
  499. stack1 = stack2.call(depth0, stack1, tmp1);
  500. if(stack1 || stack1 === 0) { buffer += stack1; }
  501. buffer += "\n ";
  502. return buffer;}
  503. function program10(depth0,data) {
  504. var buffer = "", stack1;
  505. buffer += "\n <input minlength='0' name='";
  506. foundHelper = helpers.name;
  507. stack1 = foundHelper || depth0.name;
  508. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  509. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  510. buffer += escapeExpression(stack1) + "' placeholder='' type='text' value='";
  511. foundHelper = helpers.defaultValue;
  512. stack1 = foundHelper || depth0.defaultValue;
  513. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  514. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  515. buffer += escapeExpression(stack1) + "'/>\n ";
  516. return buffer;}
  517. function program12(depth0,data) {
  518. var buffer = "", stack1;
  519. buffer += "\n <input minlength='0' name='";
  520. foundHelper = helpers.name;
  521. stack1 = foundHelper || depth0.name;
  522. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  523. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  524. buffer += escapeExpression(stack1) + "' placeholder='' type='text' value=''/>\n ";
  525. return buffer;}
  526. buffer += "<td class='code'>";
  527. foundHelper = helpers.name;
  528. stack1 = foundHelper || depth0.name;
  529. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  530. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  531. buffer += escapeExpression(stack1) + "</td>\n<td>\n\n ";
  532. foundHelper = helpers.isBody;
  533. stack1 = foundHelper || depth0.isBody;
  534. stack2 = helpers['if'];
  535. tmp1 = self.program(1, program1, data);
  536. tmp1.hash = {};
  537. tmp1.fn = tmp1;
  538. tmp1.inverse = self.program(9, program9, data);
  539. stack1 = stack2.call(depth0, stack1, tmp1);
  540. if(stack1 || stack1 === 0) { buffer += stack1; }
  541. buffer += "\n\n</td>\n<td>";
  542. foundHelper = helpers.description;
  543. stack1 = foundHelper || depth0.description;
  544. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  545. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
  546. if(stack1 || stack1 === 0) { buffer += stack1; }
  547. buffer += "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n\n";
  548. return buffer;});
  549. })();
  550. (function() {
  551. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  552. templates['param_list'] = template(function (Handlebars,depth0,helpers,partials,data) {
  553. helpers = helpers || Handlebars.helpers;
  554. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  555. function program1(depth0,data) {
  556. return "\n ";}
  557. function program3(depth0,data) {
  558. var buffer = "", stack1, stack2;
  559. buffer += "\n ";
  560. foundHelper = helpers.defaultValue;
  561. stack1 = foundHelper || depth0.defaultValue;
  562. stack2 = helpers['if'];
  563. tmp1 = self.program(4, program4, data);
  564. tmp1.hash = {};
  565. tmp1.fn = tmp1;
  566. tmp1.inverse = self.program(6, program6, data);
  567. stack1 = stack2.call(depth0, stack1, tmp1);
  568. if(stack1 || stack1 === 0) { buffer += stack1; }
  569. buffer += "\n ";
  570. return buffer;}
  571. function program4(depth0,data) {
  572. return "\n ";}
  573. function program6(depth0,data) {
  574. return "\n <option selected=\"\" value=''></option>\n ";}
  575. function program8(depth0,data) {
  576. var buffer = "", stack1, stack2;
  577. buffer += "\n ";
  578. foundHelper = helpers.isDefault;
  579. stack1 = foundHelper || depth0.isDefault;
  580. stack2 = helpers['if'];
  581. tmp1 = self.program(9, program9, data);
  582. tmp1.hash = {};
  583. tmp1.fn = tmp1;
  584. tmp1.inverse = self.program(11, program11, data);
  585. stack1 = stack2.call(depth0, stack1, tmp1);
  586. if(stack1 || stack1 === 0) { buffer += stack1; }
  587. buffer += "\n ";
  588. return buffer;}
  589. function program9(depth0,data) {
  590. var buffer = "", stack1;
  591. buffer += "\n <option value='";
  592. foundHelper = helpers.value;
  593. stack1 = foundHelper || depth0.value;
  594. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  595. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }
  596. buffer += escapeExpression(stack1) + "'>";
  597. foundHelper = helpers.value;
  598. stack1 = foundHelper || depth0.value;
  599. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  600. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }
  601. buffer += escapeExpression(stack1) + " (default)</option>\n ";
  602. return buffer;}
  603. function program11(depth0,data) {
  604. var buffer = "", stack1;
  605. buffer += "\n <option value='";
  606. foundHelper = helpers.value;
  607. stack1 = foundHelper || depth0.value;
  608. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  609. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }
  610. buffer += escapeExpression(stack1) + "'>";
  611. foundHelper = helpers.value;
  612. stack1 = foundHelper || depth0.value;
  613. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  614. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }
  615. buffer += escapeExpression(stack1) + "</option>\n ";
  616. return buffer;}
  617. buffer += "<td class='code'>";
  618. foundHelper = helpers.name;
  619. stack1 = foundHelper || depth0.name;
  620. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  621. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  622. buffer += escapeExpression(stack1) + "</td>\n<td>\n <select name='";
  623. foundHelper = helpers.name;
  624. stack1 = foundHelper || depth0.name;
  625. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  626. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  627. buffer += escapeExpression(stack1) + "'>\n ";
  628. foundHelper = helpers.required;
  629. stack1 = foundHelper || depth0.required;
  630. stack2 = helpers['if'];
  631. tmp1 = self.program(1, program1, data);
  632. tmp1.hash = {};
  633. tmp1.fn = tmp1;
  634. tmp1.inverse = self.program(3, program3, data);
  635. stack1 = stack2.call(depth0, stack1, tmp1);
  636. if(stack1 || stack1 === 0) { buffer += stack1; }
  637. buffer += "\n ";
  638. foundHelper = helpers.allowableValues;
  639. stack1 = foundHelper || depth0.allowableValues;
  640. stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.descriptiveValues);
  641. stack2 = helpers.each;
  642. tmp1 = self.program(8, program8, data);
  643. tmp1.hash = {};
  644. tmp1.fn = tmp1;
  645. tmp1.inverse = self.noop;
  646. stack1 = stack2.call(depth0, stack1, tmp1);
  647. if(stack1 || stack1 === 0) { buffer += stack1; }
  648. buffer += "\n </select>\n</td>\n<td>";
  649. foundHelper = helpers.description;
  650. stack1 = foundHelper || depth0.description;
  651. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  652. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
  653. if(stack1 || stack1 === 0) { buffer += stack1; }
  654. buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n";
  655. return buffer;});
  656. })();
  657. (function() {
  658. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  659. templates['param_readonly'] = template(function (Handlebars,depth0,helpers,partials,data) {
  660. helpers = helpers || Handlebars.helpers;
  661. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  662. function program1(depth0,data) {
  663. var buffer = "", stack1;
  664. buffer += "\n <textarea class='body-textarea' readonly='readonly' name='";
  665. foundHelper = helpers.name;
  666. stack1 = foundHelper || depth0.name;
  667. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  668. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  669. buffer += escapeExpression(stack1) + "'>";
  670. foundHelper = helpers.defaultValue;
  671. stack1 = foundHelper || depth0.defaultValue;
  672. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  673. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  674. buffer += escapeExpression(stack1) + "</textarea>\n ";
  675. return buffer;}
  676. function program3(depth0,data) {
  677. var buffer = "", stack1;
  678. buffer += "\n ";
  679. foundHelper = helpers.defaultValue;
  680. stack1 = foundHelper || depth0.defaultValue;
  681. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  682. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  683. buffer += escapeExpression(stack1) + "\n ";
  684. return buffer;}
  685. buffer += "<td class='code'>";
  686. foundHelper = helpers.name;
  687. stack1 = foundHelper || depth0.name;
  688. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  689. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  690. buffer += escapeExpression(stack1) + "</td>\n<td>\n ";
  691. foundHelper = helpers.isBody;
  692. stack1 = foundHelper || depth0.isBody;
  693. stack2 = helpers['if'];
  694. tmp1 = self.program(1, program1, data);
  695. tmp1.hash = {};
  696. tmp1.fn = tmp1;
  697. tmp1.inverse = self.program(3, program3, data);
  698. stack1 = stack2.call(depth0, stack1, tmp1);
  699. if(stack1 || stack1 === 0) { buffer += stack1; }
  700. buffer += "\n</td>\n<td>";
  701. foundHelper = helpers.description;
  702. stack1 = foundHelper || depth0.description;
  703. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  704. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
  705. if(stack1 || stack1 === 0) { buffer += stack1; }
  706. buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n";
  707. return buffer;});
  708. })();
  709. (function() {
  710. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  711. templates['param_readonly_required'] = template(function (Handlebars,depth0,helpers,partials,data) {
  712. helpers = helpers || Handlebars.helpers;
  713. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  714. function program1(depth0,data) {
  715. var buffer = "", stack1;
  716. buffer += "\n <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='";
  717. foundHelper = helpers.name;
  718. stack1 = foundHelper || depth0.name;
  719. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  720. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  721. buffer += escapeExpression(stack1) + "'>";
  722. foundHelper = helpers.defaultValue;
  723. stack1 = foundHelper || depth0.defaultValue;
  724. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  725. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  726. buffer += escapeExpression(stack1) + "</textarea>\n ";
  727. return buffer;}
  728. function program3(depth0,data) {
  729. var buffer = "", stack1;
  730. buffer += "\n ";
  731. foundHelper = helpers.defaultValue;
  732. stack1 = foundHelper || depth0.defaultValue;
  733. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  734. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  735. buffer += escapeExpression(stack1) + "\n ";
  736. return buffer;}
  737. buffer += "<td class='code required'>";
  738. foundHelper = helpers.name;
  739. stack1 = foundHelper || depth0.name;
  740. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  741. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  742. buffer += escapeExpression(stack1) + "</td>\n<td>\n ";
  743. foundHelper = helpers.isBody;
  744. stack1 = foundHelper || depth0.isBody;
  745. stack2 = helpers['if'];
  746. tmp1 = self.program(1, program1, data);
  747. tmp1.hash = {};
  748. tmp1.fn = tmp1;
  749. tmp1.inverse = self.program(3, program3, data);
  750. stack1 = stack2.call(depth0, stack1, tmp1);
  751. if(stack1 || stack1 === 0) { buffer += stack1; }
  752. buffer += "\n</td>\n<td>";
  753. foundHelper = helpers.description;
  754. stack1 = foundHelper || depth0.description;
  755. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  756. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
  757. if(stack1 || stack1 === 0) { buffer += stack1; }
  758. buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n";
  759. return buffer;});
  760. })();
  761. (function() {
  762. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  763. templates['param_required'] = template(function (Handlebars,depth0,helpers,partials,data) {
  764. helpers = helpers || Handlebars.helpers;
  765. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  766. function program1(depth0,data) {
  767. var buffer = "", stack1, stack2;
  768. buffer += "\n ";
  769. foundHelper = helpers.isFile;
  770. stack1 = foundHelper || depth0.isFile;
  771. stack2 = helpers['if'];
  772. tmp1 = self.program(2, program2, data);
  773. tmp1.hash = {};
  774. tmp1.fn = tmp1;
  775. tmp1.inverse = self.program(4, program4, data);
  776. stack1 = stack2.call(depth0, stack1, tmp1);
  777. if(stack1 || stack1 === 0) { buffer += stack1; }
  778. buffer += "\n ";
  779. return buffer;}
  780. function program2(depth0,data) {
  781. var buffer = "", stack1;
  782. buffer += "\n <input type=\"file\" name='";
  783. foundHelper = helpers.name;
  784. stack1 = foundHelper || depth0.name;
  785. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  786. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  787. buffer += escapeExpression(stack1) + "'/>\n ";
  788. return buffer;}
  789. function program4(depth0,data) {
  790. var buffer = "", stack1, stack2;
  791. buffer += "\n ";
  792. foundHelper = helpers.defaultValue;
  793. stack1 = foundHelper || depth0.defaultValue;
  794. stack2 = helpers['if'];
  795. tmp1 = self.program(5, program5, data);
  796. tmp1.hash = {};
  797. tmp1.fn = tmp1;
  798. tmp1.inverse = self.program(7, program7, data);
  799. stack1 = stack2.call(depth0, stack1, tmp1);
  800. if(stack1 || stack1 === 0) { buffer += stack1; }
  801. buffer += "\n ";
  802. return buffer;}
  803. function program5(depth0,data) {
  804. var buffer = "", stack1;
  805. buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='";
  806. foundHelper = helpers.name;
  807. stack1 = foundHelper || depth0.name;
  808. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  809. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  810. buffer += escapeExpression(stack1) + "'>";
  811. foundHelper = helpers.defaultValue;
  812. stack1 = foundHelper || depth0.defaultValue;
  813. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  814. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  815. buffer += escapeExpression(stack1) + "</textarea>\n ";
  816. return buffer;}
  817. function program7(depth0,data) {
  818. var buffer = "", stack1;
  819. buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='";
  820. foundHelper = helpers.name;
  821. stack1 = foundHelper || depth0.name;
  822. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  823. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  824. buffer += escapeExpression(stack1) + "'></textarea>\n <br />\n <div class=\"content-type\" />\n ";
  825. return buffer;}
  826. function program9(depth0,data) {
  827. var buffer = "", stack1, stack2;
  828. buffer += "\n ";
  829. foundHelper = helpers.isFile;
  830. stack1 = foundHelper || depth0.isFile;
  831. stack2 = helpers['if'];
  832. tmp1 = self.program(10, program10, data);
  833. tmp1.hash = {};
  834. tmp1.fn = tmp1;
  835. tmp1.inverse = self.program(12, program12, data);
  836. stack1 = stack2.call(depth0, stack1, tmp1);
  837. if(stack1 || stack1 === 0) { buffer += stack1; }
  838. buffer += "\n ";
  839. return buffer;}
  840. function program10(depth0,data) {
  841. var buffer = "", stack1;
  842. buffer += "\n <input class='required' type='file' name='";
  843. foundHelper = helpers.name;
  844. stack1 = foundHelper || depth0.name;
  845. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  846. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  847. buffer += escapeExpression(stack1) + "'/>\n ";
  848. return buffer;}
  849. function program12(depth0,data) {
  850. var buffer = "", stack1, stack2;
  851. buffer += "\n ";
  852. foundHelper = helpers.defaultValue;
  853. stack1 = foundHelper || depth0.defaultValue;
  854. stack2 = helpers['if'];
  855. tmp1 = self.program(13, program13, data);
  856. tmp1.hash = {};
  857. tmp1.fn = tmp1;
  858. tmp1.inverse = self.program(15, program15, data);
  859. stack1 = stack2.call(depth0, stack1, tmp1);
  860. if(stack1 || stack1 === 0) { buffer += stack1; }
  861. buffer += "\n ";
  862. return buffer;}
  863. function program13(depth0,data) {
  864. var buffer = "", stack1;
  865. buffer += "\n <input class='required' minlength='1' name='";
  866. foundHelper = helpers.name;
  867. stack1 = foundHelper || depth0.name;
  868. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  869. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  870. buffer += escapeExpression(stack1) + "' placeholder='(required)' type='text' value='";
  871. foundHelper = helpers.defaultValue;
  872. stack1 = foundHelper || depth0.defaultValue;
  873. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  874. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  875. buffer += escapeExpression(stack1) + "'/>\n ";
  876. return buffer;}
  877. function program15(depth0,data) {
  878. var buffer = "", stack1;
  879. buffer += "\n <input class='required' minlength='1' name='";
  880. foundHelper = helpers.name;
  881. stack1 = foundHelper || depth0.name;
  882. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  883. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  884. buffer += escapeExpression(stack1) + "' placeholder='(required)' type='text' value=''/>\n ";
  885. return buffer;}
  886. buffer += "<td class='code required'>";
  887. foundHelper = helpers.name;
  888. stack1 = foundHelper || depth0.name;
  889. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  890. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  891. buffer += escapeExpression(stack1) + "</td>\n<td>\n ";
  892. foundHelper = helpers.isBody;
  893. stack1 = foundHelper || depth0.isBody;
  894. stack2 = helpers['if'];
  895. tmp1 = self.program(1, program1, data);
  896. tmp1.hash = {};
  897. tmp1.fn = tmp1;
  898. tmp1.inverse = self.program(9, program9, data);
  899. stack1 = stack2.call(depth0, stack1, tmp1);
  900. if(stack1 || stack1 === 0) { buffer += stack1; }
  901. buffer += "\n</td>\n<td>\n <strong>";
  902. foundHelper = helpers.description;
  903. stack1 = foundHelper || depth0.description;
  904. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  905. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
  906. if(stack1 || stack1 === 0) { buffer += stack1; }
  907. buffer += "</strong>\n</td>\n<td><span class=\"model-signature\"></span></td>\n";
  908. return buffer;});
  909. })();
  910. (function() {
  911. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  912. templates['resource'] = template(function (Handlebars,depth0,helpers,partials,data) {
  913. helpers = helpers || Handlebars.helpers;
  914. var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  915. buffer += "<div class='heading'>\n <h2>\n <a href='#!/";
  916. foundHelper = helpers.name;
  917. stack1 = foundHelper || depth0.name;
  918. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  919. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  920. buffer += escapeExpression(stack1) + "' onclick=\"Docs.toggleEndpointListForResource('";
  921. foundHelper = helpers.name;
  922. stack1 = foundHelper || depth0.name;
  923. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  924. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  925. buffer += escapeExpression(stack1) + "');\">/";
  926. foundHelper = helpers.name;
  927. stack1 = foundHelper || depth0.name;
  928. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  929. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  930. buffer += escapeExpression(stack1) + "</a>\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/";
  931. foundHelper = helpers.name;
  932. stack1 = foundHelper || depth0.name;
  933. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  934. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  935. buffer += escapeExpression(stack1) + "' id='endpointListTogger_";
  936. foundHelper = helpers.name;
  937. stack1 = foundHelper || depth0.name;
  938. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  939. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  940. buffer += escapeExpression(stack1) + "'\n onclick=\"Docs.toggleEndpointListForResource('";
  941. foundHelper = helpers.name;
  942. stack1 = foundHelper || depth0.name;
  943. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  944. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  945. buffer += escapeExpression(stack1) + "');\">Show/Hide</a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.collapseOperationsForResource('";
  946. foundHelper = helpers.name;
  947. stack1 = foundHelper || depth0.name;
  948. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  949. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  950. buffer += escapeExpression(stack1) + "'); return false;\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.expandOperationsForResource('";
  951. foundHelper = helpers.name;
  952. stack1 = foundHelper || depth0.name;
  953. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  954. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  955. buffer += escapeExpression(stack1) + "'); return false;\">\n Expand Operations\n </a>\n </li>\n <li>\n <a href='";
  956. foundHelper = helpers.url;
  957. stack1 = foundHelper || depth0.url;
  958. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  959. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "url", { hash: {} }); }
  960. buffer += escapeExpression(stack1) + "'>Raw</a>\n </li>\n </ul>\n</div>\n<ul class='endpoints' id='";
  961. foundHelper = helpers.name;
  962. stack1 = foundHelper || depth0.name;
  963. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  964. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  965. buffer += escapeExpression(stack1) + "_endpoint_list' style='display:none'>\n\n</ul>\n";
  966. return buffer;});
  967. })();
  968. (function() {
  969. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  970. templates['signature'] = template(function (Handlebars,depth0,helpers,partials,data) {
  971. helpers = helpers || Handlebars.helpers;
  972. var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  973. 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 ";
  974. foundHelper = helpers.signature;
  975. stack1 = foundHelper || depth0.signature;
  976. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  977. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "signature", { hash: {} }); }
  978. if(stack1 || stack1 === 0) { buffer += stack1; }
  979. buffer += "\n </div>\n\n <div class=\"snippet\">\n <pre><code>";
  980. foundHelper = helpers.sampleJSON;
  981. stack1 = foundHelper || depth0.sampleJSON;
  982. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  983. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "sampleJSON", { hash: {} }); }
  984. buffer += escapeExpression(stack1) + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
  985. return buffer;});
  986. })();
  987. (function() {
  988. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  989. templates['status_code'] = template(function (Handlebars,depth0,helpers,partials,data) {
  990. helpers = helpers || Handlebars.helpers;
  991. var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  992. buffer += "<td width='15%' class='code'>";
  993. foundHelper = helpers.code;
  994. stack1 = foundHelper || depth0.code;
  995. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  996. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "code", { hash: {} }); }
  997. buffer += escapeExpression(stack1) + "</td>\n<td>";
  998. foundHelper = helpers.reason;
  999. stack1 = foundHelper || depth0.reason;
  1000. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1001. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "reason", { hash: {} }); }
  1002. if(stack1 || stack1 === 0) { buffer += stack1; }
  1003. buffer += "</td>\n\n";
  1004. return buffer;});
  1005. })();
  1006. // Generated by CoffeeScript 1.4.0
  1007. (function() {
  1008. var ContentTypeView, HeaderView, MainView, OperationView, ParameterView, ResourceView, SignatureView, StatusCodeView, SwaggerUi,
  1009. __hasProp = {}.hasOwnProperty,
  1010. __extends = 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; };
  1011. SwaggerUi = (function(_super) {
  1012. __extends(SwaggerUi, _super);
  1013. function SwaggerUi() {
  1014. return SwaggerUi.__super__.constructor.apply(this, arguments);
  1015. }
  1016. SwaggerUi.prototype.dom_id = "swagger_ui";
  1017. SwaggerUi.prototype.options = null;
  1018. SwaggerUi.prototype.api = null;
  1019. SwaggerUi.prototype.headerView = null;
  1020. SwaggerUi.prototype.mainView = null;
  1021. SwaggerUi.prototype.initialize = function(options) {
  1022. var _this = this;
  1023. if (options == null) {
  1024. options = {};
  1025. }
  1026. if (options.dom_id != null) {
  1027. this.dom_id = options.dom_id;
  1028. delete options.dom_id;
  1029. }
  1030. if (!($('#' + this.dom_id) != null)) {
  1031. $('body').append('<div id="' + this.dom_id + '"></div>');
  1032. }
  1033. this.options = options;
  1034. this.options.success = function() {
  1035. return _this.render();
  1036. };
  1037. this.options.progress = function(d) {
  1038. return _this.showMessage(d);
  1039. };
  1040. this.options.failure = function(d) {
  1041. return _this.onLoadFailure(d);
  1042. };
  1043. this.headerView = new HeaderView({
  1044. el: $('#header')
  1045. });
  1046. return this.headerView.on('update-swagger-ui', function(data) {
  1047. return _this.updateSwaggerUi(data);
  1048. });
  1049. };
  1050. SwaggerUi.prototype.updateSwaggerUi = function(data) {
  1051. this.options.discoveryUrl = data.discoveryUrl;
  1052. this.options.apiKey = data.apiKey;
  1053. return this.load();
  1054. };
  1055. SwaggerUi.prototype.load = function() {
  1056. var _ref;
  1057. if ((_ref = this.mainView) != null) {
  1058. _ref.clear();
  1059. }
  1060. this.headerView.update(this.options.discoveryUrl, this.options.apiKey);
  1061. return this.api = new SwaggerApi(this.options);
  1062. };
  1063. SwaggerUi.prototype.render = function() {
  1064. var _this = this;
  1065. this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
  1066. this.mainView = new MainView({
  1067. model: this.api,
  1068. el: $('#' + this.dom_id)
  1069. }).render();
  1070. this.showMessage();
  1071. switch (this.options.docExpansion) {
  1072. case "full":
  1073. Docs.expandOperationsForResource('');
  1074. break;
  1075. case "list":
  1076. Docs.collapseOperationsForResource('');
  1077. }
  1078. if (this.options.onComplete) {
  1079. this.options.onComplete(this.api, this);
  1080. }
  1081. return setTimeout(function() {
  1082. return Docs.shebang();
  1083. }, 400);
  1084. };
  1085. SwaggerUi.prototype.showMessage = function(data) {
  1086. if (data == null) {
  1087. data = '';
  1088. }
  1089. $('#message-bar').removeClass('message-fail');
  1090. $('#message-bar').addClass('message-success');
  1091. return $('#message-bar').html(data);
  1092. };
  1093. SwaggerUi.prototype.onLoadFailure = function(data) {
  1094. var val;
  1095. if (data == null) {
  1096. data = '';
  1097. }
  1098. $('#message-bar').removeClass('message-success');
  1099. $('#message-bar').addClass('message-fail');
  1100. val = $('#message-bar').html(data);
  1101. if (this.options.onFailure != null) {
  1102. this.options.onFailure(data);
  1103. }
  1104. return val;
  1105. };
  1106. return SwaggerUi;
  1107. })(Backbone.Router);
  1108. window.SwaggerUi = SwaggerUi;
  1109. HeaderView = (function(_super) {
  1110. __extends(HeaderView, _super);
  1111. function HeaderView() {
  1112. return HeaderView.__super__.constructor.apply(this, arguments);
  1113. }
  1114. HeaderView.prototype.events = {
  1115. 'click #show-pet-store-icon': 'showPetStore',
  1116. 'click #show-wordnik-dev-icon': 'showWordnikDev',
  1117. 'click #explore': 'showCustom',
  1118. 'keyup #input_baseUrl': 'showCustomOnKeyup',
  1119. 'keyup #input_apiKey': 'showCustomOnKeyup'
  1120. };
  1121. HeaderView.prototype.initialize = function() {};
  1122. HeaderView.prototype.showPetStore = function(e) {
  1123. return this.trigger('update-swagger-ui', {
  1124. discoveryUrl: "http://petstore.swagger.wordnik.com/api/api-docs.json",
  1125. apiKey: "special-key"
  1126. });
  1127. };
  1128. HeaderView.prototype.showWordnikDev = function(e) {
  1129. return this.trigger('update-swagger-ui', {
  1130. discoveryUrl: "http://api.wordnik.com/v4/resources.json",
  1131. apiKey: ""
  1132. });
  1133. };
  1134. HeaderView.prototype.showCustomOnKeyup = function(e) {
  1135. if (e.keyCode === 13) {
  1136. return this.showCustom();
  1137. }
  1138. };
  1139. HeaderView.prototype.showCustom = function(e) {
  1140. if (e != null) {
  1141. e.preventDefault();
  1142. }
  1143. return this.trigger('update-swagger-ui', {
  1144. discoveryUrl: $('#input_baseUrl').val(),
  1145. apiKey: $('#input_apiKey').val()
  1146. });
  1147. };
  1148. HeaderView.prototype.update = function(url, apiKey, trigger) {
  1149. if (trigger == null) {
  1150. trigger = false;
  1151. }
  1152. $('#input_baseUrl').val(url);
  1153. $('#input_apiKey').val(apiKey);
  1154. if (trigger) {
  1155. return this.trigger('update-swagger-ui', {
  1156. discoveryUrl: url,
  1157. apiKey: apiKey
  1158. });
  1159. }
  1160. };
  1161. return HeaderView;
  1162. })(Backbone.View);
  1163. MainView = (function(_super) {
  1164. __extends(MainView, _super);
  1165. function MainView() {
  1166. return MainView.__super__.constructor.apply(this, arguments);
  1167. }
  1168. MainView.prototype.initialize = function() {};
  1169. MainView.prototype.render = function() {
  1170. var resource, _i, _len, _ref;
  1171. $(this.el).html(Handlebars.templates.main(this.model));
  1172. _ref = this.model.apisArray;
  1173. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1174. resource = _ref[_i];
  1175. this.addResource(resource);
  1176. }
  1177. return this;
  1178. };
  1179. MainView.prototype.addResource = function(resource) {
  1180. var resourceView;
  1181. resourceView = new ResourceView({
  1182. model: resource,
  1183. tagName: 'li',
  1184. id: 'resource_' + resource.name,
  1185. className: 'resource'
  1186. });
  1187. return $('#resources').append(resourceView.render().el);
  1188. };
  1189. MainView.prototype.clear = function() {
  1190. return $(this.el).html('');
  1191. };
  1192. return MainView;
  1193. })(Backbone.View);
  1194. ResourceView = (function(_super) {
  1195. __extends(ResourceView, _super);
  1196. function ResourceView() {
  1197. return ResourceView.__super__.constructor.apply(this, arguments);
  1198. }
  1199. ResourceView.prototype.initialize = function() {};
  1200. ResourceView.prototype.render = function() {
  1201. var operation, _i, _len, _ref;
  1202. $(this.el).html(Handlebars.templates.resource(this.model));
  1203. this.number = 0;
  1204. _ref = this.model.operationsArray;
  1205. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1206. operation = _ref[_i];
  1207. this.addOperation(operation);
  1208. }
  1209. return this;
  1210. };
  1211. ResourceView.prototype.addOperation = function(operation) {
  1212. var operationView;
  1213. operation.number = this.number;
  1214. operationView = new OperationView({
  1215. model: operation,
  1216. tagName: 'li',
  1217. className: 'endpoint'
  1218. });
  1219. $('.endpoints', $(this.el)).append(operationView.render().el);
  1220. return this.number++;
  1221. };
  1222. return ResourceView;
  1223. })(Backbone.View);
  1224. OperationView = (function(_super) {
  1225. __extends(OperationView, _super);
  1226. function OperationView() {
  1227. return OperationView.__super__.constructor.apply(this, arguments);
  1228. }
  1229. OperationView.prototype.events = {
  1230. 'submit .sandbox': 'submitOperation',
  1231. 'click .submit': 'submitOperation',
  1232. 'click .response_hider': 'hideResponse',
  1233. 'click .toggleOperation': 'toggleOperationContent'
  1234. };
  1235. OperationView.prototype.initialize = function() {};
  1236. OperationView.prototype.render = function() {
  1237. var contentTypeModel, contentTypeView, isMethodSubmissionSupported, param, responseSignatureView, signatureModel, statusCode, _i, _j, _len, _len1, _ref, _ref1;
  1238. isMethodSubmissionSupported = jQuery.inArray(this.model.httpMethod, this.model.supportedSubmitMethods()) >= 0;
  1239. if (!isMethodSubmissionSupported) {
  1240. this.model.isReadOnly = true;
  1241. }
  1242. $(this.el).html(Handlebars.templates.operation(this.model));
  1243. if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
  1244. signatureModel = {
  1245. sampleJSON: this.model.responseSampleJSON,
  1246. isParam: false,
  1247. signature: this.model.responseClassSignature
  1248. };
  1249. responseSignatureView = new SignatureView({
  1250. model: signatureModel,
  1251. tagName: 'div'
  1252. });
  1253. $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
  1254. } else {
  1255. $('.model-signature', $(this.el)).html(this.model.responseClass);
  1256. }
  1257. contentTypeModel = {
  1258. isParam: false
  1259. };
  1260. if (this.model.supportedContentTypes) {
  1261. contentTypeModel.produces = this.model.supportedContentTypes;
  1262. }
  1263. if (this.model.produces) {
  1264. contentTypeModel.produces = this.model.produces;
  1265. }
  1266. contentTypeView = new ContentTypeView({
  1267. model: contentTypeModel
  1268. });
  1269. $('.content-type', $(this.el)).append(contentTypeView.render().el);
  1270. _ref = this.model.parameters;
  1271. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1272. param = _ref[_i];
  1273. this.addParameter(param);
  1274. }
  1275. _ref1 = this.model.errorResponses;
  1276. for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
  1277. statusCode = _ref1[_j];
  1278. this.addStatusCode(statusCode);
  1279. }
  1280. return this;
  1281. };
  1282. OperationView.prototype.addParameter = function(param) {
  1283. var paramView;
  1284. paramView = new ParameterView({
  1285. model: param,
  1286. tagName: 'tr',
  1287. readOnly: this.model.isReadOnly
  1288. });
  1289. return $('.operation-params', $(this.el)).append(paramView.render().el);
  1290. };
  1291. OperationView.prototype.addStatusCode = function(statusCode) {
  1292. var statusCodeView;
  1293. statusCodeView = new StatusCodeView({
  1294. model: statusCode,
  1295. tagName: 'tr'
  1296. });
  1297. return $('.operation-status', $(this.el)).append(statusCodeView.render().el);
  1298. };
  1299. OperationView.prototype.submitOperation = function(e) {
  1300. var bodyParam, consumes, error_free, form, headerParams, invocationUrl, isFileUpload, isFormPost, map, o, obj, param, paramContentTypeField, responseContentTypeField, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3, _ref4,
  1301. _this = this;
  1302. if (e != null) {
  1303. e.preventDefault();
  1304. }
  1305. form = $('.sandbox', $(this.el));
  1306. error_free = true;
  1307. form.find("input.required").each(function() {
  1308. var _this = this;
  1309. $(this).removeClass("error");
  1310. if (jQuery.trim($(this).val()) === "") {
  1311. $(this).addClass("error");
  1312. $(this).wiggle({
  1313. callback: function() {
  1314. return $(_this).focus();
  1315. }
  1316. });
  1317. return error_free = false;
  1318. }
  1319. });
  1320. if (error_free) {
  1321. map = {};
  1322. _ref = form.serializeArray();
  1323. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1324. o = _ref[_i];
  1325. if ((o.value != null) && jQuery.trim(o.value).length > 0) {
  1326. map[o.name] = o.value;
  1327. }
  1328. }
  1329. isFileUpload = form.children().find('input[type~="file"]').size() !== 0;
  1330. isFormPost = false;
  1331. consumes = "application/json";
  1332. if (this.model.consumes && this.model.consumes.length > 0) {
  1333. consumes = this.model.consumes[0];
  1334. } else {
  1335. _ref1 = this.model.parameters;
  1336. for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
  1337. o = _ref1[_j];
  1338. if (o.paramType === 'form') {
  1339. isFormPost = true;
  1340. consumes = false;
  1341. }
  1342. }
  1343. if (isFileUpload) {
  1344. consumes = false;
  1345. } else if (this.model.httpMethod.toLowerCase() === "post" && isFormPost === false) {
  1346. consumes = "application/json";
  1347. }
  1348. }
  1349. if (isFileUpload) {
  1350. bodyParam = new FormData();
  1351. _ref2 = this.model.parameters;
  1352. for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
  1353. param = _ref2[_k];
  1354. if (param.paramType === 'body' && param.name !== 'file') {
  1355. bodyParam.append(param.name, map[param.name]);
  1356. }
  1357. }
  1358. $.each(form.children().find('input[type~="file"]'), function(i, el) {
  1359. return bodyParam.append($(el).attr('name'), el.files[0]);
  1360. });
  1361. console.log(bodyParam);
  1362. } else if (isFormPost) {
  1363. bodyParam = new FormData();
  1364. _ref3 = this.model.parameters;
  1365. for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
  1366. param = _ref3[_l];
  1367. bodyParam.append(param.name, map[param.name]);
  1368. }
  1369. } else {
  1370. bodyParam = null;
  1371. _ref4 = this.model.parameters;
  1372. for (_m = 0, _len4 = _ref4.length; _m < _len4; _m++) {
  1373. param = _ref4[_m];
  1374. if (param.paramType === 'body') {
  1375. bodyParam = map[param.name];
  1376. }
  1377. }
  1378. }
  1379. log("bodyParam = " + bodyParam);
  1380. headerParams = null;
  1381. invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), this.model.urlify(map, false)) : this.model.urlify(map, true);
  1382. log('submitting ' + invocationUrl);
  1383. $(".request_url", $(this.el)).html("<pre>" + invocationUrl + "</pre>");
  1384. $(".response_throbber", $(this.el)).show();
  1385. obj = {
  1386. type: this.model.httpMethod,
  1387. url: invocationUrl,
  1388. headers: headerParams,
  1389. data: bodyParam,
  1390. contentType: consumes,
  1391. dataType: 'json',
  1392. processData: false,
  1393. error: function(xhr, textStatus, error) {
  1394. return _this.showErrorStatus(xhr, textStatus, error);
  1395. },
  1396. success: function(data) {
  1397. return _this.showResponse(data);
  1398. },
  1399. complete: function(data) {
  1400. return _this.showCompleteStatus(data);
  1401. }
  1402. };
  1403. paramContentTypeField = $("td select[name=contentType]", $(this.el)).val();
  1404. if (paramContentTypeField) {
  1405. obj.contentType = paramContentTypeField;
  1406. }
  1407. responseContentTypeField = $('.content > .content-type > div > select[name=contentType]', $(this.el)).val();
  1408. if (responseContentTypeField) {
  1409. obj.headers = obj.headers != null ? obj.headers : {};
  1410. obj.headers.accept = responseContentTypeField;
  1411. }
  1412. jQuery.ajax(obj);
  1413. return false;
  1414. }
  1415. };
  1416. OperationView.prototype.hideResponse = function(e) {
  1417. if (e != null) {
  1418. e.preventDefault();
  1419. }
  1420. $(".response", $(this.el)).slideUp();
  1421. return $(".response_hider", $(this.el)).fadeOut();
  1422. };
  1423. OperationView.prototype.showResponse = function(response) {
  1424. var prettyJson;
  1425. prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");
  1426. return $(".response_body", $(this.el)).html(escape(prettyJson));
  1427. };
  1428. OperationView.prototype.showErrorStatus = function(data) {
  1429. return this.showStatus(data);
  1430. };
  1431. OperationView.prototype.showCompleteStatus = function(data) {
  1432. return this.showStatus(data);
  1433. };
  1434. OperationView.prototype.formatXml = function(xml) {
  1435. var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
  1436. reg = /(>)(<)(\/*)/g;
  1437. wsexp = /[ ]*(.*)[ ]+\n/g;
  1438. contexp = /(<.+>)(.+\n)/g;
  1439. xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
  1440. pad = 0;
  1441. formatted = '';
  1442. lines = xml.split('\n');
  1443. indent = 0;
  1444. lastType = 'other';
  1445. transitions = {
  1446. 'single->single': 0,
  1447. 'single->closing': -1,
  1448. 'single->opening': 0,
  1449. 'single->other': 0,
  1450. 'closing->single': 0,
  1451. 'closing->closing': -1,
  1452. 'closing->opening': 0,
  1453. 'closing->other': 0,
  1454. 'opening->single': 1,
  1455. 'opening->closing': 0,
  1456. 'opening->opening': 1,
  1457. 'opening->other': 1,
  1458. 'other->single': 0,
  1459. 'other->closing': -1,
  1460. 'other->opening': 0,
  1461. 'other->other': 0
  1462. };
  1463. _fn = function(ln) {
  1464. var fromTo, j, key, padding, type, types, value;
  1465. types = {
  1466. single: Boolean(ln.match(/<.+\/>/)),
  1467. closing: Boolean(ln.match(/<\/.+>/)),
  1468. opening: Boolean(ln.match(/<[^!?].*>/))
  1469. };
  1470. type = ((function() {
  1471. var _results;
  1472. _results = [];
  1473. for (key in types) {
  1474. value = types[key];
  1475. if (value) {
  1476. _results.push(key);
  1477. }
  1478. }
  1479. return _results;
  1480. })())[0];
  1481. type = type === void 0 ? 'other' : type;
  1482. fromTo = lastType + '->' + type;
  1483. lastType = type;
  1484. padding = '';
  1485. indent += transitions[fromTo];
  1486. padding = ((function() {
  1487. var _j, _ref, _results;
  1488. _results = [];
  1489. for (j = _j = 0, _ref = indent; 0 <= _ref ? _j < _ref : _j > _ref; j = 0 <= _ref ? ++_j : --_j) {
  1490. _results.push(' ');
  1491. }
  1492. return _results;
  1493. })()).join('');
  1494. if (fromTo === 'opening->closing') {
  1495. return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
  1496. } else {
  1497. return formatted += padding + ln + '\n';
  1498. }
  1499. };
  1500. for (_i = 0, _len = lines.length; _i < _len; _i++) {
  1501. ln = lines[_i];
  1502. _fn(ln);
  1503. }
  1504. return formatted;
  1505. };
  1506. OperationView.prototype.showStatus = function(data) {
  1507. var code, pre, response_body;
  1508. try {
  1509. code = $('<code />').text(JSON.stringify(JSON.parse(data.responseText), null, 2));
  1510. pre = $('<pre class="json" />').append(code);
  1511. } catch (error) {
  1512. code = $('<code />').text(this.formatXml(data.responseText));
  1513. pre = $('<pre class="xml" />').append(code);
  1514. }
  1515. response_body = pre;
  1516. $(".response_code", $(this.el)).html("<pre>" + data.status + "</pre>");
  1517. $(".response_body", $(this.el)).html(response_body);
  1518. $(".response_headers", $(this.el)).html("<pre>" + data.getAllResponseHeaders() + "</pre>");
  1519. $(".response", $(this.el)).slideDown();
  1520. $(".response_hider", $(this.el)).show();
  1521. $(".response_throbber", $(this.el)).hide();
  1522. return hljs.highlightBlock($('.response_body', $(this.el))[0]);
  1523. };
  1524. OperationView.prototype.toggleOperationContent = function() {
  1525. var elem;
  1526. elem = $('#' + this.model.resourceName + "_" + this.model.nickname + "_" + this.model.httpMethod + "_" + this.model.number + "_content");
  1527. if (elem.is(':visible')) {
  1528. return Docs.collapseOperation(elem);
  1529. } else {
  1530. return Docs.expandOperation(elem);
  1531. }
  1532. };
  1533. return OperationView;
  1534. })(Backbone.View);
  1535. StatusCodeView = (function(_super) {
  1536. __extends(StatusCodeView, _super);
  1537. function StatusCodeView() {
  1538. return StatusCodeView.__super__.constructor.apply(this, arguments);
  1539. }
  1540. StatusCodeView.prototype.initialize = function() {};
  1541. StatusCodeView.prototype.render = function() {
  1542. var template;
  1543. template = this.template();
  1544. $(this.el).html(template(this.model));
  1545. return this;
  1546. };
  1547. StatusCodeView.prototype.template = function() {
  1548. return Handlebars.templates.status_code;
  1549. };
  1550. return StatusCodeView;
  1551. })(Backbone.View);
  1552. ParameterView = (function(_super) {
  1553. __extends(ParameterView, _super);
  1554. function ParameterView() {
  1555. return ParameterView.__super__.constructor.apply(this, arguments);
  1556. }
  1557. ParameterView.prototype.initialize = function() {};
  1558. ParameterView.prototype.render = function() {
  1559. var contentTypeModel, contentTypeView, signatureModel, signatureView, template;
  1560. if (this.model.paramType === 'body') {
  1561. this.model.isBody = true;
  1562. }
  1563. if (this.model.dataType === 'file') {
  1564. this.model.isFile = true;
  1565. }
  1566. template = this.template();
  1567. $(this.el).html(template(this.model));
  1568. signatureModel = {
  1569. sampleJSON: this.model.sampleJSON,
  1570. isParam: true,
  1571. signature: this.model.signature
  1572. };
  1573. if (this.model.sampleJSON) {
  1574. signatureView = new SignatureView({
  1575. model: signatureModel,
  1576. tagName: 'div'
  1577. });
  1578. $('.model-signature', $(this.el)).append(signatureView.render().el);
  1579. } else {
  1580. $('.model-signature', $(this.el)).html(this.model.signature);
  1581. }
  1582. contentTypeModel = {
  1583. isParam: false
  1584. };
  1585. if (this.model.supportedContentTypes) {
  1586. contentTypeModel.produces = this.model.supportedContentTypes;
  1587. }
  1588. if (this.model.produces) {
  1589. contentTypeModel.produces = this.model.produces;
  1590. }
  1591. contentTypeView = new ContentTypeView({
  1592. model: contentTypeModel
  1593. });
  1594. $('.content-type', $(this.el)).append(contentTypeView.render().el);
  1595. return this;
  1596. };
  1597. ParameterView.prototype.template = function() {
  1598. if (this.model.isList) {
  1599. return Handlebars.templates.param_list;
  1600. } else {
  1601. if (this.options.readOnly) {
  1602. if (this.model.required) {
  1603. return Handlebars.templates.param_readonly_required;
  1604. } else {
  1605. return Handlebars.templates.param_readonly;
  1606. }
  1607. } else {
  1608. if (this.model.required) {
  1609. return Handlebars.templates.param_required;
  1610. } else {
  1611. return Handlebars.templates.param;
  1612. }
  1613. }
  1614. }
  1615. };
  1616. return ParameterView;
  1617. })(Backbone.View);
  1618. SignatureView = (function(_super) {
  1619. __extends(SignatureView, _super);
  1620. function SignatureView() {
  1621. return SignatureView.__super__.constructor.apply(this, arguments);
  1622. }
  1623. SignatureView.prototype.events = {
  1624. 'click a.description-link': 'switchToDescription',
  1625. 'click a.snippet-link': 'switchToSnippet',
  1626. 'mousedown .snippet': 'snippetToTextArea'
  1627. };
  1628. SignatureView.prototype.initialize = function() {};
  1629. SignatureView.prototype.render = function() {
  1630. var template;
  1631. template = this.template();
  1632. $(this.el).html(template(this.model));
  1633. this.switchToDescription();
  1634. this.isParam = this.model.isParam;
  1635. if (this.isParam) {
  1636. $('.notice', $(this.el)).text('Click to set as parameter value');
  1637. }
  1638. return this;
  1639. };
  1640. SignatureView.prototype.template = function() {
  1641. return Handlebars.templates.signature;
  1642. };
  1643. SignatureView.prototype.switchToDescription = function(e) {
  1644. if (e != null) {
  1645. e.preventDefault();
  1646. }
  1647. $(".snippet", $(this.el)).hide();
  1648. $(".description", $(this.el)).show();
  1649. $('.description-link', $(this.el)).addClass('selected');
  1650. return $('.snippet-link', $(this.el)).removeClass('selected');
  1651. };
  1652. SignatureView.prototype.switchToSnippet = function(e) {
  1653. if (e != null) {
  1654. e.preventDefault();
  1655. }
  1656. $(".description", $(this.el)).hide();
  1657. $(".snippet", $(this.el)).show();
  1658. $('.snippet-link', $(this.el)).addClass('selected');
  1659. return $('.description-link', $(this.el)).removeClass('selected');
  1660. };
  1661. SignatureView.prototype.snippetToTextArea = function(e) {
  1662. var textArea;
  1663. if (this.isParam) {
  1664. if (e != null) {
  1665. e.preventDefault();
  1666. }
  1667. textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
  1668. if ($.trim(textArea.val()) === '') {
  1669. return textArea.val(this.model.sampleJSON);
  1670. }
  1671. }
  1672. };
  1673. return SignatureView;
  1674. })(Backbone.View);
  1675. ContentTypeView = (function(_super) {
  1676. __extends(ContentTypeView, _super);
  1677. function ContentTypeView() {
  1678. return ContentTypeView.__super__.constructor.apply(this, arguments);
  1679. }
  1680. ContentTypeView.prototype.initialize = function() {};
  1681. ContentTypeView.prototype.render = function() {
  1682. var template;
  1683. template = this.template();
  1684. $(this.el).html(template(this.model));
  1685. this.isParam = this.model.isParam;
  1686. if (this.isParam) {
  1687. $('label[for=contentType]', $(this.el)).text('Parameter content type:');
  1688. } else {
  1689. $('label[for=contentType]', $(this.el)).text('Response Content Type');
  1690. }
  1691. return this;
  1692. };
  1693. ContentTypeView.prototype.template = function() {
  1694. return Handlebars.templates.content_type;
  1695. };
  1696. return ContentTypeView;
  1697. })(Backbone.View);
  1698. }).call(this);