您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

swagger-ui.js 88 KiB

11 年前
11 年前
11 年前
11 年前
11 年前
11 年前
11 年前
11 年前
11 年前
11 年前
11 年前
11 年前
11 年前
11 年前
11 年前
11 年前
11 年前
11 年前
11 年前
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240
  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, stack2;
  200. buffer += "\n <div class=\"info_title\">";
  201. foundHelper = helpers.info;
  202. stack1 = foundHelper || depth0.info;
  203. stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.title);
  204. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  205. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "info.title", { hash: {} }); }
  206. buffer += escapeExpression(stack1) + "</div>\n <div class=\"info_description\">";
  207. foundHelper = helpers.info;
  208. stack1 = foundHelper || depth0.info;
  209. stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.description);
  210. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  211. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "info.description", { hash: {} }); }
  212. if(stack1 || stack1 === 0) { buffer += stack1; }
  213. buffer += "</div>\n ";
  214. foundHelper = helpers.info;
  215. stack1 = foundHelper || depth0.info;
  216. stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.termsOfServiceUrl);
  217. stack2 = helpers['if'];
  218. tmp1 = self.program(2, program2, data);
  219. tmp1.hash = {};
  220. tmp1.fn = tmp1;
  221. tmp1.inverse = self.noop;
  222. stack1 = stack2.call(depth0, stack1, tmp1);
  223. if(stack1 || stack1 === 0) { buffer += stack1; }
  224. buffer += "\n ";
  225. foundHelper = helpers.info;
  226. stack1 = foundHelper || depth0.info;
  227. stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.contact);
  228. stack2 = helpers['if'];
  229. tmp1 = self.program(4, program4, data);
  230. tmp1.hash = {};
  231. tmp1.fn = tmp1;
  232. tmp1.inverse = self.noop;
  233. stack1 = stack2.call(depth0, stack1, tmp1);
  234. if(stack1 || stack1 === 0) { buffer += stack1; }
  235. buffer += "\n ";
  236. foundHelper = helpers.info;
  237. stack1 = foundHelper || depth0.info;
  238. stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.license);
  239. stack2 = helpers['if'];
  240. tmp1 = self.program(6, program6, data);
  241. tmp1.hash = {};
  242. tmp1.fn = tmp1;
  243. tmp1.inverse = self.noop;
  244. stack1 = stack2.call(depth0, stack1, tmp1);
  245. if(stack1 || stack1 === 0) { buffer += stack1; }
  246. buffer += "\n ";
  247. return buffer;}
  248. function program2(depth0,data) {
  249. var buffer = "", stack1;
  250. buffer += "<div class=\"info_tos\"><a href=\"";
  251. foundHelper = helpers.info;
  252. stack1 = foundHelper || depth0.info;
  253. stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.termsOfServiceUrl);
  254. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  255. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "info.termsOfServiceUrl", { hash: {} }); }
  256. buffer += escapeExpression(stack1) + "\">Terms of service</a></div>";
  257. return buffer;}
  258. function program4(depth0,data) {
  259. var buffer = "", stack1;
  260. buffer += "<div class='info_contact'><a href=\"mailto:";
  261. foundHelper = helpers.info;
  262. stack1 = foundHelper || depth0.info;
  263. stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.contact);
  264. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  265. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "info.contact", { hash: {} }); }
  266. buffer += escapeExpression(stack1) + "\">Contact the developer</a></div>";
  267. return buffer;}
  268. function program6(depth0,data) {
  269. var buffer = "", stack1;
  270. buffer += "<div class='info_license'><a href='";
  271. foundHelper = helpers.info;
  272. stack1 = foundHelper || depth0.info;
  273. stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.licenseUrl);
  274. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  275. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "info.licenseUrl", { hash: {} }); }
  276. buffer += escapeExpression(stack1) + "'>";
  277. foundHelper = helpers.info;
  278. stack1 = foundHelper || depth0.info;
  279. stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.license);
  280. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  281. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "info.license", { hash: {} }); }
  282. buffer += escapeExpression(stack1) + "</a></div>";
  283. return buffer;}
  284. function program8(depth0,data) {
  285. var buffer = "", stack1;
  286. buffer += "\n , <span style=\"font-variant: small-caps\">api version</span>: ";
  287. foundHelper = helpers.apiVersion;
  288. stack1 = foundHelper || depth0.apiVersion;
  289. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  290. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "apiVersion", { hash: {} }); }
  291. buffer += escapeExpression(stack1) + "\n ";
  292. return buffer;}
  293. buffer += "<div class='info' id='api_info'>\n ";
  294. foundHelper = helpers.info;
  295. stack1 = foundHelper || depth0.info;
  296. stack2 = helpers['if'];
  297. tmp1 = self.program(1, program1, data);
  298. tmp1.hash = {};
  299. tmp1.fn = tmp1;
  300. tmp1.inverse = self.noop;
  301. stack1 = stack2.call(depth0, stack1, tmp1);
  302. if(stack1 || stack1 === 0) { buffer += stack1; }
  303. buffer += "\n</div>\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>: ";
  304. foundHelper = helpers.basePath;
  305. stack1 = foundHelper || depth0.basePath;
  306. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  307. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "basePath", { hash: {} }); }
  308. buffer += escapeExpression(stack1) + "\n ";
  309. foundHelper = helpers.apiVersion;
  310. stack1 = foundHelper || depth0.apiVersion;
  311. stack2 = helpers['if'];
  312. tmp1 = self.program(8, program8, data);
  313. tmp1.hash = {};
  314. tmp1.fn = tmp1;
  315. tmp1.inverse = self.noop;
  316. stack1 = stack2.call(depth0, stack1, tmp1);
  317. if(stack1 || stack1 === 0) { buffer += stack1; }
  318. buffer += "]</h4>\n </div>\n</div>\n";
  319. return buffer;});
  320. })();
  321. (function() {
  322. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  323. templates['operation'] = template(function (Handlebars,depth0,helpers,partials,data) {
  324. helpers = helpers || Handlebars.helpers;
  325. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  326. function program1(depth0,data) {
  327. var buffer = "", stack1;
  328. buffer += "\n <h4>Implementation Notes</h4>\n <p>";
  329. foundHelper = helpers.notes;
  330. stack1 = foundHelper || depth0.notes;
  331. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  332. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "notes", { hash: {} }); }
  333. if(stack1 || stack1 === 0) { buffer += stack1; }
  334. buffer += "</p>\n ";
  335. return buffer;}
  336. function program3(depth0,data) {
  337. return "\n <h4>Response Class</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n ";}
  338. function program5(depth0,data) {
  339. 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: 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 ";}
  340. function program7(depth0,data) {
  341. return "\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Error 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 ";}
  342. function program9(depth0,data) {
  343. return "\n ";}
  344. function program11(depth0,data) {
  345. 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 ";}
  346. buffer += "\n <ul class='operations' >\n <li class='";
  347. foundHelper = helpers.method;
  348. stack1 = foundHelper || depth0.method;
  349. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  350. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "method", { hash: {} }); }
  351. buffer += escapeExpression(stack1) + " operation' 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.method;
  363. stack1 = foundHelper || depth0.method;
  364. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  365. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "method", { 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) + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/";
  372. foundHelper = helpers.resourceName;
  373. stack1 = foundHelper || depth0.resourceName;
  374. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  375. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
  376. buffer += escapeExpression(stack1) + "/";
  377. foundHelper = helpers.nickname;
  378. stack1 = foundHelper || depth0.nickname;
  379. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  380. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
  381. buffer += escapeExpression(stack1) + "_";
  382. foundHelper = helpers.method;
  383. stack1 = foundHelper || depth0.method;
  384. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  385. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "method", { hash: {} }); }
  386. buffer += escapeExpression(stack1) + "_";
  387. foundHelper = helpers.number;
  388. stack1 = foundHelper || depth0.number;
  389. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  390. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "number", { hash: {} }); }
  391. buffer += escapeExpression(stack1) + "' class=\"toggleOperation\">";
  392. foundHelper = helpers.method;
  393. stack1 = foundHelper || depth0.method;
  394. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  395. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "method", { hash: {} }); }
  396. buffer += escapeExpression(stack1) + "</a>\n </span>\n <span class='path'>\n <a href='#!/";
  397. foundHelper = helpers.resourceName;
  398. stack1 = foundHelper || depth0.resourceName;
  399. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  400. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
  401. buffer += escapeExpression(stack1) + "/";
  402. foundHelper = helpers.nickname;
  403. stack1 = foundHelper || depth0.nickname;
  404. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  405. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
  406. buffer += escapeExpression(stack1) + "_";
  407. foundHelper = helpers.method;
  408. stack1 = foundHelper || depth0.method;
  409. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  410. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "method", { hash: {} }); }
  411. buffer += escapeExpression(stack1) + "_";
  412. foundHelper = helpers.number;
  413. stack1 = foundHelper || depth0.number;
  414. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  415. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "number", { hash: {} }); }
  416. buffer += escapeExpression(stack1) + "' class=\"toggleOperation\">";
  417. foundHelper = helpers.path;
  418. stack1 = foundHelper || depth0.path;
  419. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  420. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "path", { hash: {} }); }
  421. buffer += escapeExpression(stack1) + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/";
  422. foundHelper = helpers.resourceName;
  423. stack1 = foundHelper || depth0.resourceName;
  424. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  425. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
  426. buffer += escapeExpression(stack1) + "/";
  427. foundHelper = helpers.nickname;
  428. stack1 = foundHelper || depth0.nickname;
  429. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  430. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
  431. buffer += escapeExpression(stack1) + "_";
  432. foundHelper = helpers.method;
  433. stack1 = foundHelper || depth0.method;
  434. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  435. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "method", { hash: {} }); }
  436. buffer += escapeExpression(stack1) + "_";
  437. foundHelper = helpers.number;
  438. stack1 = foundHelper || depth0.number;
  439. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  440. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "number", { hash: {} }); }
  441. buffer += escapeExpression(stack1) + "' class=\"toggleOperation\">";
  442. foundHelper = helpers.summary;
  443. stack1 = foundHelper || depth0.summary;
  444. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  445. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "summary", { hash: {} }); }
  446. if(stack1 || stack1 === 0) { buffer += stack1; }
  447. buffer += "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='";
  448. foundHelper = helpers.resourceName;
  449. stack1 = foundHelper || depth0.resourceName;
  450. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  451. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
  452. buffer += escapeExpression(stack1) + "_";
  453. foundHelper = helpers.nickname;
  454. stack1 = foundHelper || depth0.nickname;
  455. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  456. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
  457. buffer += escapeExpression(stack1) + "_";
  458. foundHelper = helpers.method;
  459. stack1 = foundHelper || depth0.method;
  460. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  461. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "method", { hash: {} }); }
  462. buffer += escapeExpression(stack1) + "_";
  463. foundHelper = helpers.number;
  464. stack1 = foundHelper || depth0.number;
  465. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  466. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "number", { hash: {} }); }
  467. buffer += escapeExpression(stack1) + "_content' style='display:none'>\n ";
  468. foundHelper = helpers.notes;
  469. stack1 = foundHelper || depth0.notes;
  470. stack2 = helpers['if'];
  471. tmp1 = self.program(1, program1, data);
  472. tmp1.hash = {};
  473. tmp1.fn = tmp1;
  474. tmp1.inverse = self.noop;
  475. stack1 = stack2.call(depth0, stack1, tmp1);
  476. if(stack1 || stack1 === 0) { buffer += stack1; }
  477. buffer += "\n ";
  478. foundHelper = helpers.responseClass;
  479. stack1 = foundHelper || depth0.responseClass;
  480. stack2 = helpers['if'];
  481. tmp1 = self.program(3, program3, data);
  482. tmp1.hash = {};
  483. tmp1.fn = tmp1;
  484. tmp1.inverse = self.noop;
  485. stack1 = stack2.call(depth0, stack1, tmp1);
  486. if(stack1 || stack1 === 0) { buffer += stack1; }
  487. buffer += "\n <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n ";
  488. foundHelper = helpers.parameters;
  489. stack1 = foundHelper || depth0.parameters;
  490. stack2 = helpers['if'];
  491. tmp1 = self.program(5, program5, data);
  492. tmp1.hash = {};
  493. tmp1.fn = tmp1;
  494. tmp1.inverse = self.noop;
  495. stack1 = stack2.call(depth0, stack1, tmp1);
  496. if(stack1 || stack1 === 0) { buffer += stack1; }
  497. buffer += "\n ";
  498. foundHelper = helpers.errorResponses;
  499. stack1 = foundHelper || depth0.errorResponses;
  500. stack2 = helpers['if'];
  501. tmp1 = self.program(7, program7, data);
  502. tmp1.hash = {};
  503. tmp1.fn = tmp1;
  504. tmp1.inverse = self.noop;
  505. stack1 = stack2.call(depth0, stack1, tmp1);
  506. if(stack1 || stack1 === 0) { buffer += stack1; }
  507. buffer += "\n ";
  508. foundHelper = helpers.isReadOnly;
  509. stack1 = foundHelper || depth0.isReadOnly;
  510. stack2 = helpers['if'];
  511. tmp1 = self.program(9, program9, data);
  512. tmp1.hash = {};
  513. tmp1.fn = tmp1;
  514. tmp1.inverse = self.program(11, program11, data);
  515. stack1 = stack2.call(depth0, stack1, tmp1);
  516. if(stack1 || stack1 === 0) { buffer += stack1; }
  517. 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";
  518. return buffer;});
  519. })();
  520. (function() {
  521. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  522. templates['param'] = template(function (Handlebars,depth0,helpers,partials,data) {
  523. helpers = helpers || Handlebars.helpers;
  524. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  525. function program1(depth0,data) {
  526. var buffer = "", stack1, stack2;
  527. buffer += "\n ";
  528. foundHelper = helpers.isFile;
  529. stack1 = foundHelper || depth0.isFile;
  530. stack2 = helpers['if'];
  531. tmp1 = self.program(2, program2, data);
  532. tmp1.hash = {};
  533. tmp1.fn = tmp1;
  534. tmp1.inverse = self.program(4, program4, data);
  535. stack1 = stack2.call(depth0, stack1, tmp1);
  536. if(stack1 || stack1 === 0) { buffer += stack1; }
  537. buffer += "\n ";
  538. return buffer;}
  539. function program2(depth0,data) {
  540. var buffer = "", stack1;
  541. buffer += "\n <input type=\"file\" name='";
  542. foundHelper = helpers.name;
  543. stack1 = foundHelper || depth0.name;
  544. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  545. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  546. buffer += escapeExpression(stack1) + "'/>\n <div class=\"parameter-content-type\" />\n ";
  547. return buffer;}
  548. function program4(depth0,data) {
  549. var buffer = "", stack1, stack2;
  550. buffer += "\n ";
  551. foundHelper = helpers.defaultValue;
  552. stack1 = foundHelper || depth0.defaultValue;
  553. stack2 = helpers['if'];
  554. tmp1 = self.program(5, program5, data);
  555. tmp1.hash = {};
  556. tmp1.fn = tmp1;
  557. tmp1.inverse = self.program(7, program7, data);
  558. stack1 = stack2.call(depth0, stack1, tmp1);
  559. if(stack1 || stack1 === 0) { buffer += stack1; }
  560. buffer += "\n ";
  561. return buffer;}
  562. function program5(depth0,data) {
  563. var buffer = "", stack1;
  564. buffer += "\n <textarea class='body-textarea' name='";
  565. foundHelper = helpers.name;
  566. stack1 = foundHelper || depth0.name;
  567. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  568. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  569. buffer += escapeExpression(stack1) + "'>";
  570. foundHelper = helpers.defaultValue;
  571. stack1 = foundHelper || depth0.defaultValue;
  572. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  573. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  574. buffer += escapeExpression(stack1) + "</textarea>\n ";
  575. return buffer;}
  576. function program7(depth0,data) {
  577. var buffer = "", stack1;
  578. buffer += "\n <textarea class='body-textarea' name='";
  579. foundHelper = helpers.name;
  580. stack1 = foundHelper || depth0.name;
  581. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  582. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  583. buffer += escapeExpression(stack1) + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n ";
  584. return buffer;}
  585. function program9(depth0,data) {
  586. var buffer = "", stack1, stack2;
  587. buffer += "\n ";
  588. foundHelper = helpers.defaultValue;
  589. stack1 = foundHelper || depth0.defaultValue;
  590. stack2 = helpers['if'];
  591. tmp1 = self.program(10, program10, data);
  592. tmp1.hash = {};
  593. tmp1.fn = tmp1;
  594. tmp1.inverse = self.program(12, program12, data);
  595. stack1 = stack2.call(depth0, stack1, tmp1);
  596. if(stack1 || stack1 === 0) { buffer += stack1; }
  597. buffer += "\n ";
  598. return buffer;}
  599. function program10(depth0,data) {
  600. var buffer = "", stack1;
  601. buffer += "\n <input class='parameter' minlength='0' name='";
  602. foundHelper = helpers.name;
  603. stack1 = foundHelper || depth0.name;
  604. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  605. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  606. buffer += escapeExpression(stack1) + "' placeholder='' type='text' value='";
  607. foundHelper = helpers.defaultValue;
  608. stack1 = foundHelper || depth0.defaultValue;
  609. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  610. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  611. buffer += escapeExpression(stack1) + "'/>\n ";
  612. return buffer;}
  613. function program12(depth0,data) {
  614. var buffer = "", stack1;
  615. buffer += "\n <input class='parameter' minlength='0' name='";
  616. foundHelper = helpers.name;
  617. stack1 = foundHelper || depth0.name;
  618. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  619. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  620. buffer += escapeExpression(stack1) + "' placeholder='' type='text' value=''/>\n ";
  621. return buffer;}
  622. buffer += "<td class='code'>";
  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) + "</td>\n<td>\n\n ";
  628. foundHelper = helpers.isBody;
  629. stack1 = foundHelper || depth0.isBody;
  630. stack2 = helpers['if'];
  631. tmp1 = self.program(1, program1, data);
  632. tmp1.hash = {};
  633. tmp1.fn = tmp1;
  634. tmp1.inverse = self.program(9, program9, data);
  635. stack1 = stack2.call(depth0, stack1, tmp1);
  636. if(stack1 || stack1 === 0) { buffer += stack1; }
  637. buffer += "\n\n</td>\n<td>";
  638. foundHelper = helpers.description;
  639. stack1 = foundHelper || depth0.description;
  640. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  641. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
  642. if(stack1 || stack1 === 0) { buffer += stack1; }
  643. buffer += "</td>\n<td>";
  644. foundHelper = helpers.paramType;
  645. stack1 = foundHelper || depth0.paramType;
  646. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  647. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "paramType", { hash: {} }); }
  648. if(stack1 || stack1 === 0) { buffer += stack1; }
  649. buffer += "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n";
  650. return buffer;});
  651. })();
  652. (function() {
  653. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  654. templates['param_list'] = template(function (Handlebars,depth0,helpers,partials,data) {
  655. helpers = helpers || Handlebars.helpers;
  656. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  657. function program1(depth0,data) {
  658. return "\n ";}
  659. function program3(depth0,data) {
  660. var buffer = "", stack1, stack2;
  661. buffer += "\n ";
  662. foundHelper = helpers.defaultValue;
  663. stack1 = foundHelper || depth0.defaultValue;
  664. stack2 = helpers['if'];
  665. tmp1 = self.program(4, program4, data);
  666. tmp1.hash = {};
  667. tmp1.fn = tmp1;
  668. tmp1.inverse = self.program(6, program6, data);
  669. stack1 = stack2.call(depth0, stack1, tmp1);
  670. if(stack1 || stack1 === 0) { buffer += stack1; }
  671. buffer += "\n ";
  672. return buffer;}
  673. function program4(depth0,data) {
  674. return "\n ";}
  675. function program6(depth0,data) {
  676. return "\n <option selected=\"\" value=''></option>\n ";}
  677. function program8(depth0,data) {
  678. var buffer = "", stack1, stack2;
  679. buffer += "\n ";
  680. foundHelper = helpers.isDefault;
  681. stack1 = foundHelper || depth0.isDefault;
  682. stack2 = helpers['if'];
  683. tmp1 = self.program(9, program9, data);
  684. tmp1.hash = {};
  685. tmp1.fn = tmp1;
  686. tmp1.inverse = self.program(11, program11, data);
  687. stack1 = stack2.call(depth0, stack1, tmp1);
  688. if(stack1 || stack1 === 0) { buffer += stack1; }
  689. buffer += "\n ";
  690. return buffer;}
  691. function program9(depth0,data) {
  692. var buffer = "", stack1;
  693. buffer += "\n <option value='";
  694. foundHelper = helpers.value;
  695. stack1 = foundHelper || depth0.value;
  696. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  697. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }
  698. buffer += escapeExpression(stack1) + "'>";
  699. foundHelper = helpers.value;
  700. stack1 = foundHelper || depth0.value;
  701. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  702. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }
  703. buffer += escapeExpression(stack1) + " (default)</option>\n ";
  704. return buffer;}
  705. function program11(depth0,data) {
  706. var buffer = "", stack1;
  707. buffer += "\n <option value='";
  708. foundHelper = helpers.value;
  709. stack1 = foundHelper || depth0.value;
  710. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  711. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }
  712. buffer += escapeExpression(stack1) + "'>";
  713. foundHelper = helpers.value;
  714. stack1 = foundHelper || depth0.value;
  715. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  716. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }
  717. buffer += escapeExpression(stack1) + "</option>\n ";
  718. return buffer;}
  719. buffer += "<td class='code'>";
  720. foundHelper = helpers.name;
  721. stack1 = foundHelper || depth0.name;
  722. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  723. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  724. buffer += escapeExpression(stack1) + "</td>\n<td>\n <select class='parameter' name='";
  725. foundHelper = helpers.name;
  726. stack1 = foundHelper || depth0.name;
  727. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  728. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  729. buffer += escapeExpression(stack1) + "'>\n ";
  730. foundHelper = helpers.required;
  731. stack1 = foundHelper || depth0.required;
  732. stack2 = helpers['if'];
  733. tmp1 = self.program(1, program1, data);
  734. tmp1.hash = {};
  735. tmp1.fn = tmp1;
  736. tmp1.inverse = self.program(3, program3, data);
  737. stack1 = stack2.call(depth0, stack1, tmp1);
  738. if(stack1 || stack1 === 0) { buffer += stack1; }
  739. buffer += "\n ";
  740. foundHelper = helpers.allowableValues;
  741. stack1 = foundHelper || depth0.allowableValues;
  742. stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.descriptiveValues);
  743. stack2 = helpers.each;
  744. tmp1 = self.program(8, program8, data);
  745. tmp1.hash = {};
  746. tmp1.fn = tmp1;
  747. tmp1.inverse = self.noop;
  748. stack1 = stack2.call(depth0, stack1, tmp1);
  749. if(stack1 || stack1 === 0) { buffer += stack1; }
  750. buffer += "\n </select>\n</td>\n<td>";
  751. foundHelper = helpers.description;
  752. stack1 = foundHelper || depth0.description;
  753. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  754. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
  755. if(stack1 || stack1 === 0) { buffer += stack1; }
  756. buffer += "</td>\n<td>";
  757. foundHelper = helpers.paramType;
  758. stack1 = foundHelper || depth0.paramType;
  759. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  760. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "paramType", { hash: {} }); }
  761. if(stack1 || stack1 === 0) { buffer += stack1; }
  762. buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n";
  763. return buffer;});
  764. })();
  765. (function() {
  766. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  767. templates['param_readonly'] = template(function (Handlebars,depth0,helpers,partials,data) {
  768. helpers = helpers || Handlebars.helpers;
  769. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  770. function program1(depth0,data) {
  771. var buffer = "", stack1;
  772. buffer += "\n <textarea class='body-textarea' readonly='readonly' name='";
  773. foundHelper = helpers.name;
  774. stack1 = foundHelper || depth0.name;
  775. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  776. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  777. buffer += escapeExpression(stack1) + "'>";
  778. foundHelper = helpers.defaultValue;
  779. stack1 = foundHelper || depth0.defaultValue;
  780. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  781. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  782. buffer += escapeExpression(stack1) + "</textarea>\n ";
  783. return buffer;}
  784. function program3(depth0,data) {
  785. var buffer = "", stack1, stack2;
  786. buffer += "\n ";
  787. foundHelper = helpers.defaultValue;
  788. stack1 = foundHelper || depth0.defaultValue;
  789. stack2 = helpers['if'];
  790. tmp1 = self.program(4, program4, data);
  791. tmp1.hash = {};
  792. tmp1.fn = tmp1;
  793. tmp1.inverse = self.program(6, program6, data);
  794. stack1 = stack2.call(depth0, stack1, tmp1);
  795. if(stack1 || stack1 === 0) { buffer += stack1; }
  796. buffer += "\n ";
  797. return buffer;}
  798. function program4(depth0,data) {
  799. var buffer = "", stack1;
  800. buffer += "\n ";
  801. foundHelper = helpers.defaultValue;
  802. stack1 = foundHelper || depth0.defaultValue;
  803. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  804. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  805. buffer += escapeExpression(stack1) + "\n ";
  806. return buffer;}
  807. function program6(depth0,data) {
  808. return "\n (empty)\n ";}
  809. buffer += "<td class='code'>";
  810. foundHelper = helpers.name;
  811. stack1 = foundHelper || depth0.name;
  812. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  813. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  814. buffer += escapeExpression(stack1) + "</td>\n<td>\n ";
  815. foundHelper = helpers.isBody;
  816. stack1 = foundHelper || depth0.isBody;
  817. stack2 = helpers['if'];
  818. tmp1 = self.program(1, program1, data);
  819. tmp1.hash = {};
  820. tmp1.fn = tmp1;
  821. tmp1.inverse = self.program(3, program3, data);
  822. stack1 = stack2.call(depth0, stack1, tmp1);
  823. if(stack1 || stack1 === 0) { buffer += stack1; }
  824. buffer += "\n</td>\n<td>";
  825. foundHelper = helpers.description;
  826. stack1 = foundHelper || depth0.description;
  827. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  828. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
  829. if(stack1 || stack1 === 0) { buffer += stack1; }
  830. buffer += "</td>\n<td>";
  831. foundHelper = helpers.paramType;
  832. stack1 = foundHelper || depth0.paramType;
  833. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  834. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "paramType", { hash: {} }); }
  835. if(stack1 || stack1 === 0) { buffer += stack1; }
  836. buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n";
  837. return buffer;});
  838. })();
  839. (function() {
  840. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  841. templates['param_readonly_required'] = template(function (Handlebars,depth0,helpers,partials,data) {
  842. helpers = helpers || Handlebars.helpers;
  843. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  844. function program1(depth0,data) {
  845. var buffer = "", stack1;
  846. buffer += "\n <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='";
  847. foundHelper = helpers.name;
  848. stack1 = foundHelper || depth0.name;
  849. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  850. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  851. buffer += escapeExpression(stack1) + "'>";
  852. foundHelper = helpers.defaultValue;
  853. stack1 = foundHelper || depth0.defaultValue;
  854. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  855. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  856. buffer += escapeExpression(stack1) + "</textarea>\n ";
  857. return buffer;}
  858. function program3(depth0,data) {
  859. var buffer = "", stack1, stack2;
  860. buffer += "\n ";
  861. foundHelper = helpers.defaultValue;
  862. stack1 = foundHelper || depth0.defaultValue;
  863. stack2 = helpers['if'];
  864. tmp1 = self.program(4, program4, data);
  865. tmp1.hash = {};
  866. tmp1.fn = tmp1;
  867. tmp1.inverse = self.program(6, program6, data);
  868. stack1 = stack2.call(depth0, stack1, tmp1);
  869. if(stack1 || stack1 === 0) { buffer += stack1; }
  870. buffer += "\n ";
  871. return buffer;}
  872. function program4(depth0,data) {
  873. var buffer = "", stack1;
  874. buffer += "\n ";
  875. foundHelper = helpers.defaultValue;
  876. stack1 = foundHelper || depth0.defaultValue;
  877. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  878. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  879. buffer += escapeExpression(stack1) + "\n ";
  880. return buffer;}
  881. function program6(depth0,data) {
  882. return "\n (empty)\n ";}
  883. buffer += "<td class='code required'>";
  884. foundHelper = helpers.name;
  885. stack1 = foundHelper || depth0.name;
  886. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  887. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  888. buffer += escapeExpression(stack1) + "</td>\n<td>\n ";
  889. foundHelper = helpers.isBody;
  890. stack1 = foundHelper || depth0.isBody;
  891. stack2 = helpers['if'];
  892. tmp1 = self.program(1, program1, data);
  893. tmp1.hash = {};
  894. tmp1.fn = tmp1;
  895. tmp1.inverse = self.program(3, program3, data);
  896. stack1 = stack2.call(depth0, stack1, tmp1);
  897. if(stack1 || stack1 === 0) { buffer += stack1; }
  898. buffer += "\n</td>\n<td>";
  899. foundHelper = helpers.description;
  900. stack1 = foundHelper || depth0.description;
  901. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  902. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
  903. if(stack1 || stack1 === 0) { buffer += stack1; }
  904. buffer += "</td>\n<td>";
  905. foundHelper = helpers.paramType;
  906. stack1 = foundHelper || depth0.paramType;
  907. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  908. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "paramType", { hash: {} }); }
  909. if(stack1 || stack1 === 0) { buffer += stack1; }
  910. buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n";
  911. return buffer;});
  912. })();
  913. (function() {
  914. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  915. templates['param_required'] = template(function (Handlebars,depth0,helpers,partials,data) {
  916. helpers = helpers || Handlebars.helpers;
  917. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  918. function program1(depth0,data) {
  919. var buffer = "", stack1, stack2;
  920. buffer += "\n ";
  921. foundHelper = helpers.isFile;
  922. stack1 = foundHelper || depth0.isFile;
  923. stack2 = helpers['if'];
  924. tmp1 = self.program(2, program2, data);
  925. tmp1.hash = {};
  926. tmp1.fn = tmp1;
  927. tmp1.inverse = self.program(4, program4, data);
  928. stack1 = stack2.call(depth0, stack1, tmp1);
  929. if(stack1 || stack1 === 0) { buffer += stack1; }
  930. buffer += "\n ";
  931. return buffer;}
  932. function program2(depth0,data) {
  933. var buffer = "", stack1;
  934. buffer += "\n <input type=\"file\" name='";
  935. foundHelper = helpers.name;
  936. stack1 = foundHelper || depth0.name;
  937. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  938. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  939. buffer += escapeExpression(stack1) + "'/>\n ";
  940. return buffer;}
  941. function program4(depth0,data) {
  942. var buffer = "", stack1, stack2;
  943. buffer += "\n ";
  944. foundHelper = helpers.defaultValue;
  945. stack1 = foundHelper || depth0.defaultValue;
  946. stack2 = helpers['if'];
  947. tmp1 = self.program(5, program5, data);
  948. tmp1.hash = {};
  949. tmp1.fn = tmp1;
  950. tmp1.inverse = self.program(7, program7, data);
  951. stack1 = stack2.call(depth0, stack1, tmp1);
  952. if(stack1 || stack1 === 0) { buffer += stack1; }
  953. buffer += "\n ";
  954. return buffer;}
  955. function program5(depth0,data) {
  956. var buffer = "", stack1;
  957. buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='";
  958. foundHelper = helpers.name;
  959. stack1 = foundHelper || depth0.name;
  960. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  961. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  962. buffer += escapeExpression(stack1) + "'>";
  963. foundHelper = helpers.defaultValue;
  964. stack1 = foundHelper || depth0.defaultValue;
  965. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  966. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  967. buffer += escapeExpression(stack1) + "</textarea>\n ";
  968. return buffer;}
  969. function program7(depth0,data) {
  970. var buffer = "", stack1;
  971. buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='";
  972. foundHelper = helpers.name;
  973. stack1 = foundHelper || depth0.name;
  974. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  975. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  976. buffer += escapeExpression(stack1) + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n ";
  977. return buffer;}
  978. function program9(depth0,data) {
  979. var buffer = "", stack1, stack2;
  980. buffer += "\n ";
  981. foundHelper = helpers.isFile;
  982. stack1 = foundHelper || depth0.isFile;
  983. stack2 = helpers['if'];
  984. tmp1 = self.program(10, program10, data);
  985. tmp1.hash = {};
  986. tmp1.fn = tmp1;
  987. tmp1.inverse = self.program(12, program12, data);
  988. stack1 = stack2.call(depth0, stack1, tmp1);
  989. if(stack1 || stack1 === 0) { buffer += stack1; }
  990. buffer += "\n ";
  991. return buffer;}
  992. function program10(depth0,data) {
  993. var buffer = "", stack1;
  994. buffer += "\n <input class='parameter' class='required' type='file' name='";
  995. foundHelper = helpers.name;
  996. stack1 = foundHelper || depth0.name;
  997. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  998. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  999. buffer += escapeExpression(stack1) + "'/>\n ";
  1000. return buffer;}
  1001. function program12(depth0,data) {
  1002. var buffer = "", stack1, stack2;
  1003. buffer += "\n ";
  1004. foundHelper = helpers.defaultValue;
  1005. stack1 = foundHelper || depth0.defaultValue;
  1006. stack2 = helpers['if'];
  1007. tmp1 = self.program(13, program13, data);
  1008. tmp1.hash = {};
  1009. tmp1.fn = tmp1;
  1010. tmp1.inverse = self.program(15, program15, data);
  1011. stack1 = stack2.call(depth0, stack1, tmp1);
  1012. if(stack1 || stack1 === 0) { buffer += stack1; }
  1013. buffer += "\n ";
  1014. return buffer;}
  1015. function program13(depth0,data) {
  1016. var buffer = "", stack1;
  1017. buffer += "\n <input class='parameter required' minlength='1' name='";
  1018. foundHelper = helpers.name;
  1019. stack1 = foundHelper || depth0.name;
  1020. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1021. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  1022. buffer += escapeExpression(stack1) + "' placeholder='(required)' type='text' value='";
  1023. foundHelper = helpers.defaultValue;
  1024. stack1 = foundHelper || depth0.defaultValue;
  1025. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1026. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  1027. buffer += escapeExpression(stack1) + "'/>\n ";
  1028. return buffer;}
  1029. function program15(depth0,data) {
  1030. var buffer = "", stack1;
  1031. buffer += "\n <input class='parameter required' minlength='1' name='";
  1032. foundHelper = helpers.name;
  1033. stack1 = foundHelper || depth0.name;
  1034. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1035. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  1036. buffer += escapeExpression(stack1) + "' placeholder='(required)' type='text' value=''/>\n ";
  1037. return buffer;}
  1038. buffer += "<td class='code required'>";
  1039. foundHelper = helpers.name;
  1040. stack1 = foundHelper || depth0.name;
  1041. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1042. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  1043. buffer += escapeExpression(stack1) + "</td>\n<td>\n ";
  1044. foundHelper = helpers.isBody;
  1045. stack1 = foundHelper || depth0.isBody;
  1046. stack2 = helpers['if'];
  1047. tmp1 = self.program(1, program1, data);
  1048. tmp1.hash = {};
  1049. tmp1.fn = tmp1;
  1050. tmp1.inverse = self.program(9, program9, data);
  1051. stack1 = stack2.call(depth0, stack1, tmp1);
  1052. if(stack1 || stack1 === 0) { buffer += stack1; }
  1053. buffer += "\n</td>\n<td>\n <strong>";
  1054. foundHelper = helpers.description;
  1055. stack1 = foundHelper || depth0.description;
  1056. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1057. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
  1058. if(stack1 || stack1 === 0) { buffer += stack1; }
  1059. buffer += "</strong>\n</td>\n<td>";
  1060. foundHelper = helpers.paramType;
  1061. stack1 = foundHelper || depth0.paramType;
  1062. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1063. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "paramType", { hash: {} }); }
  1064. if(stack1 || stack1 === 0) { buffer += stack1; }
  1065. buffer += "</td>\n<td><span class=\"model-signature\"></span></td>\n";
  1066. return buffer;});
  1067. })();
  1068. (function() {
  1069. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  1070. templates['parameter_content_type'] = template(function (Handlebars,depth0,helpers,partials,data) {
  1071. helpers = helpers || Handlebars.helpers;
  1072. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0;
  1073. function program1(depth0,data) {
  1074. var buffer = "", stack1, stack2;
  1075. buffer += "\n ";
  1076. foundHelper = helpers.consumes;
  1077. stack1 = foundHelper || depth0.consumes;
  1078. stack2 = helpers.each;
  1079. tmp1 = self.program(2, program2, data);
  1080. tmp1.hash = {};
  1081. tmp1.fn = tmp1;
  1082. tmp1.inverse = self.noop;
  1083. stack1 = stack2.call(depth0, stack1, tmp1);
  1084. if(stack1 || stack1 === 0) { buffer += stack1; }
  1085. buffer += "\n";
  1086. return buffer;}
  1087. function program2(depth0,data) {
  1088. var buffer = "", stack1;
  1089. buffer += "\n <option value=\"";
  1090. stack1 = depth0;
  1091. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1092. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "this", { hash: {} }); }
  1093. if(stack1 || stack1 === 0) { buffer += stack1; }
  1094. buffer += "\">";
  1095. stack1 = depth0;
  1096. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1097. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "this", { hash: {} }); }
  1098. if(stack1 || stack1 === 0) { buffer += stack1; }
  1099. buffer += "</option>\n ";
  1100. return buffer;}
  1101. function program4(depth0,data) {
  1102. return "\n <option value=\"application/json\">application/json</option>\n";}
  1103. buffer += "<label for=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
  1104. foundHelper = helpers.consumes;
  1105. stack1 = foundHelper || depth0.consumes;
  1106. stack2 = helpers['if'];
  1107. tmp1 = self.program(1, program1, data);
  1108. tmp1.hash = {};
  1109. tmp1.fn = tmp1;
  1110. tmp1.inverse = self.program(4, program4, data);
  1111. stack1 = stack2.call(depth0, stack1, tmp1);
  1112. if(stack1 || stack1 === 0) { buffer += stack1; }
  1113. buffer += "\n</select>\n";
  1114. return buffer;});
  1115. })();
  1116. (function() {
  1117. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  1118. templates['resource'] = template(function (Handlebars,depth0,helpers,partials,data) {
  1119. helpers = helpers || Handlebars.helpers;
  1120. var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  1121. buffer += "<div class='heading'>\n <h2>\n <a href='#!/";
  1122. foundHelper = helpers.name;
  1123. stack1 = foundHelper || depth0.name;
  1124. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1125. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  1126. buffer += escapeExpression(stack1) + "' onclick=\"Docs.toggleEndpointListForResource('";
  1127. foundHelper = helpers.name;
  1128. stack1 = foundHelper || depth0.name;
  1129. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1130. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  1131. buffer += escapeExpression(stack1) + "');\">";
  1132. foundHelper = helpers.name;
  1133. stack1 = foundHelper || depth0.name;
  1134. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1135. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  1136. buffer += escapeExpression(stack1) + "</a>\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/";
  1137. foundHelper = helpers.name;
  1138. stack1 = foundHelper || depth0.name;
  1139. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1140. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  1141. buffer += escapeExpression(stack1) + "' id='endpointListTogger_";
  1142. foundHelper = helpers.name;
  1143. stack1 = foundHelper || depth0.name;
  1144. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1145. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  1146. buffer += escapeExpression(stack1) + "'\n onclick=\"Docs.toggleEndpointListForResource('";
  1147. foundHelper = helpers.name;
  1148. stack1 = foundHelper || depth0.name;
  1149. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1150. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  1151. buffer += escapeExpression(stack1) + "');\">Show/Hide</a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.collapseOperationsForResource('";
  1152. foundHelper = helpers.name;
  1153. stack1 = foundHelper || depth0.name;
  1154. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1155. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  1156. buffer += escapeExpression(stack1) + "'); return false;\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.expandOperationsForResource('";
  1157. foundHelper = helpers.name;
  1158. stack1 = foundHelper || depth0.name;
  1159. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1160. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  1161. buffer += escapeExpression(stack1) + "'); return false;\">\n Expand Operations\n </a>\n </li>\n <li>\n <a href='";
  1162. foundHelper = helpers.url;
  1163. stack1 = foundHelper || depth0.url;
  1164. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1165. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "url", { hash: {} }); }
  1166. buffer += escapeExpression(stack1) + "'>Raw</a>\n </li>\n </ul>\n</div>\n<ul class='endpoints' id='";
  1167. foundHelper = helpers.name;
  1168. stack1 = foundHelper || depth0.name;
  1169. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1170. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  1171. buffer += escapeExpression(stack1) + "_endpoint_list' style='display:none'>\n\n</ul>\n";
  1172. return buffer;});
  1173. })();
  1174. (function() {
  1175. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  1176. templates['response_content_type'] = template(function (Handlebars,depth0,helpers,partials,data) {
  1177. helpers = helpers || Handlebars.helpers;
  1178. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0;
  1179. function program1(depth0,data) {
  1180. var buffer = "", stack1, stack2;
  1181. buffer += "\n ";
  1182. foundHelper = helpers.produces;
  1183. stack1 = foundHelper || depth0.produces;
  1184. stack2 = helpers.each;
  1185. tmp1 = self.program(2, program2, data);
  1186. tmp1.hash = {};
  1187. tmp1.fn = tmp1;
  1188. tmp1.inverse = self.noop;
  1189. stack1 = stack2.call(depth0, stack1, tmp1);
  1190. if(stack1 || stack1 === 0) { buffer += stack1; }
  1191. buffer += "\n";
  1192. return buffer;}
  1193. function program2(depth0,data) {
  1194. var buffer = "", stack1;
  1195. buffer += "\n <option value=\"";
  1196. stack1 = depth0;
  1197. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1198. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "this", { hash: {} }); }
  1199. if(stack1 || stack1 === 0) { buffer += stack1; }
  1200. buffer += "\">";
  1201. stack1 = depth0;
  1202. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1203. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "this", { hash: {} }); }
  1204. if(stack1 || stack1 === 0) { buffer += stack1; }
  1205. buffer += "</option>\n ";
  1206. return buffer;}
  1207. function program4(depth0,data) {
  1208. return "\n <option value=\"application/json\">application/json</option>\n";}
  1209. buffer += "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
  1210. foundHelper = helpers.produces;
  1211. stack1 = foundHelper || depth0.produces;
  1212. stack2 = helpers['if'];
  1213. tmp1 = self.program(1, program1, data);
  1214. tmp1.hash = {};
  1215. tmp1.fn = tmp1;
  1216. tmp1.inverse = self.program(4, program4, data);
  1217. stack1 = stack2.call(depth0, stack1, tmp1);
  1218. if(stack1 || stack1 === 0) { buffer += stack1; }
  1219. buffer += "\n</select>\n";
  1220. return buffer;});
  1221. })();
  1222. (function() {
  1223. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  1224. templates['signature'] = template(function (Handlebars,depth0,helpers,partials,data) {
  1225. helpers = helpers || Handlebars.helpers;
  1226. var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  1227. 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 ";
  1228. foundHelper = helpers.signature;
  1229. stack1 = foundHelper || depth0.signature;
  1230. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1231. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "signature", { hash: {} }); }
  1232. if(stack1 || stack1 === 0) { buffer += stack1; }
  1233. buffer += "\n </div>\n\n <div class=\"snippet\">\n <pre><code>";
  1234. foundHelper = helpers.sampleJSON;
  1235. stack1 = foundHelper || depth0.sampleJSON;
  1236. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1237. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "sampleJSON", { hash: {} }); }
  1238. buffer += escapeExpression(stack1) + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
  1239. return buffer;});
  1240. })();
  1241. (function() {
  1242. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  1243. templates['status_code'] = template(function (Handlebars,depth0,helpers,partials,data) {
  1244. helpers = helpers || Handlebars.helpers;
  1245. var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  1246. buffer += "<td width='15%' class='code'>";
  1247. foundHelper = helpers.code;
  1248. stack1 = foundHelper || depth0.code;
  1249. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1250. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "code", { hash: {} }); }
  1251. buffer += escapeExpression(stack1) + "</td>\n<td>";
  1252. foundHelper = helpers.reason;
  1253. stack1 = foundHelper || depth0.reason;
  1254. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  1255. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "reason", { hash: {} }); }
  1256. if(stack1 || stack1 === 0) { buffer += stack1; }
  1257. buffer += "</td>\n\n";
  1258. return buffer;});
  1259. })();
  1260. // Generated by CoffeeScript 1.4.0
  1261. (function() {
  1262. var ContentTypeView, HeaderView, MainView, OperationView, ParameterContentTypeView, ParameterView, ResourceView, ResponseContentTypeView, SignatureView, StatusCodeView, SwaggerUi,
  1263. __hasProp = {}.hasOwnProperty,
  1264. __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; };
  1265. SwaggerUi = (function(_super) {
  1266. __extends(SwaggerUi, _super);
  1267. function SwaggerUi() {
  1268. return SwaggerUi.__super__.constructor.apply(this, arguments);
  1269. }
  1270. SwaggerUi.prototype.dom_id = "swagger_ui";
  1271. SwaggerUi.prototype.options = null;
  1272. SwaggerUi.prototype.api = null;
  1273. SwaggerUi.prototype.headerView = null;
  1274. SwaggerUi.prototype.mainView = null;
  1275. SwaggerUi.prototype.initialize = function(options) {
  1276. var _this = this;
  1277. if (options == null) {
  1278. options = {};
  1279. }
  1280. if (options.dom_id != null) {
  1281. this.dom_id = options.dom_id;
  1282. delete options.dom_id;
  1283. }
  1284. if (!($('#' + this.dom_id) != null)) {
  1285. $('body').append('<div id="' + this.dom_id + '"></div>');
  1286. }
  1287. this.options = options;
  1288. this.options.success = function() {
  1289. return _this.render();
  1290. };
  1291. this.options.progress = function(d) {
  1292. return _this.showMessage(d);
  1293. };
  1294. this.options.failure = function(d) {
  1295. return _this.onLoadFailure(d);
  1296. };
  1297. this.headerView = new HeaderView({
  1298. el: $('#header')
  1299. });
  1300. return this.headerView.on('update-swagger-ui', function(data) {
  1301. return _this.updateSwaggerUi(data);
  1302. });
  1303. };
  1304. SwaggerUi.prototype.updateSwaggerUi = function(data) {
  1305. this.options.url = data.url;
  1306. return this.load();
  1307. };
  1308. SwaggerUi.prototype.load = function() {
  1309. var url, _ref;
  1310. if ((_ref = this.mainView) != null) {
  1311. _ref.clear();
  1312. }
  1313. url = this.options.url;
  1314. if (url.indexOf("http") !== 0) {
  1315. url = this.buildUrl(window.location.href.toString(), url);
  1316. }
  1317. this.options.url = url;
  1318. this.headerView.update(url);
  1319. this.api = new SwaggerApi(this.options);
  1320. this.api.build();
  1321. return this.api;
  1322. };
  1323. SwaggerUi.prototype.render = function() {
  1324. var _this = this;
  1325. this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
  1326. this.mainView = new MainView({
  1327. model: this.api,
  1328. el: $('#' + this.dom_id)
  1329. }).render();
  1330. this.showMessage();
  1331. switch (this.options.docExpansion) {
  1332. case "full":
  1333. Docs.expandOperationsForResource('');
  1334. break;
  1335. case "list":
  1336. Docs.collapseOperationsForResource('');
  1337. }
  1338. if (this.options.onComplete) {
  1339. this.options.onComplete(this.api, this);
  1340. }
  1341. return setTimeout(function() {
  1342. return Docs.shebang();
  1343. }, 400);
  1344. };
  1345. SwaggerUi.prototype.buildUrl = function(base, url) {
  1346. var parts;
  1347. console.log("base is " + base);
  1348. parts = base.split("/");
  1349. base = parts[0] + "//" + parts[2];
  1350. if (url.indexOf("/") === 0) {
  1351. return base + url;
  1352. } else {
  1353. return base + "/" + url;
  1354. }
  1355. };
  1356. SwaggerUi.prototype.showMessage = function(data) {
  1357. if (data == null) {
  1358. data = '';
  1359. }
  1360. $('#message-bar').removeClass('message-fail');
  1361. $('#message-bar').addClass('message-success');
  1362. return $('#message-bar').html(data);
  1363. };
  1364. SwaggerUi.prototype.onLoadFailure = function(data) {
  1365. var val;
  1366. if (data == null) {
  1367. data = '';
  1368. }
  1369. $('#message-bar').removeClass('message-success');
  1370. $('#message-bar').addClass('message-fail');
  1371. val = $('#message-bar').html(data);
  1372. if (this.options.onFailure != null) {
  1373. this.options.onFailure(data);
  1374. }
  1375. return val;
  1376. };
  1377. return SwaggerUi;
  1378. })(Backbone.Router);
  1379. window.SwaggerUi = SwaggerUi;
  1380. HeaderView = (function(_super) {
  1381. __extends(HeaderView, _super);
  1382. function HeaderView() {
  1383. return HeaderView.__super__.constructor.apply(this, arguments);
  1384. }
  1385. HeaderView.prototype.events = {
  1386. 'click #show-pet-store-icon': 'showPetStore',
  1387. 'click #show-wordnik-dev-icon': 'showWordnikDev',
  1388. 'click #explore': 'showCustom',
  1389. 'keyup #input_baseUrl': 'showCustomOnKeyup',
  1390. 'keyup #input_apiKey': 'showCustomOnKeyup'
  1391. };
  1392. HeaderView.prototype.initialize = function() {};
  1393. HeaderView.prototype.showPetStore = function(e) {
  1394. return this.trigger('update-swagger-ui', {
  1395. url: "http://petstore.swagger.wordnik.com/api/api-docs.json"
  1396. });
  1397. };
  1398. HeaderView.prototype.showWordnikDev = function(e) {
  1399. return this.trigger('update-swagger-ui', {
  1400. url: "http://api.wordnik.com/v4/resources.json"
  1401. });
  1402. };
  1403. HeaderView.prototype.showCustomOnKeyup = function(e) {
  1404. if (e.keyCode === 13) {
  1405. return this.showCustom();
  1406. }
  1407. };
  1408. HeaderView.prototype.showCustom = function(e) {
  1409. if (e != null) {
  1410. e.preventDefault();
  1411. }
  1412. return this.trigger('update-swagger-ui', {
  1413. url: $('#input_baseUrl').val(),
  1414. apiKey: $('#input_apiKey').val()
  1415. });
  1416. };
  1417. HeaderView.prototype.update = function(url, apiKey, trigger) {
  1418. if (trigger == null) {
  1419. trigger = false;
  1420. }
  1421. $('#input_baseUrl').val(url);
  1422. if (trigger) {
  1423. return this.trigger('update-swagger-ui', {
  1424. url: url
  1425. });
  1426. }
  1427. };
  1428. return HeaderView;
  1429. })(Backbone.View);
  1430. MainView = (function(_super) {
  1431. __extends(MainView, _super);
  1432. function MainView() {
  1433. return MainView.__super__.constructor.apply(this, arguments);
  1434. }
  1435. MainView.prototype.initialize = function() {};
  1436. MainView.prototype.render = function() {
  1437. var resource, _i, _len, _ref;
  1438. $(this.el).html(Handlebars.templates.main(this.model));
  1439. _ref = this.model.apisArray;
  1440. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1441. resource = _ref[_i];
  1442. this.addResource(resource);
  1443. }
  1444. return this;
  1445. };
  1446. MainView.prototype.addResource = function(resource) {
  1447. var resourceView;
  1448. resourceView = new ResourceView({
  1449. model: resource,
  1450. tagName: 'li',
  1451. id: 'resource_' + resource.name,
  1452. className: 'resource'
  1453. });
  1454. return $('#resources').append(resourceView.render().el);
  1455. };
  1456. MainView.prototype.clear = function() {
  1457. return $(this.el).html('');
  1458. };
  1459. return MainView;
  1460. })(Backbone.View);
  1461. ResourceView = (function(_super) {
  1462. __extends(ResourceView, _super);
  1463. function ResourceView() {
  1464. return ResourceView.__super__.constructor.apply(this, arguments);
  1465. }
  1466. ResourceView.prototype.initialize = function() {};
  1467. ResourceView.prototype.render = function() {
  1468. var operation, _i, _len, _ref;
  1469. $(this.el).html(Handlebars.templates.resource(this.model));
  1470. this.number = 0;
  1471. _ref = this.model.operationsArray;
  1472. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1473. operation = _ref[_i];
  1474. this.addOperation(operation);
  1475. }
  1476. return this;
  1477. };
  1478. ResourceView.prototype.addOperation = function(operation) {
  1479. var operationView;
  1480. operation.number = this.number;
  1481. operationView = new OperationView({
  1482. model: operation,
  1483. tagName: 'li',
  1484. className: 'endpoint'
  1485. });
  1486. $('.endpoints', $(this.el)).append(operationView.render().el);
  1487. return this.number++;
  1488. };
  1489. return ResourceView;
  1490. })(Backbone.View);
  1491. OperationView = (function(_super) {
  1492. __extends(OperationView, _super);
  1493. function OperationView() {
  1494. return OperationView.__super__.constructor.apply(this, arguments);
  1495. }
  1496. OperationView.prototype.events = {
  1497. 'submit .sandbox': 'submitOperation',
  1498. 'click .submit': 'submitOperation',
  1499. 'click .response_hider': 'hideResponse',
  1500. 'click .toggleOperation': 'toggleOperationContent'
  1501. };
  1502. OperationView.prototype.initialize = function() {};
  1503. OperationView.prototype.render = function() {
  1504. var contentTypeModel, isMethodSubmissionSupported, param, responseContentTypeView, responseSignatureView, signatureModel, statusCode, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;
  1505. isMethodSubmissionSupported = true;
  1506. if (!isMethodSubmissionSupported) {
  1507. this.model.isReadOnly = true;
  1508. }
  1509. $(this.el).html(Handlebars.templates.operation(this.model));
  1510. if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
  1511. signatureModel = {
  1512. sampleJSON: this.model.responseSampleJSON,
  1513. isParam: false,
  1514. signature: this.model.responseClassSignature
  1515. };
  1516. responseSignatureView = new SignatureView({
  1517. model: signatureModel,
  1518. tagName: 'div'
  1519. });
  1520. $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
  1521. } else {
  1522. $('.model-signature', $(this.el)).html(this.model.responseClass);
  1523. }
  1524. contentTypeModel = {
  1525. isParam: false
  1526. };
  1527. contentTypeModel.consumes = this.model.consumes;
  1528. contentTypeModel.produces = this.model.produces;
  1529. _ref = this.model.parameters;
  1530. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1531. param = _ref[_i];
  1532. console.log("looking at " + param.dataType);
  1533. if (param.dataType.toLowerCase() === 'file') {
  1534. if (!contentTypeModel.consumes) {
  1535. console.log("set content type ");
  1536. contentTypeModel.consumes = 'multipart/form-data';
  1537. }
  1538. }
  1539. }
  1540. responseContentTypeView = new ResponseContentTypeView({
  1541. model: contentTypeModel
  1542. });
  1543. $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
  1544. _ref1 = this.model.parameters;
  1545. for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
  1546. param = _ref1[_j];
  1547. this.addParameter(param, contentTypeModel.consumes);
  1548. }
  1549. _ref2 = this.model.responseMessages;
  1550. for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
  1551. statusCode = _ref2[_k];
  1552. this.addStatusCode(statusCode);
  1553. }
  1554. return this;
  1555. };
  1556. OperationView.prototype.addParameter = function(param, consumes) {
  1557. var paramView;
  1558. param.consumes = consumes;
  1559. paramView = new ParameterView({
  1560. model: param,
  1561. tagName: 'tr',
  1562. readOnly: this.model.isReadOnly
  1563. });
  1564. return $('.operation-params', $(this.el)).append(paramView.render().el);
  1565. };
  1566. OperationView.prototype.addStatusCode = function(statusCode) {
  1567. var statusCodeView;
  1568. statusCodeView = new StatusCodeView({
  1569. model: statusCode,
  1570. tagName: 'tr'
  1571. });
  1572. return $('.operation-status', $(this.el)).append(statusCodeView.render().el);
  1573. };
  1574. OperationView.prototype.submitOperation = function(e) {
  1575. var error_free, form, map, o, opts, _i, _len, _ref;
  1576. if (e != null) {
  1577. e.preventDefault();
  1578. }
  1579. form = $('.sandbox', $(this.el));
  1580. error_free = true;
  1581. form.find("input.required").each(function() {
  1582. var _this = this;
  1583. $(this).removeClass("error");
  1584. if (jQuery.trim($(this).val()) === "") {
  1585. $(this).addClass("error");
  1586. $(this).wiggle({
  1587. callback: function() {
  1588. return $(_this).focus();
  1589. }
  1590. });
  1591. return error_free = false;
  1592. }
  1593. });
  1594. if (error_free) {
  1595. map = {};
  1596. opts = {
  1597. parent: this
  1598. };
  1599. _ref = form.find("input");
  1600. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1601. o = _ref[_i];
  1602. if ((o.value != null) && jQuery.trim(o.value).length > 0) {
  1603. map[o.name] = encodeURI(o.value);
  1604. }
  1605. }
  1606. opts.responseContentType = $("div select[name=responseContentType]", $(this.el)).val();
  1607. opts.requestContentType = $("div select[name=parameterContentType]", $(this.el)).val();
  1608. return this.model["do"](map, opts, this.showCompleteStatus, this.showErrorStatus, this);
  1609. }
  1610. };
  1611. OperationView.prototype.success = function(response, parent) {
  1612. return parent.showCompleteStatus(response);
  1613. };
  1614. OperationView.prototype.hideResponse = function(e) {
  1615. if (e != null) {
  1616. e.preventDefault();
  1617. }
  1618. $(".response", $(this.el)).slideUp();
  1619. return $(".response_hider", $(this.el)).fadeOut();
  1620. };
  1621. OperationView.prototype.showResponse = function(response) {
  1622. var prettyJson;
  1623. prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");
  1624. return $(".response_body", $(this.el)).html(escape(prettyJson));
  1625. };
  1626. OperationView.prototype.showErrorStatus = function(data, parent) {
  1627. return parent.showStatus(data);
  1628. };
  1629. OperationView.prototype.showCompleteStatus = function(data, parent) {
  1630. return parent.showStatus(data);
  1631. };
  1632. OperationView.prototype.formatXml = function(xml) {
  1633. var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
  1634. reg = /(>)(<)(\/*)/g;
  1635. wsexp = /[ ]*(.*)[ ]+\n/g;
  1636. contexp = /(<.+>)(.+\n)/g;
  1637. xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
  1638. pad = 0;
  1639. formatted = '';
  1640. lines = xml.split('\n');
  1641. indent = 0;
  1642. lastType = 'other';
  1643. transitions = {
  1644. 'single->single': 0,
  1645. 'single->closing': -1,
  1646. 'single->opening': 0,
  1647. 'single->other': 0,
  1648. 'closing->single': 0,
  1649. 'closing->closing': -1,
  1650. 'closing->opening': 0,
  1651. 'closing->other': 0,
  1652. 'opening->single': 1,
  1653. 'opening->closing': 0,
  1654. 'opening->opening': 1,
  1655. 'opening->other': 1,
  1656. 'other->single': 0,
  1657. 'other->closing': -1,
  1658. 'other->opening': 0,
  1659. 'other->other': 0
  1660. };
  1661. _fn = function(ln) {
  1662. var fromTo, j, key, padding, type, types, value;
  1663. types = {
  1664. single: Boolean(ln.match(/<.+\/>/)),
  1665. closing: Boolean(ln.match(/<\/.+>/)),
  1666. opening: Boolean(ln.match(/<[^!?].*>/))
  1667. };
  1668. type = ((function() {
  1669. var _results;
  1670. _results = [];
  1671. for (key in types) {
  1672. value = types[key];
  1673. if (value) {
  1674. _results.push(key);
  1675. }
  1676. }
  1677. return _results;
  1678. })())[0];
  1679. type = type === void 0 ? 'other' : type;
  1680. fromTo = lastType + '->' + type;
  1681. lastType = type;
  1682. padding = '';
  1683. indent += transitions[fromTo];
  1684. padding = ((function() {
  1685. var _j, _ref, _results;
  1686. _results = [];
  1687. for (j = _j = 0, _ref = indent; 0 <= _ref ? _j < _ref : _j > _ref; j = 0 <= _ref ? ++_j : --_j) {
  1688. _results.push(' ');
  1689. }
  1690. return _results;
  1691. })()).join('');
  1692. if (fromTo === 'opening->closing') {
  1693. return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
  1694. } else {
  1695. return formatted += padding + ln + '\n';
  1696. }
  1697. };
  1698. for (_i = 0, _len = lines.length; _i < _len; _i++) {
  1699. ln = lines[_i];
  1700. _fn(ln);
  1701. }
  1702. return formatted;
  1703. };
  1704. OperationView.prototype.showStatus = function(data) {
  1705. var code, content, contentType, headers, pre, response_body;
  1706. content = data.content.data;
  1707. headers = data.getHeaders();
  1708. contentType = headers["Content-Type"];
  1709. if (content === void 0) {
  1710. code = $('<code />').text("no content");
  1711. pre = $('<pre class="json" />').append(code);
  1712. } else if (contentType.indexOf("application/json") === 0) {
  1713. code = $('<code />').text(JSON.stringify(JSON.parse(content), null, 2));
  1714. pre = $('<pre class="json" />').append(code);
  1715. } else if (contentType.indexOf("application/xml") === 0) {
  1716. code = $('<code />').text(this.formatXml(content));
  1717. pre = $('<pre class="xml" />').append(code);
  1718. } else if (contentType.indexOf("text/html") === 0) {
  1719. code = $('<code />').html(content);
  1720. pre = $('<pre class="xml" />').append(code);
  1721. } else {
  1722. code = $('<code />').text(content);
  1723. pre = $('<pre class="json" />').append(code);
  1724. }
  1725. response_body = pre;
  1726. $(".request_url").html("<pre>" + data.request.url + "</pre>");
  1727. $(".response_code", $(this.el)).html("<pre>" + data.status + "</pre>");
  1728. $(".response_body", $(this.el)).html(response_body);
  1729. $(".response_headers", $(this.el)).html("<pre>" + JSON.stringify(data.getHeaders()) + "</pre>");
  1730. $(".response", $(this.el)).slideDown();
  1731. $(".response_hider", $(this.el)).show();
  1732. $(".response_throbber", $(this.el)).hide();
  1733. return hljs.highlightBlock($('.response_body', $(this.el))[0]);
  1734. };
  1735. OperationView.prototype.toggleOperationContent = function() {
  1736. var elem;
  1737. elem = $('#' + Docs.escapeResourceName(this.model.resourceName) + "_" + this.model.nickname + "_" + this.model.method + "_" + this.model.number + "_content");
  1738. if (elem.is(':visible')) {
  1739. return Docs.collapseOperation(elem);
  1740. } else {
  1741. return Docs.expandOperation(elem);
  1742. }
  1743. };
  1744. return OperationView;
  1745. })(Backbone.View);
  1746. StatusCodeView = (function(_super) {
  1747. __extends(StatusCodeView, _super);
  1748. function StatusCodeView() {
  1749. return StatusCodeView.__super__.constructor.apply(this, arguments);
  1750. }
  1751. StatusCodeView.prototype.initialize = function() {};
  1752. StatusCodeView.prototype.render = function() {
  1753. var template;
  1754. template = this.template();
  1755. $(this.el).html(template(this.model));
  1756. return this;
  1757. };
  1758. StatusCodeView.prototype.template = function() {
  1759. return Handlebars.templates.status_code;
  1760. };
  1761. return StatusCodeView;
  1762. })(Backbone.View);
  1763. ParameterView = (function(_super) {
  1764. __extends(ParameterView, _super);
  1765. function ParameterView() {
  1766. return ParameterView.__super__.constructor.apply(this, arguments);
  1767. }
  1768. ParameterView.prototype.initialize = function() {};
  1769. ParameterView.prototype.render = function() {
  1770. var contentTypeModel, isParam, parameterContentTypeView, responseContentTypeView, signatureModel, signatureView, template;
  1771. if (this.model.paramType === 'body') {
  1772. this.model.isBody = true;
  1773. }
  1774. if (this.model.dataType.toLowerCase() === 'file') {
  1775. this.model.isFile = true;
  1776. }
  1777. template = this.template();
  1778. $(this.el).html(template(this.model));
  1779. signatureModel = {
  1780. sampleJSON: this.model.sampleJSON,
  1781. isParam: true,
  1782. signature: this.model.signature
  1783. };
  1784. if (this.model.sampleJSON) {
  1785. signatureView = new SignatureView({
  1786. model: signatureModel,
  1787. tagName: 'div'
  1788. });
  1789. $('.model-signature', $(this.el)).append(signatureView.render().el);
  1790. } else {
  1791. $('.model-signature', $(this.el)).html(this.model.signature);
  1792. }
  1793. isParam = false;
  1794. if (this.model.isBody) {
  1795. isParam = true;
  1796. }
  1797. contentTypeModel = {
  1798. isParam: isParam
  1799. };
  1800. contentTypeModel.consumes = this.model.consumes;
  1801. if (isParam) {
  1802. parameterContentTypeView = new ParameterContentTypeView({
  1803. model: contentTypeModel
  1804. });
  1805. $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
  1806. } else {
  1807. responseContentTypeView = new ResponseContentTypeView({
  1808. model: contentTypeModel
  1809. });
  1810. $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
  1811. }
  1812. return this;
  1813. };
  1814. ParameterView.prototype.template = function() {
  1815. if (this.model.isList) {
  1816. return Handlebars.templates.param_list;
  1817. } else {
  1818. if (this.options.readOnly) {
  1819. if (this.model.required) {
  1820. return Handlebars.templates.param_readonly_required;
  1821. } else {
  1822. return Handlebars.templates.param_readonly;
  1823. }
  1824. } else {
  1825. if (this.model.required) {
  1826. return Handlebars.templates.param_required;
  1827. } else {
  1828. return Handlebars.templates.param;
  1829. }
  1830. }
  1831. }
  1832. };
  1833. return ParameterView;
  1834. })(Backbone.View);
  1835. SignatureView = (function(_super) {
  1836. __extends(SignatureView, _super);
  1837. function SignatureView() {
  1838. return SignatureView.__super__.constructor.apply(this, arguments);
  1839. }
  1840. SignatureView.prototype.events = {
  1841. 'click a.description-link': 'switchToDescription',
  1842. 'click a.snippet-link': 'switchToSnippet',
  1843. 'mousedown .snippet': 'snippetToTextArea'
  1844. };
  1845. SignatureView.prototype.initialize = function() {};
  1846. SignatureView.prototype.render = function() {
  1847. var template;
  1848. template = this.template();
  1849. $(this.el).html(template(this.model));
  1850. this.switchToDescription();
  1851. this.isParam = this.model.isParam;
  1852. if (this.isParam) {
  1853. $('.notice', $(this.el)).text('Click to set as parameter value');
  1854. }
  1855. return this;
  1856. };
  1857. SignatureView.prototype.template = function() {
  1858. return Handlebars.templates.signature;
  1859. };
  1860. SignatureView.prototype.switchToDescription = function(e) {
  1861. if (e != null) {
  1862. e.preventDefault();
  1863. }
  1864. $(".snippet", $(this.el)).hide();
  1865. $(".description", $(this.el)).show();
  1866. $('.description-link', $(this.el)).addClass('selected');
  1867. return $('.snippet-link', $(this.el)).removeClass('selected');
  1868. };
  1869. SignatureView.prototype.switchToSnippet = function(e) {
  1870. if (e != null) {
  1871. e.preventDefault();
  1872. }
  1873. $(".description", $(this.el)).hide();
  1874. $(".snippet", $(this.el)).show();
  1875. $('.snippet-link', $(this.el)).addClass('selected');
  1876. return $('.description-link', $(this.el)).removeClass('selected');
  1877. };
  1878. SignatureView.prototype.snippetToTextArea = function(e) {
  1879. var textArea;
  1880. if (this.isParam) {
  1881. if (e != null) {
  1882. e.preventDefault();
  1883. }
  1884. textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
  1885. if ($.trim(textArea.val()) === '') {
  1886. return textArea.val(this.model.sampleJSON);
  1887. }
  1888. }
  1889. };
  1890. return SignatureView;
  1891. })(Backbone.View);
  1892. ContentTypeView = (function(_super) {
  1893. __extends(ContentTypeView, _super);
  1894. function ContentTypeView() {
  1895. return ContentTypeView.__super__.constructor.apply(this, arguments);
  1896. }
  1897. ContentTypeView.prototype.initialize = function() {};
  1898. ContentTypeView.prototype.render = function() {
  1899. var template;
  1900. template = this.template();
  1901. $(this.el).html(template(this.model));
  1902. $('label[for=contentType]', $(this.el)).text('Response Content Type');
  1903. return this;
  1904. };
  1905. ContentTypeView.prototype.template = function() {
  1906. return Handlebars.templates.content_type;
  1907. };
  1908. return ContentTypeView;
  1909. })(Backbone.View);
  1910. ResponseContentTypeView = (function(_super) {
  1911. __extends(ResponseContentTypeView, _super);
  1912. function ResponseContentTypeView() {
  1913. return ResponseContentTypeView.__super__.constructor.apply(this, arguments);
  1914. }
  1915. ResponseContentTypeView.prototype.initialize = function() {};
  1916. ResponseContentTypeView.prototype.render = function() {
  1917. var template;
  1918. template = this.template();
  1919. $(this.el).html(template(this.model));
  1920. $('label[for=responseContentType]', $(this.el)).text('Response Content Type');
  1921. return this;
  1922. };
  1923. ResponseContentTypeView.prototype.template = function() {
  1924. return Handlebars.templates.response_content_type;
  1925. };
  1926. return ResponseContentTypeView;
  1927. })(Backbone.View);
  1928. ParameterContentTypeView = (function(_super) {
  1929. __extends(ParameterContentTypeView, _super);
  1930. function ParameterContentTypeView() {
  1931. return ParameterContentTypeView.__super__.constructor.apply(this, arguments);
  1932. }
  1933. ParameterContentTypeView.prototype.initialize = function() {};
  1934. ParameterContentTypeView.prototype.render = function() {
  1935. var template;
  1936. template = this.template();
  1937. $(this.el).html(template(this.model));
  1938. $('label[for=parameterContentType]', $(this.el)).text('Parameter content type:');
  1939. return this;
  1940. };
  1941. ParameterContentTypeView.prototype.template = function() {
  1942. return Handlebars.templates.parameter_content_type;
  1943. };
  1944. return ParameterContentTypeView;
  1945. })(Backbone.View);
  1946. }).call(this);