Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 1 | <!-- Adapted from Swagger UI --> |
| 2 | <!DOCTYPE html> |
| 3 | <html> |
| 4 | <head> |
| 5 | <title>ONOS API Docs</title> |
| 6 | <link rel="icon" type="image/png" href="images/onos-logo.png"/> |
| 7 | |
| 8 | <link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/> |
| 9 | <link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/> |
| 10 | <link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/> |
| 11 | <link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/> |
| 12 | <link href='css/print.css' media='print' rel='stylesheet' type='text/css'/> |
| 13 | <script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script> |
| 14 | <script src='lib/jquery.slideto.min.js' type='text/javascript'></script> |
| 15 | <script src='lib/jquery.wiggle.min.js' type='text/javascript'></script> |
| 16 | <script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script> |
| 17 | <script src='lib/handlebars-2.0.0.js' type='text/javascript'></script> |
| 18 | <script src='lib/underscore-min.js' type='text/javascript'></script> |
| 19 | <script src='lib/backbone-min.js' type='text/javascript'></script> |
| 20 | <script src='swagger-ui.js' type='text/javascript'></script> |
| 21 | <script src='lib/highlight.7.3.pack.js' type='text/javascript'></script> |
| 22 | <script src='lib/marked.js' type='text/javascript'></script> |
| 23 | <script src='lib/swagger-oauth.js' type='text/javascript'></script> |
| 24 | |
| 25 | <script type="text/javascript"> |
| 26 | $(function () { |
| 27 | var url = window.location.search.match(/url=([^&]+)/); |
| 28 | if (url && url.length > 1) { |
| 29 | url = decodeURIComponent(url[1]); |
| 30 | } else { |
| 31 | url = "/onos/v1/docs/apis/onos/v1/swagger.json"; |
| 32 | } |
| 33 | window.swaggerUi = new SwaggerUi({ |
| 34 | url: url, |
| 35 | dom_id: "swagger-ui-container", |
| 36 | supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'], |
| 37 | onComplete: function(swaggerApi, swaggerUi){ |
| 38 | if(typeof initOAuth == "function") { |
| 39 | initOAuth({ |
| 40 | clientId: "your-client-id", |
| 41 | realm: "your-realms", |
| 42 | appName: "your-app-name" |
| 43 | }); |
| 44 | } |
| 45 | |
| 46 | $('pre code').each(function(i, e) { |
| 47 | hljs.highlightBlock(e) |
| 48 | }); |
| 49 | |
| 50 | addApiKeyAuthorization(); |
| 51 | }, |
| 52 | onFailure: function(data) { |
| 53 | log("Unable to Load SwaggerUI"); |
| 54 | }, |
| 55 | docExpansion: "none", |
| 56 | apisSorter: "alpha", |
| 57 | showRequestHeaders: false |
| 58 | }); |
| 59 | |
| 60 | function addApiKeyAuthorization(){ |
| 61 | var key = encodeURIComponent($('#input_apiKey')[0].value); |
| 62 | if(key && key.trim() != "") { |
| 63 | var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("api_key", key, "query"); |
| 64 | window.swaggerUi.api.clientAuthorizations.add("api_key", apiKeyAuth); |
| 65 | log("added key " + key); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | $('#input_apiKey').change(addApiKeyAuthorization); |
| 70 | |
| 71 | // if you have an apiKey you would like to pre-populate on the page for demonstration purposes... |
| 72 | /* |
| 73 | var apiKey = "myApiKeyXXXX123456789"; |
| 74 | $('#input_apiKey').val(apiKey); |
| 75 | */ |
| 76 | |
| 77 | window.swaggerUi.load(); |
| 78 | |
| 79 | function log() { |
| 80 | if ('console' in window) { |
| 81 | console.log.apply(console, arguments); |
| 82 | } |
| 83 | } |
| 84 | }); |
| 85 | |
| 86 | function selectApi() { |
| 87 | $('#input_baseUrl').val('/onos/v1/docs/apis' + $('select').val() + '/swagger.json'); |
| 88 | $('#explore').click(); |
| 89 | } |
| 90 | </script> |
| 91 | </head> |
| 92 | |
| 93 | <body class="swagger-section"> |
| 94 | <div id='header'> |
| 95 | <div class="swagger-ui-wrap"> |
| 96 | <a id="logo" href="#"></a> |
| 97 | <form id='api_selector'> |
| 98 | <div class='input' id='selector'> |
| 99 | <select onchange="selectApi()"> |
| 100 | <!-- {API-START} --> |
| 101 | <option value="v1">ONOS v1 Core</option> |
| 102 | <option value="foo">ONOS Foo app</option> |
| 103 | <option value="bar">ONOS Bar app</option> |
| 104 | <!-- {API-END} --> |
| 105 | </select> |
| 106 | </div> |
| 107 | <div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div> |
| 108 | <div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div> |
| 109 | <div class='input'><a id="explore" href="#">Explore</a></div> |
| 110 | </form> |
| 111 | </div> |
| 112 | </div> |
| 113 | |
| 114 | <div id="message-bar" class="swagger-ui-wrap"> </div> |
| 115 | <div id="swagger-ui-container" class="swagger-ui-wrap"></div> |
| 116 | <div id="footer" class="swagger-ui-wrap"><a href="http://swagger.io/swagger-ui/">Swagger UI</a> adaptation</div> |
| 117 | </body> |
| 118 | </html> |