swagger-ui.js 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309
  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. var Docs = {
  54. shebang: function() {
  55. // If shebang has an operation nickname in it..
  56. // e.g. /docs/#!/words/get_search
  57. var fragments = $.param.fragment().split('/');
  58. fragments.shift(); // get rid of the bang
  59. switch (fragments.length) {
  60. case 1:
  61. // Expand all operations for the resource and scroll to it
  62. // log('shebang resource:' + fragments[0]);
  63. var dom_id = 'resource_' + fragments[0];
  64. Docs.expandEndpointListForResource(fragments[0]);
  65. $("#"+dom_id).slideto({highlight: false});
  66. break;
  67. case 2:
  68. // Refer to the endpoint DOM element, e.g. #words_get_search
  69. // log('shebang endpoint: ' + fragments.join('_'));
  70. // Expand Resource
  71. Docs.expandEndpointListForResource(fragments[0]);
  72. $("#"+dom_id).slideto({highlight: false});
  73. // Expand operation
  74. var li_dom_id = fragments.join('_');
  75. var li_content_dom_id = li_dom_id + "_content";
  76. // log("li_dom_id " + li_dom_id);
  77. // log("li_content_dom_id " + li_content_dom_id);
  78. Docs.expandOperation($('#'+li_content_dom_id));
  79. $('#'+li_dom_id).slideto({highlight: false});
  80. break;
  81. }
  82. },
  83. toggleEndpointListForResource: function(resource) {
  84. var elem = $('li#resource_' + resource + ' ul.endpoints');
  85. if (elem.is(':visible')) {
  86. Docs.collapseEndpointListForResource(resource);
  87. } else {
  88. Docs.expandEndpointListForResource(resource);
  89. }
  90. },
  91. // Expand resource
  92. expandEndpointListForResource: function(resource) {
  93. $('#resource_' + resource).addClass('active');
  94. var elem = $('li#resource_' + resource + ' ul.endpoints');
  95. elem.slideDown();
  96. },
  97. // Collapse resource and mark as explicitly closed
  98. collapseEndpointListForResource: function(resource) {
  99. $('#resource_' + resource).removeClass('active');
  100. var elem = $('li#resource_' + resource + ' ul.endpoints');
  101. elem.slideUp();
  102. },
  103. expandOperationsForResource: function(resource) {
  104. // Make sure the resource container is open..
  105. Docs.expandEndpointListForResource(resource);
  106. $('li#resource_' + resource + ' li.operation div.content').each(function() {
  107. Docs.expandOperation($(this));
  108. });
  109. },
  110. collapseOperationsForResource: function(resource) {
  111. // Make sure the resource container is open..
  112. Docs.expandEndpointListForResource(resource);
  113. $('li#resource_' + resource + ' li.operation div.content').each(function() {
  114. Docs.collapseOperation($(this));
  115. });
  116. },
  117. expandOperation: function(elem) {
  118. elem.slideDown();
  119. },
  120. collapseOperation: function(elem) {
  121. elem.slideUp();
  122. }
  123. };(function() {
  124. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  125. templates['main'] = template(function (Handlebars,depth0,helpers,partials,data) {
  126. helpers = helpers || Handlebars.helpers;
  127. var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  128. buffer += "\n<div class='container' id='resources_container'>\n <ul id='resources'>\n </ul>\n\n <div class=\"footer\">\n <br>\n <br>\n <h4 style=\"color: #999\">[<span style=\"font-variant: small-caps\">base url</span>: ";
  129. foundHelper = helpers.basePath;
  130. stack1 = foundHelper || depth0.basePath;
  131. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  132. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "basePath", { hash: {} }); }
  133. buffer += escapeExpression(stack1) + "]</h4>\n </div>\n</div>";
  134. return buffer;});
  135. })();
  136. (function() {
  137. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  138. templates['operation'] = template(function (Handlebars,depth0,helpers,partials,data) {
  139. helpers = helpers || Handlebars.helpers;
  140. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  141. function program1(depth0,data) {
  142. var buffer = "", stack1;
  143. buffer += "\n <h4>Implementation Notes</h4>\n <p>";
  144. foundHelper = helpers.notes;
  145. stack1 = foundHelper || depth0.notes;
  146. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  147. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "notes", { hash: {} }); }
  148. if(stack1 || stack1 === 0) { buffer += stack1; }
  149. buffer += "</p>\n ";
  150. return buffer;}
  151. function program3(depth0,data) {
  152. return "\n ";}
  153. function program5(depth0,data) {
  154. 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='http://swagger.wordnik.com/images/throbber.gif' style='display:none' />\n </div>\n ";}
  155. buffer += "\n <ul class='operations' >\n <li class='";
  156. foundHelper = helpers.httpMethod;
  157. stack1 = foundHelper || depth0.httpMethod;
  158. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  159. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
  160. buffer += escapeExpression(stack1) + " operation' id='";
  161. foundHelper = helpers.resourceName;
  162. stack1 = foundHelper || depth0.resourceName;
  163. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  164. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
  165. buffer += escapeExpression(stack1) + "_";
  166. foundHelper = helpers.nickname;
  167. stack1 = foundHelper || depth0.nickname;
  168. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  169. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
  170. buffer += escapeExpression(stack1) + "_";
  171. foundHelper = helpers.httpMethod;
  172. stack1 = foundHelper || depth0.httpMethod;
  173. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  174. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
  175. buffer += escapeExpression(stack1) + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/";
  176. foundHelper = helpers.resourceName;
  177. stack1 = foundHelper || depth0.resourceName;
  178. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  179. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
  180. buffer += escapeExpression(stack1) + "/";
  181. foundHelper = helpers.nickname;
  182. stack1 = foundHelper || depth0.nickname;
  183. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  184. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
  185. buffer += escapeExpression(stack1) + "_";
  186. foundHelper = helpers.httpMethod;
  187. stack1 = foundHelper || depth0.httpMethod;
  188. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  189. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
  190. buffer += escapeExpression(stack1) + "' class=\"toggleOperation\">";
  191. foundHelper = helpers.httpMethod;
  192. stack1 = foundHelper || depth0.httpMethod;
  193. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  194. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
  195. buffer += escapeExpression(stack1) + "</a>\n </span>\n <span class='path'>\n <a href='#!/";
  196. foundHelper = helpers.resourceName;
  197. stack1 = foundHelper || depth0.resourceName;
  198. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  199. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
  200. buffer += escapeExpression(stack1) + "/";
  201. foundHelper = helpers.nickname;
  202. stack1 = foundHelper || depth0.nickname;
  203. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  204. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
  205. buffer += escapeExpression(stack1) + "_";
  206. foundHelper = helpers.httpMethod;
  207. stack1 = foundHelper || depth0.httpMethod;
  208. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  209. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
  210. buffer += escapeExpression(stack1) + "' class=\"toggleOperation\">";
  211. foundHelper = helpers.pathJson;
  212. stack1 = foundHelper || depth0.pathJson;
  213. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  214. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "pathJson", { hash: {} }); }
  215. buffer += escapeExpression(stack1) + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/";
  216. foundHelper = helpers.resourceName;
  217. stack1 = foundHelper || depth0.resourceName;
  218. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  219. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
  220. buffer += escapeExpression(stack1) + "/";
  221. foundHelper = helpers.nickname;
  222. stack1 = foundHelper || depth0.nickname;
  223. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  224. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
  225. buffer += escapeExpression(stack1) + "_";
  226. foundHelper = helpers.httpMethod;
  227. stack1 = foundHelper || depth0.httpMethod;
  228. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  229. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
  230. buffer += escapeExpression(stack1) + "' class=\"toggleOperation\">";
  231. foundHelper = helpers.summary;
  232. stack1 = foundHelper || depth0.summary;
  233. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  234. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "summary", { hash: {} }); }
  235. if(stack1 || stack1 === 0) { buffer += stack1; }
  236. buffer += "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='";
  237. foundHelper = helpers.resourceName;
  238. stack1 = foundHelper || depth0.resourceName;
  239. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  240. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }
  241. buffer += escapeExpression(stack1) + "_";
  242. foundHelper = helpers.nickname;
  243. stack1 = foundHelper || depth0.nickname;
  244. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  245. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }
  246. buffer += escapeExpression(stack1) + "_";
  247. foundHelper = helpers.httpMethod;
  248. stack1 = foundHelper || depth0.httpMethod;
  249. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  250. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }
  251. buffer += escapeExpression(stack1) + "_content' style='display:none'>\n ";
  252. foundHelper = helpers.notes;
  253. stack1 = foundHelper || depth0.notes;
  254. stack2 = helpers['if'];
  255. tmp1 = self.program(1, program1, data);
  256. tmp1.hash = {};
  257. tmp1.fn = tmp1;
  258. tmp1.inverse = self.noop;
  259. stack1 = stack2.call(depth0, stack1, tmp1);
  260. if(stack1 || stack1 === 0) { buffer += stack1; }
  261. buffer += "\n <form accept-charset='UTF-8' action='#' class='sandbox' method='post'>\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Parameters</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>Parameter</th>\n <th>Value</th>\n <th>Description</th>\n </tr>\n </thead>\n <tbody class=\"operation-params\">\n\n </tbody>\n </table>\n ";
  262. foundHelper = helpers.isReadOnly;
  263. stack1 = foundHelper || depth0.isReadOnly;
  264. stack2 = helpers['if'];
  265. tmp1 = self.program(3, program3, data);
  266. tmp1.hash = {};
  267. tmp1.fn = tmp1;
  268. tmp1.inverse = self.program(5, program5, data);
  269. stack1 = stack2.call(depth0, stack1, tmp1);
  270. if(stack1 || stack1 === 0) { buffer += stack1; }
  271. 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";
  272. return buffer;});
  273. })();
  274. (function() {
  275. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  276. templates['param'] = template(function (Handlebars,depth0,helpers,partials,data) {
  277. helpers = helpers || Handlebars.helpers;
  278. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  279. function program1(depth0,data) {
  280. var buffer = "", stack1, stack2;
  281. buffer += "\n ";
  282. foundHelper = helpers.defaultValue;
  283. stack1 = foundHelper || depth0.defaultValue;
  284. stack2 = helpers['if'];
  285. tmp1 = self.program(2, program2, data);
  286. tmp1.hash = {};
  287. tmp1.fn = tmp1;
  288. tmp1.inverse = self.program(4, program4, data);
  289. stack1 = stack2.call(depth0, stack1, tmp1);
  290. if(stack1 || stack1 === 0) { buffer += stack1; }
  291. buffer += "\n \n ";
  292. return buffer;}
  293. function program2(depth0,data) {
  294. var buffer = "", stack1;
  295. buffer += "\n <textarea class='body-textarea' name='";
  296. foundHelper = helpers.name;
  297. stack1 = foundHelper || depth0.name;
  298. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  299. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  300. buffer += escapeExpression(stack1) + "'>";
  301. foundHelper = helpers.defaultValue;
  302. stack1 = foundHelper || depth0.defaultValue;
  303. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  304. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  305. buffer += escapeExpression(stack1) + "</textarea>\n ";
  306. return buffer;}
  307. function program4(depth0,data) {
  308. var buffer = "", stack1;
  309. buffer += "\n <textarea class='body-textarea' name='";
  310. foundHelper = helpers.name;
  311. stack1 = foundHelper || depth0.name;
  312. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  313. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  314. buffer += escapeExpression(stack1) + "'></textarea>\n ";
  315. return buffer;}
  316. function program6(depth0,data) {
  317. var buffer = "", stack1, stack2;
  318. buffer += "\n ";
  319. foundHelper = helpers.defaultValue;
  320. stack1 = foundHelper || depth0.defaultValue;
  321. stack2 = helpers['if'];
  322. tmp1 = self.program(7, program7, data);
  323. tmp1.hash = {};
  324. tmp1.fn = tmp1;
  325. tmp1.inverse = self.program(9, program9, data);
  326. stack1 = stack2.call(depth0, stack1, tmp1);
  327. if(stack1 || stack1 === 0) { buffer += stack1; }
  328. buffer += "\n ";
  329. return buffer;}
  330. function program7(depth0,data) {
  331. var buffer = "", stack1;
  332. buffer += "\n <input minlength='0' name='";
  333. foundHelper = helpers.name;
  334. stack1 = foundHelper || depth0.name;
  335. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  336. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  337. buffer += escapeExpression(stack1) + "' placeholder='' type='text' value='";
  338. foundHelper = helpers.defaultValue;
  339. stack1 = foundHelper || depth0.defaultValue;
  340. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  341. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  342. buffer += escapeExpression(stack1) + "'/>\n ";
  343. return buffer;}
  344. function program9(depth0,data) {
  345. var buffer = "", stack1;
  346. buffer += "\n <input minlength='0' name='";
  347. foundHelper = helpers.name;
  348. stack1 = foundHelper || depth0.name;
  349. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  350. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  351. buffer += escapeExpression(stack1) + "' placeholder='' type='text' value=''/>\n ";
  352. return buffer;}
  353. buffer += "<td class='code'>";
  354. foundHelper = helpers.name;
  355. stack1 = foundHelper || depth0.name;
  356. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  357. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  358. buffer += escapeExpression(stack1) + "</td>\n<td>\n \n ";
  359. foundHelper = helpers.isBody;
  360. stack1 = foundHelper || depth0.isBody;
  361. stack2 = helpers['if'];
  362. tmp1 = self.program(1, program1, data);
  363. tmp1.hash = {};
  364. tmp1.fn = tmp1;
  365. tmp1.inverse = self.program(6, program6, data);
  366. stack1 = stack2.call(depth0, stack1, tmp1);
  367. if(stack1 || stack1 === 0) { buffer += stack1; }
  368. buffer += "\n\n</td>\n<td width='500'>";
  369. foundHelper = helpers.description;
  370. stack1 = foundHelper || depth0.description;
  371. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  372. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
  373. if(stack1 || stack1 === 0) { buffer += stack1; }
  374. buffer += "</td>\n\n";
  375. return buffer;});
  376. })();
  377. (function() {
  378. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  379. templates['param_list'] = template(function (Handlebars,depth0,helpers,partials,data) {
  380. helpers = helpers || Handlebars.helpers;
  381. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  382. function program1(depth0,data) {
  383. return "\n ";}
  384. function program3(depth0,data) {
  385. var buffer = "", stack1, stack2;
  386. buffer += "\n ";
  387. foundHelper = helpers.defaultValue;
  388. stack1 = foundHelper || depth0.defaultValue;
  389. stack2 = helpers['if'];
  390. tmp1 = self.program(4, program4, data);
  391. tmp1.hash = {};
  392. tmp1.fn = tmp1;
  393. tmp1.inverse = self.program(6, program6, data);
  394. stack1 = stack2.call(depth0, stack1, tmp1);
  395. if(stack1 || stack1 === 0) { buffer += stack1; }
  396. buffer += "\n ";
  397. return buffer;}
  398. function program4(depth0,data) {
  399. return "\n ";}
  400. function program6(depth0,data) {
  401. return "\n <option selected=\"\" value=''></option>\n ";}
  402. function program8(depth0,data) {
  403. var buffer = "", stack1, stack2;
  404. buffer += "\n ";
  405. foundHelper = helpers.isDefault;
  406. stack1 = foundHelper || depth0.isDefault;
  407. stack2 = helpers['if'];
  408. tmp1 = self.program(9, program9, data);
  409. tmp1.hash = {};
  410. tmp1.fn = tmp1;
  411. tmp1.inverse = self.program(11, program11, data);
  412. stack1 = stack2.call(depth0, stack1, tmp1);
  413. if(stack1 || stack1 === 0) { buffer += stack1; }
  414. buffer += "\n ";
  415. return buffer;}
  416. function program9(depth0,data) {
  417. var buffer = "", stack1;
  418. buffer += "\n <option value='";
  419. foundHelper = helpers.value;
  420. stack1 = foundHelper || depth0.value;
  421. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  422. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }
  423. buffer += escapeExpression(stack1) + "'>";
  424. foundHelper = helpers.value;
  425. stack1 = foundHelper || depth0.value;
  426. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  427. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }
  428. buffer += escapeExpression(stack1) + " (default)</option>\n ";
  429. return buffer;}
  430. function program11(depth0,data) {
  431. var buffer = "", stack1;
  432. buffer += "\n <option value='";
  433. foundHelper = helpers.value;
  434. stack1 = foundHelper || depth0.value;
  435. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  436. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }
  437. buffer += escapeExpression(stack1) + "'>";
  438. foundHelper = helpers.value;
  439. stack1 = foundHelper || depth0.value;
  440. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  441. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }
  442. buffer += escapeExpression(stack1) + "</option>\n ";
  443. return buffer;}
  444. buffer += "<td class='code'>";
  445. foundHelper = helpers.name;
  446. stack1 = foundHelper || depth0.name;
  447. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  448. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  449. buffer += escapeExpression(stack1) + "</td>\n<td>\n <select name='";
  450. foundHelper = helpers.name;
  451. stack1 = foundHelper || depth0.name;
  452. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  453. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  454. buffer += escapeExpression(stack1) + "'>\n ";
  455. foundHelper = helpers.required;
  456. stack1 = foundHelper || depth0.required;
  457. stack2 = helpers['if'];
  458. tmp1 = self.program(1, program1, data);
  459. tmp1.hash = {};
  460. tmp1.fn = tmp1;
  461. tmp1.inverse = self.program(3, program3, data);
  462. stack1 = stack2.call(depth0, stack1, tmp1);
  463. if(stack1 || stack1 === 0) { buffer += stack1; }
  464. buffer += "\n ";
  465. foundHelper = helpers.allowableValues;
  466. stack1 = foundHelper || depth0.allowableValues;
  467. stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.descriptiveValues);
  468. stack2 = helpers.each;
  469. tmp1 = self.program(8, program8, data);
  470. tmp1.hash = {};
  471. tmp1.fn = tmp1;
  472. tmp1.inverse = self.noop;
  473. stack1 = stack2.call(depth0, stack1, tmp1);
  474. if(stack1 || stack1 === 0) { buffer += stack1; }
  475. buffer += "\n </select>\n</td>\n<td width='500'>";
  476. foundHelper = helpers.description;
  477. stack1 = foundHelper || depth0.description;
  478. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  479. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
  480. if(stack1 || stack1 === 0) { buffer += stack1; }
  481. buffer += "</td>\n\n";
  482. return buffer;});
  483. })();
  484. (function() {
  485. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  486. templates['param_readonly'] = template(function (Handlebars,depth0,helpers,partials,data) {
  487. helpers = helpers || Handlebars.helpers;
  488. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  489. function program1(depth0,data) {
  490. var buffer = "", stack1;
  491. buffer += "\n <textarea class='body-textarea' readonly='readonly' name='";
  492. foundHelper = helpers.name;
  493. stack1 = foundHelper || depth0.name;
  494. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  495. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  496. buffer += escapeExpression(stack1) + "'>";
  497. foundHelper = helpers.defaultValue;
  498. stack1 = foundHelper || depth0.defaultValue;
  499. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  500. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  501. buffer += escapeExpression(stack1) + "</textarea>\n ";
  502. return buffer;}
  503. function program3(depth0,data) {
  504. var buffer = "", stack1;
  505. buffer += "\n ";
  506. foundHelper = helpers.defaultValue;
  507. stack1 = foundHelper || depth0.defaultValue;
  508. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  509. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  510. buffer += escapeExpression(stack1) + "\n ";
  511. return buffer;}
  512. buffer += "<td class='code'>";
  513. foundHelper = helpers.name;
  514. stack1 = foundHelper || depth0.name;
  515. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  516. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  517. buffer += escapeExpression(stack1) + "</td>\n<td>\n ";
  518. foundHelper = helpers.isBody;
  519. stack1 = foundHelper || depth0.isBody;
  520. stack2 = helpers['if'];
  521. tmp1 = self.program(1, program1, data);
  522. tmp1.hash = {};
  523. tmp1.fn = tmp1;
  524. tmp1.inverse = self.program(3, program3, data);
  525. stack1 = stack2.call(depth0, stack1, tmp1);
  526. if(stack1 || stack1 === 0) { buffer += stack1; }
  527. buffer += "\n</td>\n<td width='500'>";
  528. foundHelper = helpers.description;
  529. stack1 = foundHelper || depth0.description;
  530. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  531. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
  532. if(stack1 || stack1 === 0) { buffer += stack1; }
  533. buffer += "</td>\n\n";
  534. return buffer;});
  535. })();
  536. (function() {
  537. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  538. templates['param_readonly_required'] = template(function (Handlebars,depth0,helpers,partials,data) {
  539. helpers = helpers || Handlebars.helpers;
  540. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  541. function program1(depth0,data) {
  542. var buffer = "", stack1;
  543. buffer += "\n <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='";
  544. foundHelper = helpers.name;
  545. stack1 = foundHelper || depth0.name;
  546. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  547. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  548. buffer += escapeExpression(stack1) + "'>";
  549. foundHelper = helpers.defaultValue;
  550. stack1 = foundHelper || depth0.defaultValue;
  551. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  552. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  553. buffer += escapeExpression(stack1) + "</textarea>\n ";
  554. return buffer;}
  555. function program3(depth0,data) {
  556. var buffer = "", stack1;
  557. buffer += "\n ";
  558. foundHelper = helpers.defaultValue;
  559. stack1 = foundHelper || depth0.defaultValue;
  560. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  561. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  562. buffer += escapeExpression(stack1) + "\n ";
  563. return buffer;}
  564. buffer += "<td class='code required'>";
  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) + "</td>\n<td>\n ";
  570. foundHelper = helpers.isBody;
  571. stack1 = foundHelper || depth0.isBody;
  572. stack2 = helpers['if'];
  573. tmp1 = self.program(1, program1, data);
  574. tmp1.hash = {};
  575. tmp1.fn = tmp1;
  576. tmp1.inverse = self.program(3, program3, data);
  577. stack1 = stack2.call(depth0, stack1, tmp1);
  578. if(stack1 || stack1 === 0) { buffer += stack1; }
  579. buffer += "\n</td>\n<td width='500'>";
  580. foundHelper = helpers.description;
  581. stack1 = foundHelper || depth0.description;
  582. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  583. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
  584. if(stack1 || stack1 === 0) { buffer += stack1; }
  585. buffer += "</td>\n";
  586. return buffer;});
  587. })();
  588. (function() {
  589. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  590. templates['param_required'] = template(function (Handlebars,depth0,helpers,partials,data) {
  591. helpers = helpers || Handlebars.helpers;
  592. var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  593. function program1(depth0,data) {
  594. var buffer = "", stack1, stack2;
  595. buffer += "\n ";
  596. foundHelper = helpers.defaultValue;
  597. stack1 = foundHelper || depth0.defaultValue;
  598. stack2 = helpers['if'];
  599. tmp1 = self.program(2, program2, data);
  600. tmp1.hash = {};
  601. tmp1.fn = tmp1;
  602. tmp1.inverse = self.program(4, program4, data);
  603. stack1 = stack2.call(depth0, stack1, tmp1);
  604. if(stack1 || stack1 === 0) { buffer += stack1; }
  605. buffer += "\n \n ";
  606. return buffer;}
  607. function program2(depth0,data) {
  608. var buffer = "", stack1;
  609. buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='";
  610. foundHelper = helpers.name;
  611. stack1 = foundHelper || depth0.name;
  612. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  613. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  614. buffer += escapeExpression(stack1) + "'>";
  615. foundHelper = helpers.defaultValue;
  616. stack1 = foundHelper || depth0.defaultValue;
  617. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  618. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  619. buffer += escapeExpression(stack1) + "</textarea>\n ";
  620. return buffer;}
  621. function program4(depth0,data) {
  622. var buffer = "", stack1;
  623. buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='";
  624. foundHelper = helpers.name;
  625. stack1 = foundHelper || depth0.name;
  626. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  627. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  628. buffer += escapeExpression(stack1) + "'></textarea>\n ";
  629. return buffer;}
  630. function program6(depth0,data) {
  631. var buffer = "", stack1, stack2;
  632. buffer += "\n ";
  633. foundHelper = helpers.defaultValue;
  634. stack1 = foundHelper || depth0.defaultValue;
  635. stack2 = helpers['if'];
  636. tmp1 = self.program(7, program7, data);
  637. tmp1.hash = {};
  638. tmp1.fn = tmp1;
  639. tmp1.inverse = self.program(9, program9, data);
  640. stack1 = stack2.call(depth0, stack1, tmp1);
  641. if(stack1 || stack1 === 0) { buffer += stack1; }
  642. buffer += "\n ";
  643. return buffer;}
  644. function program7(depth0,data) {
  645. var buffer = "", stack1;
  646. buffer += "\n <input class='required' minlength='1' name='";
  647. foundHelper = helpers.name;
  648. stack1 = foundHelper || depth0.name;
  649. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  650. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  651. buffer += escapeExpression(stack1) + "' placeholder='(required)' type='text' value='";
  652. foundHelper = helpers.defaultValue;
  653. stack1 = foundHelper || depth0.defaultValue;
  654. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  655. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }
  656. buffer += escapeExpression(stack1) + "'/>\n ";
  657. return buffer;}
  658. function program9(depth0,data) {
  659. var buffer = "", stack1;
  660. buffer += "\n <input class='required' minlength='1' name='";
  661. foundHelper = helpers.name;
  662. stack1 = foundHelper || depth0.name;
  663. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  664. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  665. buffer += escapeExpression(stack1) + "' placeholder='(required)' type='text' value=''/>\n ";
  666. return buffer;}
  667. buffer += "<td class='code required'>";
  668. foundHelper = helpers.name;
  669. stack1 = foundHelper || depth0.name;
  670. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  671. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  672. buffer += escapeExpression(stack1) + "</td>\n<td>\n ";
  673. foundHelper = helpers.isBody;
  674. stack1 = foundHelper || depth0.isBody;
  675. stack2 = helpers['if'];
  676. tmp1 = self.program(1, program1, data);
  677. tmp1.hash = {};
  678. tmp1.fn = tmp1;
  679. tmp1.inverse = self.program(6, program6, data);
  680. stack1 = stack2.call(depth0, stack1, tmp1);
  681. if(stack1 || stack1 === 0) { buffer += stack1; }
  682. buffer += "\n</td>\n<td width='500'>\n <strong>";
  683. foundHelper = helpers.description;
  684. stack1 = foundHelper || depth0.description;
  685. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  686. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }
  687. if(stack1 || stack1 === 0) { buffer += stack1; }
  688. buffer += "</strong>\n</td>\n";
  689. return buffer;});
  690. })();
  691. (function() {
  692. var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
  693. templates['resource'] = template(function (Handlebars,depth0,helpers,partials,data) {
  694. helpers = helpers || Handlebars.helpers;
  695. var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  696. buffer += "<div class='heading'>\n <h2>\n <a href='#!/";
  697. foundHelper = helpers.name;
  698. stack1 = foundHelper || depth0.name;
  699. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  700. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  701. buffer += escapeExpression(stack1) + "' onclick=\"Docs.toggleEndpointListForResource('";
  702. foundHelper = helpers.name;
  703. stack1 = foundHelper || depth0.name;
  704. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  705. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  706. buffer += escapeExpression(stack1) + "');\">/";
  707. foundHelper = helpers.name;
  708. stack1 = foundHelper || depth0.name;
  709. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  710. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  711. buffer += escapeExpression(stack1) + "</a>\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/";
  712. foundHelper = helpers.name;
  713. stack1 = foundHelper || depth0.name;
  714. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  715. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  716. buffer += escapeExpression(stack1) + "' id='endpointListTogger_";
  717. foundHelper = helpers.name;
  718. stack1 = foundHelper || depth0.name;
  719. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  720. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  721. buffer += escapeExpression(stack1) + "'\n onclick=\"Docs.toggleEndpointListForResource('";
  722. foundHelper = helpers.name;
  723. stack1 = foundHelper || depth0.name;
  724. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  725. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  726. buffer += escapeExpression(stack1) + "');\">Show/Hide</a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.collapseOperationsForResource('";
  727. foundHelper = helpers.name;
  728. stack1 = foundHelper || depth0.name;
  729. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  730. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  731. buffer += escapeExpression(stack1) + "'); return false;\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.expandOperationsForResource('";
  732. foundHelper = helpers.name;
  733. stack1 = foundHelper || depth0.name;
  734. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  735. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  736. buffer += escapeExpression(stack1) + "'); return false;\">\n Expand Operations\n </a>\n </li>\n <li>\n <a href='";
  737. foundHelper = helpers.url;
  738. stack1 = foundHelper || depth0.url;
  739. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  740. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "url", { hash: {} }); }
  741. buffer += escapeExpression(stack1) + "'>Raw</a>\n </li>\n </ul>\n</div>\n<ul class='endpoints' id='";
  742. foundHelper = helpers.name;
  743. stack1 = foundHelper || depth0.name;
  744. if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  745. else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }
  746. buffer += escapeExpression(stack1) + "_endpoint_list' style='display:none'>\n\n</ul>\n";
  747. return buffer;});
  748. })();
  749. // Generated by CoffeeScript 1.3.3
  750. (function() {
  751. var HeaderView, MainView, OperationView, ParameterView, ResourceView, SwaggerUi,
  752. __hasProp = {}.hasOwnProperty,
  753. __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; };
  754. SwaggerUi = (function(_super) {
  755. __extends(SwaggerUi, _super);
  756. function SwaggerUi() {
  757. return SwaggerUi.__super__.constructor.apply(this, arguments);
  758. }
  759. SwaggerUi.prototype.routes = {
  760. '': 'load'
  761. };
  762. SwaggerUi.prototype.dom_id = "swagger_ui";
  763. SwaggerUi.prototype.options = null;
  764. SwaggerUi.prototype.api = null;
  765. SwaggerUi.prototype.headerView = null;
  766. SwaggerUi.prototype.mainView = null;
  767. SwaggerUi.prototype.initialize = function(options) {
  768. var _this = this;
  769. if (options == null) {
  770. options = {};
  771. }
  772. if (options.dom_id != null) {
  773. this.dom_id = options.dom_id;
  774. delete options.dom_id;
  775. }
  776. if (!($('#' + this.dom_id) != null)) {
  777. $('body').append('<div id="' + this.dom_id + '"></div>');
  778. }
  779. this.options = options;
  780. this.options.success = function() {
  781. return _this.render();
  782. };
  783. this.options.progress = function(d) {
  784. return _this.showMessage(d);
  785. };
  786. this.options.failure = function(d) {
  787. return _this.onLoadFailure(d);
  788. };
  789. this.headerView = new HeaderView({
  790. el: $('#header')
  791. });
  792. return this.headerView.on('update-swagger-ui', function(data) {
  793. return _this.updateSwaggerUi(data);
  794. });
  795. };
  796. SwaggerUi.prototype.updateSwaggerUi = function(data) {
  797. this.options.discoveryUrl = data.discoveryUrl;
  798. this.options.apiKey = data.apiKey;
  799. return this.load();
  800. };
  801. SwaggerUi.prototype.load = function() {
  802. var _ref;
  803. if ((_ref = this.mainView) != null) {
  804. _ref.clear();
  805. }
  806. this.headerView.update(this.options.discoveryUrl, this.options.apiKey);
  807. this.api = new SwaggerApi(this.options);
  808. return Backbone.history.start({
  809. pushState: true
  810. });
  811. };
  812. SwaggerUi.prototype.render = function() {
  813. var _this = this;
  814. this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
  815. this.mainView = new MainView({
  816. model: this.api,
  817. el: $('#' + this.dom_id)
  818. }).render();
  819. this.showMessage();
  820. return setTimeout(function() {
  821. return Docs.shebang();
  822. }, 400);
  823. };
  824. SwaggerUi.prototype.showMessage = function(data) {
  825. if (data == null) {
  826. data = '';
  827. }
  828. $('#message-bar').removeClass('message-fail');
  829. $('#message-bar').addClass('message-success');
  830. return $('#message-bar').html(data);
  831. };
  832. SwaggerUi.prototype.onLoadFailure = function(data) {
  833. if (data == null) {
  834. data = '';
  835. }
  836. $('#message-bar').removeClass('message-success');
  837. $('#message-bar').addClass('message-fail');
  838. return $('#message-bar').html(data);
  839. };
  840. return SwaggerUi;
  841. })(Backbone.Router);
  842. window.SwaggerUi = SwaggerUi;
  843. HeaderView = (function(_super) {
  844. __extends(HeaderView, _super);
  845. function HeaderView() {
  846. return HeaderView.__super__.constructor.apply(this, arguments);
  847. }
  848. HeaderView.prototype.events = {
  849. 'click #show-pet-store-icon': 'showPetStore',
  850. 'click #show-wordnik-dev-icon': 'showWordnikDev',
  851. 'click #explore': 'showCustom',
  852. 'keyup #input_baseUrl': 'showCustomOnKeyup',
  853. 'keyup #input_apiKey': 'showCustomOnKeyup'
  854. };
  855. HeaderView.prototype.initialize = function() {};
  856. HeaderView.prototype.showPetStore = function(e) {
  857. return this.trigger('update-swagger-ui', {
  858. discoveryUrl: "http://petstore.swagger.wordnik.com/api/resources.json",
  859. apiKey: "special-key"
  860. });
  861. };
  862. HeaderView.prototype.showWordnikDev = function(e) {
  863. return this.trigger('update-swagger-ui', {
  864. discoveryUrl: "http://api.wordnik.com/v4/resources.json",
  865. apiKey: ""
  866. });
  867. };
  868. HeaderView.prototype.showCustomOnKeyup = function(e) {
  869. if (e.keyCode === 13) {
  870. return this.showCustom();
  871. }
  872. };
  873. HeaderView.prototype.showCustom = function(e) {
  874. if (e != null) {
  875. e.preventDefault();
  876. }
  877. return this.trigger('update-swagger-ui', {
  878. discoveryUrl: $('#input_baseUrl').val(),
  879. apiKey: $('#input_apiKey').val()
  880. });
  881. };
  882. HeaderView.prototype.update = function(url, apiKey, trigger) {
  883. if (trigger == null) {
  884. trigger = false;
  885. }
  886. $('#input_baseUrl').val(url);
  887. $('#input_apiKey').val(apiKey);
  888. if (trigger) {
  889. return this.trigger('update-swagger-ui', {
  890. discoveryUrl: url,
  891. apiKey: apiKey
  892. });
  893. }
  894. };
  895. return HeaderView;
  896. })(Backbone.View);
  897. MainView = (function(_super) {
  898. __extends(MainView, _super);
  899. function MainView() {
  900. return MainView.__super__.constructor.apply(this, arguments);
  901. }
  902. MainView.prototype.initialize = function() {};
  903. MainView.prototype.render = function() {
  904. var resource, _i, _len, _ref;
  905. $(this.el).html(Handlebars.templates.main(this.model));
  906. _ref = this.model.resourcesArray;
  907. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  908. resource = _ref[_i];
  909. this.addResource(resource);
  910. }
  911. return this;
  912. };
  913. MainView.prototype.addResource = function(resource) {
  914. var resourceView;
  915. resourceView = new ResourceView({
  916. model: resource,
  917. tagName: 'li',
  918. id: 'resource_' + resource.name,
  919. className: 'resource'
  920. });
  921. return $('#resources').append(resourceView.render().el);
  922. };
  923. MainView.prototype.clear = function() {
  924. return $(this.el).html('');
  925. };
  926. return MainView;
  927. })(Backbone.View);
  928. ResourceView = (function(_super) {
  929. __extends(ResourceView, _super);
  930. function ResourceView() {
  931. return ResourceView.__super__.constructor.apply(this, arguments);
  932. }
  933. ResourceView.prototype.initialize = function() {};
  934. ResourceView.prototype.render = function() {
  935. var operation, _i, _len, _ref;
  936. $(this.el).html(Handlebars.templates.resource(this.model));
  937. _ref = this.model.operationsArray;
  938. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  939. operation = _ref[_i];
  940. this.addOperation(operation);
  941. }
  942. return this;
  943. };
  944. ResourceView.prototype.addOperation = function(operation) {
  945. var operationView;
  946. operationView = new OperationView({
  947. model: operation,
  948. tagName: 'li',
  949. className: 'endpoint'
  950. });
  951. return $('.endpoints', $(this.el)).append(operationView.render().el);
  952. };
  953. return ResourceView;
  954. })(Backbone.View);
  955. OperationView = (function(_super) {
  956. __extends(OperationView, _super);
  957. function OperationView() {
  958. return OperationView.__super__.constructor.apply(this, arguments);
  959. }
  960. OperationView.prototype.events = {
  961. 'click .submit': 'submitOperation',
  962. 'click .response_hider': 'hideResponse',
  963. 'click .toggleOperation': 'toggleOperationContent'
  964. };
  965. OperationView.prototype.initialize = function() {};
  966. OperationView.prototype.render = function() {
  967. var isMethodSubmissionSupported, param, _i, _len, _ref;
  968. isMethodSubmissionSupported = jQuery.inArray(this.model.httpMethod, this.model.supportedSubmitMethods()) >= 0;
  969. if (!isMethodSubmissionSupported) {
  970. this.model.isReadOnly = true;
  971. }
  972. $(this.el).html(Handlebars.templates.operation(this.model));
  973. _ref = this.model.parameters;
  974. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  975. param = _ref[_i];
  976. this.addParameter(param);
  977. }
  978. return this;
  979. };
  980. OperationView.prototype.addParameter = function(param) {
  981. var paramView;
  982. paramView = new ParameterView({
  983. model: param,
  984. tagName: 'tr',
  985. readOnly: this.model.isReadOnly
  986. });
  987. return $('.operation-params', $(this.el)).append(paramView.render().el);
  988. };
  989. OperationView.prototype.submitOperation = function() {
  990. var bodyParam, error_free, form, headerParams, invocationUrl, map, o, obj, param, _i, _j, _len, _len1, _ref, _ref1,
  991. _this = this;
  992. form = $('.sandbox', $(this.el));
  993. error_free = true;
  994. form.find("input.required").each(function() {
  995. var _this = this;
  996. $(this).removeClass("error");
  997. if (jQuery.trim($(this).val()) === "") {
  998. $(this).addClass("error");
  999. $(this).wiggle({
  1000. callback: function() {
  1001. return $(_this).focus();
  1002. }
  1003. });
  1004. return error_free = false;
  1005. }
  1006. });
  1007. if (error_free) {
  1008. map = {};
  1009. _ref = form.serializeArray();
  1010. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1011. o = _ref[_i];
  1012. if ((o.value != null) && jQuery.trim(o.value).length > 0) {
  1013. map[o.name] = o.value;
  1014. }
  1015. }
  1016. bodyParam = null;
  1017. _ref1 = this.model.parameters;
  1018. for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
  1019. param = _ref1[_j];
  1020. if (param.paramType === 'body') {
  1021. bodyParam = map[param.name];
  1022. }
  1023. }
  1024. log("bodyParam = " + bodyParam);
  1025. headerParams = null;
  1026. invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), this.model.urlify(map, false)) : this.model.urlify(map, true);
  1027. log('submitting ' + invocationUrl);
  1028. $(".request_url", $(this.el)).html("<pre>" + invocationUrl + "</pre>");
  1029. $(".response_throbber", $(this.el)).show();
  1030. obj = {
  1031. type: this.model.httpMethod,
  1032. url: invocationUrl,
  1033. headers: headerParams,
  1034. data: bodyParam,
  1035. dataType: 'json',
  1036. error: function(xhr, textStatus, error) {
  1037. return _this.showErrorStatus(xhr, textStatus, error);
  1038. },
  1039. success: function(data) {
  1040. return _this.showResponse(data);
  1041. },
  1042. complete: function(data) {
  1043. return _this.showCompleteStatus(data);
  1044. }
  1045. };
  1046. if (obj.type.toLowerCase() === "post" || obj.type.toLowerCase() === "put") {
  1047. obj.contentType = "application/json";
  1048. }
  1049. return jQuery.ajax(obj);
  1050. }
  1051. };
  1052. OperationView.prototype.hideResponse = function(e) {
  1053. if (e != null) {
  1054. e.preventDefault();
  1055. }
  1056. $(".response", $(this.el)).slideUp();
  1057. return $(".response_hider", $(this.el)).fadeOut();
  1058. };
  1059. OperationView.prototype.showResponse = function(response) {
  1060. var prettyJson;
  1061. prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");
  1062. return $(".response_body", $(this.el)).html(prettyJson);
  1063. };
  1064. OperationView.prototype.showErrorStatus = function(data) {
  1065. return this.showStatus(data);
  1066. };
  1067. OperationView.prototype.showCompleteStatus = function(data) {
  1068. return this.showStatus(data);
  1069. };
  1070. OperationView.prototype.showStatus = function(data) {
  1071. var response_body;
  1072. try {
  1073. response_body = "<pre>" + JSON.stringify(JSON.parse(data.responseText), null, 2).replace(/\n/g, "<br>") + "</pre>";
  1074. } catch (error) {
  1075. response_body = "<span style='color:red'>&nbsp;&nbsp;&nbsp;[unable to parse as json; raw response below]</span><br><pre>" + data.responseText + "</pre>";
  1076. }
  1077. $(".response_code", $(this.el)).html("<pre>" + data.status + "</pre>");
  1078. $(".response_body", $(this.el)).html(response_body);
  1079. $(".response_headers", $(this.el)).html("<pre>" + data.getAllResponseHeaders() + "</pre>");
  1080. $(".response", $(this.el)).slideDown();
  1081. $(".response_hider", $(this.el)).show();
  1082. return $(".response_throbber", $(this.el)).hide();
  1083. };
  1084. OperationView.prototype.toggleOperationContent = function() {
  1085. var elem;
  1086. elem = $('#' + this.model.resourceName + "_" + this.model.nickname + "_" + this.model.httpMethod + "_content");
  1087. if (elem.is(':visible')) {
  1088. return Docs.collapseOperation(elem);
  1089. } else {
  1090. return Docs.expandOperation(elem);
  1091. }
  1092. };
  1093. return OperationView;
  1094. })(Backbone.View);
  1095. ParameterView = (function(_super) {
  1096. __extends(ParameterView, _super);
  1097. function ParameterView() {
  1098. return ParameterView.__super__.constructor.apply(this, arguments);
  1099. }
  1100. ParameterView.prototype.initialize = function() {};
  1101. ParameterView.prototype.render = function() {
  1102. var template;
  1103. if (this.model.paramType === 'body') {
  1104. this.model.isBody = true;
  1105. }
  1106. template = this.template();
  1107. $(this.el).html(template(this.model));
  1108. return this;
  1109. };
  1110. ParameterView.prototype.template = function() {
  1111. if (this.model.isList) {
  1112. return Handlebars.templates.param_list;
  1113. } else {
  1114. if (this.options.readOnly) {
  1115. if (this.model.required) {
  1116. return Handlebars.templates.param_readonly_required;
  1117. } else {
  1118. return Handlebars.templates.param_readonly;
  1119. }
  1120. } else {
  1121. if (this.model.required) {
  1122. return Handlebars.templates.param_required;
  1123. } else {
  1124. return Handlebars.templates.param;
  1125. }
  1126. }
  1127. }
  1128. };
  1129. return ParameterView;
  1130. })(Backbone.View);
  1131. }).call(this);