');
- var isLogout = false;
-
- auths.forEach(function (auth) {
- var authView = new SwaggerUi.Views.AuthView({data: auth, router: this.router});
- var authEl = authView.render().el;
- $el.append(authEl);
- if (authView.isLogout) {
- isLogout = true;
- }
- }, this);
-
- this.model.isLogout = isLogout;
-
- return $el;
+ togglePasswordContainer: function(){
+ if ($('#basic_auth_container').length) {
+ var elem = $('#basic_auth_container').show();
+ if (elem.is(':visible')){
+ elem.slideUp();
+ } else {
+ // hide others
+ $('.auth_container').hide();
+ elem.show();
+ }
}
+ },
-});
+ template: function(){
+ return Handlebars.templates.basic_auth_button_view;
+ }
-'use strict';
-
-SwaggerUi.Collections.AuthsCollection = Backbone.Collection.extend({
- constructor: function() {
- var args = Array.prototype.slice.call(arguments);
-
- args[0] = this.parse(args[0]);
-
- Backbone.Collection.apply(this, args);
- },
-
- add: function (model) {
- var args = Array.prototype.slice.call(arguments);
-
- if (Array.isArray(model)) {
- args[0] = _.map(model, function(val) {
- return this.handleOne(val);
- }, this);
- } else {
- args[0] = this.handleOne(model);
- }
-
- Backbone.Collection.prototype.add.apply(this, args);
- },
-
- handleOne: function (model) {
- var result = model;
-
- if (! (model instanceof Backbone.Model) ) {
- switch (model.type) {
- case 'oauth2':
- result = new SwaggerUi.Models.Oauth2Model(model);
- break;
- case 'basic':
- result = new SwaggerUi.Models.BasicAuthModel(model);
- break;
- case 'apiKey':
- result = new SwaggerUi.Models.ApiKeyAuthModel(model);
- break;
- default:
- result = new Backbone.Model(model);
- }
- }
-
- return result;
- },
-
- isValid: function () {
- var valid = true;
-
- this.models.forEach(function(model) {
- if (!model.validate()) {
- valid = false;
- }
- });
-
- return valid;
- },
-
- isAuthorized: function () {
- return this.length === this.where({ isLogout: true }).length;
- },
-
- isPartiallyAuthorized: function () {
- return this.where({ isLogout: true }).length > 0;
- },
-
- parse: function (data) {
- var authz = Object.assign({}, window.swaggerUi.api.clientAuthorizations.authz);
-
- return _.map(data, function (auth, name) {
- var isBasic = authz.basic && auth.type === 'basic';
-
- _.extend(auth, {
- title: name
- });
-
- if (authz[name] || isBasic) {
- _.extend(auth, {
- isLogout: true,
- value: isBasic ? undefined : authz[name].value,
- username: isBasic ? authz.basic.username : undefined,
- password: isBasic ? authz.basic.password : undefined,
- valid: true
- });
- }
-
- return auth;
- });
- }
-});
-'use strict';
-
-SwaggerUi.Views.AuthsCollectionView = Backbone.View.extend({
-
- initialize: function(opts) {
- this.options = opts || {};
- this.options.data = this.options.data || {};
- this.router = this.options.router;
-
- this.collection = new SwaggerUi.Collections.AuthsCollection(opts.data);
-
- this.$innerEl = $('
');
- this.authViews = [];
- },
-
- render: function () {
- this.collection.each(function (auth) {
- this.renderOneAuth(auth);
- }, this);
-
- this.$el.html(this.$innerEl.html() ? this.$innerEl : '');
-
- return this;
- },
-
- renderOneAuth: function (authModel) {
- var authViewEl, authView, authViewName;
- var type = authModel.get('type');
-
- if (type === 'apiKey') {
- authViewName = 'ApiKeyAuthView';
- } else if (type === 'basic' && this.$innerEl.find('.basic_auth_container').length === 0) {
- authViewName = 'BasicAuthView';
- } else if (type === 'oauth2') {
- authViewName = 'Oauth2View';
- }
-
- if (authViewName) {
- authView = new SwaggerUi.Views[authViewName]({model: authModel, router: this.router});
- authViewEl = authView.render().el;
- this.authViews.push(authView);
- }
-
- this.$innerEl.append(authViewEl);
- },
-
- highlightInvalid: function () {
- this.authViews.forEach(function (view) {
- view.highlightInvalid();
- }, this);
- }
-
-});
-
-'use strict';
-
-/* global redirect_uri */
-/* global clientId */
-/* global scopeSeparator */
-/* global additionalQueryStringParams */
-/* global clientSecret */
-/* global onOAuthComplete */
-/* global realm */
-/*jshint unused:false*/
-
-SwaggerUi.Views.AuthView = Backbone.View.extend({
- events: {
- 'click .auth_submit__button': 'authorizeClick',
- 'click .auth_logout__button': 'logoutClick'
- },
-
- tpls: {
- main: Handlebars.templates.auth_view
- },
-
- selectors: {
- innerEl: '.auth_inner',
- authBtn: '.auth_submit__button'
- },
-
- initialize: function(opts) {
- this.options = opts || {};
- opts.data = opts.data || {};
- this.router = this.options.router;
-
- this.authsCollectionView = new SwaggerUi.Views.AuthsCollectionView({data: opts.data});
-
- this.$el.html(this.tpls.main({
- isLogout: this.authsCollectionView.collection.isAuthorized(),
- isAuthorized: this.authsCollectionView.collection.isPartiallyAuthorized()
- }));
- this.$innerEl = this.$(this.selectors.innerEl);
- this.isLogout = this.authsCollectionView.collection.isPartiallyAuthorized();
- },
-
- render: function () {
- this.$innerEl.html(this.authsCollectionView.render().el);
-
- return this;
- },
-
- authorizeClick: function (e) {
- e.preventDefault();
- e.stopPropagation();
-
- if (this.authsCollectionView.collection.isValid()) {
- this.authorize();
- } else {
- this.authsCollectionView.highlightInvalid();
- }
- },
-
- authorize: function () {
- this.authsCollectionView.collection.forEach(function (auth) {
- var keyAuth, basicAuth;
- var type = auth.get('type');
-
- if (type === 'apiKey') {
- keyAuth = new SwaggerClient.ApiKeyAuthorization(
- auth.get('name'),
- auth.get('value'),
- auth.get('in')
- );
-
- this.router.api.clientAuthorizations.add(auth.get('title'), keyAuth);
- } else if (type === 'basic') {
- basicAuth = new SwaggerClient.PasswordAuthorization(auth.get('username'), auth.get('password'));
- this.router.api.clientAuthorizations.add(auth.get('type'), basicAuth);
- } else if (type === 'oauth2') {
- this.handleOauth2Login(auth);
- }
- }, this);
-
- this.router.load();
- },
-
- logoutClick: function (e) {
- e.preventDefault();
-
- this.authsCollectionView.collection.forEach(function (auth) {
- var name = auth.get('type') === 'basic' ? 'basic' : auth.get('title');
-
- window.swaggerUi.api.clientAuthorizations.remove(name);
- });
-
- this.router.load();
- },
-
- // taken from lib/swagger-oauth.js
- handleOauth2Login: function (auth) {
- var host = window.location;
- var pathname = location.pathname.substring(0, location.pathname.lastIndexOf('/'));
- var defaultRedirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
- var redirectUrl = window.oAuthRedirectUrl || defaultRedirectUrl;
- var url = null;
- var scopes = _.map(auth.get('scopes'), function (scope) {
- return scope.scope;
- });
- var state, dets, ep;
- window.OAuthSchemeKey = auth.get('title');
-
- window.enabledScopes = scopes;
- var flow = auth.get('flow');
-
- if(auth.get('type') === 'oauth2' && flow && (flow === 'implicit' || flow === 'accessCode')) {
- dets = auth.attributes;
- url = dets.authorizationUrl + '?response_type=' + (flow === 'implicit' ? 'token' : 'code');
- window.swaggerUi.tokenName = dets.tokenName || 'access_token';
- window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null);
- state = window.OAuthSchemeKey;
- }
- else if(auth.get('type') === 'oauth2' && flow && (flow === 'application')) {
- dets = auth.attributes;
- window.swaggerUi.tokenName = dets.tokenName || 'access_token';
- this.clientCredentialsFlow(scopes, dets.tokenUrl, window.OAuthSchemeKey);
- return;
- }
- else if(auth.get('grantTypes')) {
- // 1.2 support
- var o = auth.get('grantTypes');
- for(var t in o) {
- if(o.hasOwnProperty(t) && t === 'implicit') {
- dets = o[t];
- ep = dets.loginEndpoint.url;
- url = dets.loginEndpoint.url + '?response_type=token';
- window.swaggerUi.tokenName = dets.tokenName;
- }
- else if (o.hasOwnProperty(t) && t === 'accessCode') {
- dets = o[t];
- ep = dets.tokenRequestEndpoint.url;
- url = dets.tokenRequestEndpoint.url + '?response_type=code';
- window.swaggerUi.tokenName = dets.tokenName;
- }
- }
- }
-
- var redirect_uri = redirectUrl;
-
- url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
- url += '&realm=' + encodeURIComponent(realm);
- url += '&client_id=' + encodeURIComponent(clientId);
- url += '&scope=' + encodeURIComponent(scopes.join(scopeSeparator));
- url += '&state=' + encodeURIComponent(state);
- for (var key in additionalQueryStringParams) {
- url += '&' + key + '=' + encodeURIComponent(additionalQueryStringParams[key]);
- }
-
- window.open(url);
- },
-
- // taken from lib/swagger-oauth.js
- clientCredentialsFlow: function (scopes, tokenUrl, OAuthSchemeKey) {
- var params = {
- 'client_id': clientId,
- 'client_secret': clientSecret,
- 'scope': scopes.join(' '),
- 'grant_type': 'client_credentials'
- };
- $.ajax({
- url : tokenUrl,
- type: 'POST',
- data: params,
- success: function (data)
- {
- onOAuthComplete(data, OAuthSchemeKey);
- },
- error: function ()
- {
- onOAuthComplete('');
- }
- });
- }
-
-});
-
-'use strict';
-
-SwaggerUi.Models.BasicAuthModel = Backbone.Model.extend({
- defaults: {
- username: '',
- password: '',
- title: 'basic'
- },
-
- initialize: function () {
- this.on('change', this.validate);
- },
-
- validate: function () {
- var valid = !!this.get('password') && !!this.get('username');
-
- this.set('valid', valid);
-
- return valid;
- }
-});
-'use strict';
-
-SwaggerUi.Views.BasicAuthView = Backbone.View.extend({
-
- initialize: function (opts) {
- this.options = opts || {};
- this.router = this.options.router;
- },
-
- events: {
- 'change .auth_input': 'inputChange'
- },
-
- selectors: {
- usernameInput: '.basic_auth__username',
- passwordInput: '.basic_auth__password'
- },
-
- cls: {
- error: 'error'
- },
-
- template: Handlebars.templates.basic_auth,
-
- render: function(){
- $(this.el).html(this.template(this.model.toJSON()));
-
- return this;
- },
-
- inputChange: function (e) {
- var $el = $(e.target);
- var val = $el.val();
- var attr = $el.prop('name');
-
- if (val) {
- $el.removeClass(this.cls.error);
- }
-
- this.model.set(attr, val);
- },
-
- isValid: function () {
- return this.model.validate();
- },
-
- highlightInvalid: function () {
- if (!this.model.get('username')) {
- this.$(this.selectors.usernameInput).addClass(this.cls.error);
- }
-
- if (!this.model.get('password')) {
- this.$(this.selectors.passwordInput).addClass(this.cls.error);
- }
- }
});
'use strict';
@@ -19816,7 +19123,8 @@ SwaggerUi.Views.HeaderView = Backbone.View.extend({
}
this.trigger('update-swagger-ui', {
- url: $('#input_baseUrl').val()
+ url: $('#input_baseUrl').val(),
+ apiKey: $('#input_apiKey').val()
});
},
@@ -19827,6 +19135,7 @@ SwaggerUi.Views.HeaderView = Backbone.View.extend({
$('#input_baseUrl').val(url);
+ //$('#input_apiKey').val(apiKey);
if (trigger) {
this.trigger('update-swagger-ui', {url:url});
}
@@ -19917,9 +19226,26 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
},
- render: function () {
+ render: function(){
+ if (this.model.securityDefinitions) {
+ for (var name in this.model.securityDefinitions) {
+ var auth = this.model.securityDefinitions[name];
+ var button;
+
+ if (auth.type === 'apiKey' && $('#apikey_button').length === 0) {
+ button = new SwaggerUi.Views.ApiKeyButton({model: auth, router: this.router}).render().el;
+ $('.auth_main_container').append(button);
+ }
+
+ if (auth.type === 'basicAuth' && $('#basic_auth_button').length === 0) {
+ button = new SwaggerUi.Views.BasicAuthButton({model: auth, router: this.router}).render().el;
+ $('.auth_main_container').append(button);
+ }
+ }
+ }
+
+ // Render the outer container for resources
$(this.el).html(Handlebars.templates.main(this.model));
- this.model.securityDefinitions = this.model.securityDefinitions || {};
// Render each resource
@@ -19971,7 +19297,7 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
onLinkClick: function (e) {
var el = e.target;
- if (el.tagName === 'A' && el.href) {
+ if (el.tagName === 'A') {
if (location.hostname !== el.hostname || location.port !== el.port) {
e.preventDefault();
window.open(el.href, '_blank');
@@ -19982,60 +19308,6 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
'use strict';
-SwaggerUi.Models.Oauth2Model = Backbone.Model.extend({
- defaults: {
- scopes: {}
- },
-
- initialize: function () {
- this.on('change', this.validate);
- },
-
- setScopes: function (name, val) {
- var auth = _.extend({}, this.attributes);
- var index = _.findIndex(auth.scopes, function(o) {
- return o.scope === name;
- });
- auth.scopes[index].checked = val;
-
- this.set(auth);
- this.validate();
- },
-
- validate: function () {
- var valid = _.findIndex(this.get('scopes'), function (o) {
- return o.checked === true;
- }) > -1;
-
- this.set('valid', valid);
-
- return valid;
- }
-});
-'use strict';
-
-SwaggerUi.Views.Oauth2View = Backbone.View.extend({
- events: {
- 'change .oauth-scope': 'scopeChange'
- },
-
- template: Handlebars.templates.oauth2,
-
- render: function () {
- this.$el.html(this.template(this.model.toJSON()));
-
- return this;
- },
-
- scopeChange: function (e) {
- var val = $(e.target).prop('checked');
- var scope = $(e.target).data('scope');
-
- this.model.setScopes(scope, val);
- }
-});
-'use strict';
-
SwaggerUi.Views.OperationView = Backbone.View.extend({
invocationUrl: null,
@@ -20068,21 +19340,21 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
},
selectText: function(event) {
- var doc = document,
- text = event.target.firstChild,
- range,
- selection;
- if (doc.body.createTextRange) {
- range = document.body.createTextRange();
- range.moveToElementText(text);
- range.select();
- } else if (window.getSelection) {
- selection = window.getSelection();
- range = document.createRange();
- range.selectNodeContents(text);
- selection.removeAllRanges();
- selection.addRange(range);
- }
+ var doc = document,
+ text = event.target.firstChild,
+ range,
+ selection;
+ if (doc.body.createTextRange) {
+ range = document.body.createTextRange();
+ range.moveToElementText(text);
+ range.select();
+ } else if (window.getSelection) {
+ selection = window.getSelection();
+ range = document.createRange();
+ range.selectNodeContents(text);
+ selection.removeAllRanges();
+ selection.addRange(range);
+ }
},
mouseEnter: function(e) {
@@ -20293,21 +19565,6 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
this.addStatusCode(statusCode);
}
- if (Array.isArray(this.model.security)) {
- var authsModel = SwaggerUi.utils.parseSecurityDefinitions(this.model.security);
-
- authsModel.isLogout = !_.isEmpty(window.swaggerUi.api.clientAuthorizations.authz);
- this.authView = new SwaggerUi.Views.AuthButtonView({
- data: authsModel,
- router: this.router,
- isOperation: true,
- model: {
- scopes: authsModel.scopes
- }
- });
- this.$('.authorize-wrapper').append(this.authView.render().el);
- }
-
this.showSnippet();
return this;
},
@@ -20543,7 +19800,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
// wraps a jquery response as a shred response
wrap: function(data) {
- var h, headerArray, headers, i, l, len, o;
+ var h, headerArray, headers, i, l, len, o;
headers = {};
headerArray = data.getAllResponseHeaders().split('\r');
for (l = 0, len = headerArray.length; l < len; l++) {
@@ -20720,7 +19977,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
code = $('
').text('no content');
pre = $('
').append(code);
- // JSON
+ // JSON
} else if (contentType === 'application/json' || /\+json$/.test(contentType)) {
var json = null;
try {
@@ -20731,35 +19988,35 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
code = $('
').text(json);
pre = $('
').append(code);
- // XML
+ // XML
} else if (contentType === 'application/xml' || /\+xml$/.test(contentType)) {
code = $('
').text(this.formatXml(content));
pre = $('
').append(code);
- // HTML
+ // HTML
} else if (contentType === 'text/html') {
code = $('
').html(_.escape(content));
pre = $('
').append(code);
- // Plain Text
+ // Plain Text
} else if (/text\/plain/.test(contentType)) {
code = $('
').text(content);
pre = $('
').append(code);
- // Image
+ // Image
} else if (/^image\//.test(contentType)) {
pre = $('
').attr('src', url);
- // Audio
+ // Audio
} else if (/^audio\//.test(contentType) && supportsAudioPlayback(contentType)) {
pre = $('
').append($('').attr('src', url).attr('type', contentType));
- // Download
+ // Download
} else if (headers['Content-Disposition'] && (/attachment/).test(headers['Content-Disposition']) ||
- headers['content-disposition'] && (/attachment/).test(headers['content-disposition']) ||
- headers['Content-Description'] && (/File Transfer/).test(headers['Content-Description']) ||
- headers['content-description'] && (/File Transfer/).test(headers['content-description'])) {
+ headers['content-disposition'] && (/attachment/).test(headers['content-disposition']) ||
+ headers['Content-Description'] && (/File Transfer/).test(headers['Content-Description']) ||
+ headers['content-description'] && (/File Transfer/).test(headers['content-description'])) {
if ('Blob' in window) {
var type = contentType || 'text/html';
@@ -20787,11 +20044,11 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
pre = $(' ').append('Download headers detected but your browser does not support downloading binary via XHR (Blob).');
}
- // Location header based redirect download
+ // Location header based redirect download
} else if(headers.location || headers.Location) {
window.location = response.url;
- // Anything else (CORS)
+ // Anything else (CORS)
} else {
code = $('').text(content);
pre = $(' ').append(code);
@@ -20817,8 +20074,8 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
if (opts.showRequestHeaders) {
var form = $('.sandbox', $(this.el)),
- map = this.getInputMap(form),
- requestHeaders = this.model.getHeaderParams(map);
+ map = this.getInputMap(form),
+ requestHeaders = this.model.getHeaderParams(map);
delete requestHeaders['Content-Type'];
$('.request_headers', $(this.el)).html('' + _.escape(JSON.stringify(requestHeaders, null, ' ')).replace(/\n/g, ' ') + ' ');
}
@@ -22045,43 +21302,6 @@ SwaggerUi.partials.signature = (function () {
'use strict';
-SwaggerUi.Views.PopupView = Backbone.View.extend({
- events: {
- 'click .api-popup-cancel': 'cancelClick'
- },
-
- template: Handlebars.templates.popup,
- className: 'api-popup-dialog',
-
- selectors: {
- content: '.api-popup-content',
- main : '#swagger-ui-container'
- },
-
- initialize: function(){
- this.$el.html(this.template(this.model));
- },
-
- render: function () {
- this.$(this.selectors.content).append(this.model.content);
- $(this.selectors.main).first().append(this.el);
- this.showPopup();
-
- return this;
- },
-
- showPopup: function () {
- this.$el.show();
- },
-
- cancelClick: function () {
- this.remove();
- }
-
-});
-
-'use strict';
-
SwaggerUi.Views.ResourceView = Backbone.View.extend({
initialize: function(opts) {
opts = opts || {};
diff --git a/dist/swagger-ui.min.js b/dist/swagger-ui.min.js
index 57b9213a..e825b529 100644
--- a/dist/swagger-ui.min.js
+++ b/dist/swagger-ui.min.js
@@ -1,9 +1,9 @@
-(function(){function e(){e.history=e.history||[],e.history.push(arguments),this.console&&console.log(Array.prototype.slice.call(arguments)[0])}this.Handlebars=this.Handlebars||{},this.Handlebars.templates=this.Handlebars.templates||{},this.Handlebars.templates.apikey_auth=Handlebars.template({1:function(e,t,n,i){var r,a="function",o=t.helperMissing,s=this.escapeExpression;return' '+s((r=null!=(r=t.value||(null!=e?e.value:e))?r:o,typeof r===a?r.call(e,{name:"value",hash:{},data:i}):r))+" \n"},3:function(e,t,n,i){return' \n'},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,i){var r,a,o="function",s=t.helperMissing,l=this.escapeExpression,u='\n"},useData:!0}),this.Handlebars.templates.auth_button_operation=Handlebars.template({1:function(e,t,n,i){return" authorize__btn_operation_login\n"},3:function(e,t,n,i){return" authorize__btn_operation_logout\n"},5:function(e,t,n,i){var r,a=' \n';return r=t.each.call(e,null!=e?e.scopes:e,{name:"each",hash:{},fn:this.program(6,i),inverse:this.noop,data:i}),null!=r&&(a+=r),a+" \n"},6:function(e,t,n,i){var r,a="function",o=t.helperMissing,s=this.escapeExpression;return' '+s((r=null!=(r=t.scope||(null!=e?e.scope:e))?r:o,typeof r===a?r.call(e,{name:"scope",hash:{},data:i}):r))+" \n"},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,i){var r,a='\n',r=t["if"].call(e,null!=e?e.scopes:e,{name:"if",hash:{},fn:this.program(5,i),inverse:this.noop,data:i}),null!=r&&(a+=r),a+"
\n"},useData:!0}),this.Handlebars.templates.auth_button=Handlebars.template({compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,i){return"Authorize \n"},useData:!0}),this.Handlebars.templates.auth_view=Handlebars.template({1:function(e,t,n,i){return' Authorize \n'},3:function(e,t,n,i){return' Logout \n'},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,i){var r,a='\n\n
\n
\n';return r=t.unless.call(e,null!=e?e.isLogout:e,{name:"unless",hash:{},fn:this.program(1,i),inverse:this.noop,data:i}),null!=r&&(a+=r),r=t["if"].call(e,null!=e?e.isAuthorized:e,{name:"if",hash:{},fn:this.program(3,i),inverse:this.noop,data:i}),null!=r&&(a+=r),a+"
\n\n
\n"},useData:!0}),this.Handlebars.templates.basic_auth=Handlebars.template({1:function(e,t,n,i){return" - authorized"},3:function(e,t,n,i){var r,a="function",o=t.helperMissing,s=this.escapeExpression;return' '+s((r=null!=(r=t.username||(null!=e?e.username:e))?r:o,typeof r===a?r.call(e,{name:"username",hash:{},data:i}):r))+" \n"},5:function(e,t,n,i){return' \n'},7:function(e,t,n,i){return' \n password: \n \n
\n'},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,i){var r,a,o="function",s=t.helperMissing,l=this.escapeExpression,u="\n
Basic authentication";return r=t["if"].call(e,null!=e?e.isLogout:e,{name:"if",hash:{},fn:this.program(1,i),inverse:this.noop,data:i}),null!=r&&(u+=r),u+=' \n
\n
\n"},useData:!0}),this.Handlebars.templates.content_type=Handlebars.template({1:function(e,t,n,i){var r,a="";return r=t.each.call(e,null!=e?e.produces:e,{name:"each",hash:{},fn:this.program(2,i),inverse:this.noop,data:i}),null!=r&&(a+=r),a},2:function(e,t,n,i){var r=this.lambda,a=this.escapeExpression;return' '+a(r(e,e))+" \n"},4:function(e,t,n,i){return' application/json \n'},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,i){var r,a,o="function",s=t.helperMissing,l=this.escapeExpression,u='Response Content Type \n\n';return r=t["if"].call(e,null!=e?e.produces:e,{name:"if",hash:{},fn:this.program(1,i),inverse:this.program(4,i),data:i}),null!=r&&(u+=r),u+" \n"},useData:!0}),$(function(){$.fn.vAlign=function(){return this.each(function(){var e=$(this).height(),t=$(this).parent().height(),n=(t-e)/2;$(this).css("margin-top",n)})},$.fn.stretchFormtasticInputWidthToParent=function(){return this.each(function(){var e=$(this).closest("form").innerWidth(),t=parseInt($(this).closest("form").css("padding-left"),10)+parseInt($(this).closest("form").css("padding-right"),10),n=parseInt($(this).css("padding-left"),10)+parseInt($(this).css("padding-right"),10);$(this).css("width",e-t-n)})},$("form.formtastic li.string input, form.formtastic textarea").stretchFormtasticInputWidthToParent(),$("ul.downplayed li div.content p").vAlign(),$("form.sandbox").submit(function(){var e=!0;return $(this).find("input.required").each(function(){$(this).removeClass("error"),""===$(this).val()&&($(this).addClass("error"),$(this).wiggle(),e=!1)}),e})}),Function.prototype.bind&&console&&"object"==typeof console.log&&["log","info","warn","error","assert","dir","clear","profile","profileEnd"].forEach(function(e){console[e]=this.bind(console[e],console)},Function.prototype.call),window.Docs={shebang:function(){var e=$.param.fragment().split("/");switch(e.shift(),e.length){case 1:if(e[0].length>0){var t="resource_"+e[0];Docs.expandEndpointListForResource(e[0]),$("#"+t).slideto({highlight:!1})}break;case 2:Docs.expandEndpointListForResource(e[0]),$("#"+t).slideto({highlight:!1});var n=e.join("_"),i=n+"_content";Docs.expandOperation($("#"+i)),$("#"+n).slideto({highlight:!1})}},toggleEndpointListForResource:function(e){var t=$("li#resource_"+Docs.escapeResourceName(e)+" ul.endpoints");t.is(":visible")?($.bbq.pushState("#/",2),Docs.collapseEndpointListForResource(e)):($.bbq.pushState("#/"+e,2),Docs.expandEndpointListForResource(e))},expandEndpointListForResource:function(e){var e=Docs.escapeResourceName(e);if(""==e)return void $(".resource ul.endpoints").slideDown();$("li#resource_"+e).addClass("active");var t=$("li#resource_"+e+" ul.endpoints");t.slideDown()},collapseEndpointListForResource:function(e){var e=Docs.escapeResourceName(e);if(""==e)return void $(".resource ul.endpoints").slideUp();$("li#resource_"+e).removeClass("active");var t=$("li#resource_"+e+" ul.endpoints");t.slideUp()},expandOperationsForResource:function(e){return Docs.expandEndpointListForResource(e),""==e?void $(".resource ul.endpoints li.operation div.content").slideDown():void $("li#resource_"+Docs.escapeResourceName(e)+" li.operation div.content").each(function(){Docs.expandOperation($(this))})},collapseOperationsForResource:function(e){return Docs.expandEndpointListForResource(e),""==e?void $(".resource ul.endpoints li.operation div.content").slideUp():void $("li#resource_"+Docs.escapeResourceName(e)+" li.operation div.content").each(function(){Docs.collapseOperation($(this))})},escapeResourceName:function(e){return e.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g,"\\$&")},expandOperation:function(e){e.slideDown()},collapseOperation:function(e){e.slideUp()}},Handlebars.registerHelper("sanitize",function(e){return e=e.replace(/