\n\n
\n
\n ";
if (stack1 = helpers.signature) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.signature; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n
\n\n
\n
";
if (stack1 = helpers.sampleJSON) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.sampleJSON; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1)
+ "
\n
\n
\n
\n\n";
return buffer;
});
})();
(function() {
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
templates['status_code'] = template(function (Handlebars,depth0,helpers,partials,data) {
this.compilerInfo = [4,'>= 1.0.0'];
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
buffer += "
";
if (stack1 = helpers.code) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.code; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1)
+ " \n
";
if (stack1 = helpers.message) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.message; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += " \n
";
return buffer;
});
})();
// Generated by CoffeeScript 1.6.3
(function() {
var ApiKeyButton, BasicAuthButton, ContentTypeView, HeaderView, MainView, OperationView, ParameterContentTypeView, ParameterView, ResourceView, ResponseContentTypeView, SignatureView, StatusCodeView, SwaggerUi, _ref, _ref1, _ref10, _ref11, _ref12, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9,
__hasProp = {}.hasOwnProperty,
__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; };
SwaggerUi = (function(_super) {
__extends(SwaggerUi, _super);
function SwaggerUi() {
_ref = SwaggerUi.__super__.constructor.apply(this, arguments);
return _ref;
}
SwaggerUi.prototype.dom_id = "swagger_ui";
SwaggerUi.prototype.options = null;
SwaggerUi.prototype.api = null;
SwaggerUi.prototype.headerView = null;
SwaggerUi.prototype.mainView = null;
SwaggerUi.prototype.initialize = function(options) {
var _this = this;
if (options == null) {
options = {};
}
if (options.dom_id != null) {
this.dom_id = options.dom_id;
delete options.dom_id;
}
if ($('#' + this.dom_id) == null) {
$('body').append('
');
}
this.options = options;
this.options.success = function() {
return _this.render();
};
this.options.progress = function(d) {
return _this.showMessage(d);
};
this.options.failure = function(d) {
if (_this.api && _this.api.isValid === false) {
log("not a valid 2.0 spec, loading legacy client");
_this.api = new SwaggerApi(_this.options);
return _this.api.build();
} else {
return _this.onLoadFailure(d);
}
};
this.headerView = new HeaderView({
el: $('#header')
});
return this.headerView.on('update-swagger-ui', function(data) {
return _this.updateSwaggerUi(data);
});
};
SwaggerUi.prototype.setOption = function(option, value) {
return this.options[option] = value;
};
SwaggerUi.prototype.getOption = function(option) {
return this.options[option];
};
SwaggerUi.prototype.updateSwaggerUi = function(data) {
this.options.url = data.url;
return this.load();
};
SwaggerUi.prototype.load = function() {
var url, _ref1;
if ((_ref1 = this.mainView) != null) {
_ref1.clear();
}
url = this.options.url;
if (url.indexOf("http") !== 0) {
url = this.buildUrl(window.location.href.toString(), url);
}
this.options.url = url;
this.headerView.update(url);
this.api = new SwaggerClient(this.options);
return this.api.build();
};
SwaggerUi.prototype.collapseAll = function() {
return Docs.collapseEndpointListForResource('');
};
SwaggerUi.prototype.listAll = function() {
return Docs.collapseOperationsForResource('');
};
SwaggerUi.prototype.expandAll = function() {
return Docs.expandOperationsForResource('');
};
SwaggerUi.prototype.render = function() {
var _this = this;
this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
this.mainView = new MainView({
model: this.api,
el: $('#' + this.dom_id),
swaggerOptions: this.options
}).render();
this.showMessage();
switch (this.options.docExpansion) {
case "full":
this.expandAll();
break;
case "list":
this.listAll();
}
if (this.options.onComplete) {
this.options.onComplete(this.api, this);
}
return setTimeout(function() {
return Docs.shebang();
}, 400);
};
SwaggerUi.prototype.buildUrl = function(base, url) {
var endOfPath, parts;
log("base is " + base);
if (url.indexOf("/") === 0) {
parts = base.split("/");
base = parts[0] + "//" + parts[2];
return base + url;
} else {
endOfPath = base.length;
if (base.indexOf("?") > -1) {
endOfPath = Math.min(endOfPath, base.indexOf("?"));
}
if (base.indexOf("#") > -1) {
endOfPath = Math.min(endOfPath, base.indexOf("#"));
}
base = base.substring(0, endOfPath);
if (base.indexOf("/", base.length - 1) !== -1) {
return base + url;
}
return base + "/" + url;
}
};
SwaggerUi.prototype.showMessage = function(data) {
if (data == null) {
data = '';
}
$('#message-bar').removeClass('message-fail');
$('#message-bar').addClass('message-success');
return $('#message-bar').html(data);
};
SwaggerUi.prototype.onLoadFailure = function(data) {
var val;
if (data == null) {
data = '';
}
$('#message-bar').removeClass('message-success');
$('#message-bar').addClass('message-fail');
val = $('#message-bar').html(data);
if (this.options.onFailure != null) {
this.options.onFailure(data);
}
return val;
};
return SwaggerUi;
})(Backbone.Router);
window.SwaggerUi = SwaggerUi;
HeaderView = (function(_super) {
__extends(HeaderView, _super);
function HeaderView() {
_ref1 = HeaderView.__super__.constructor.apply(this, arguments);
return _ref1;
}
HeaderView.prototype.events = {
'click #show-pet-store-icon': 'showPetStore',
'click #show-wordnik-dev-icon': 'showWordnikDev',
'click #explore': 'showCustom',
'keyup #input_baseUrl': 'showCustomOnKeyup',
'keyup #input_apiKey': 'showCustomOnKeyup'
};
HeaderView.prototype.initialize = function() {};
HeaderView.prototype.showPetStore = function(e) {
return this.trigger('update-swagger-ui', {
url: "http://petstore.swagger.wordnik.com/api/api-docs"
});
};
HeaderView.prototype.showWordnikDev = function(e) {
return this.trigger('update-swagger-ui', {
url: "http://api.wordnik.com/v4/resources.json"
});
};
HeaderView.prototype.showCustomOnKeyup = function(e) {
if (e.keyCode === 13) {
return this.showCustom();
}
};
HeaderView.prototype.showCustom = function(e) {
if (e != null) {
e.preventDefault();
}
return this.trigger('update-swagger-ui', {
url: $('#input_baseUrl').val(),
apiKey: $('#input_apiKey').val()
});
};
HeaderView.prototype.update = function(url, apiKey, trigger) {
if (trigger == null) {
trigger = false;
}
$('#input_baseUrl').val(url);
if (trigger) {
return this.trigger('update-swagger-ui', {
url: url
});
}
};
return HeaderView;
})(Backbone.View);
MainView = (function(_super) {
var sorters;
__extends(MainView, _super);
function MainView() {
_ref2 = MainView.__super__.constructor.apply(this, arguments);
return _ref2;
}
sorters = {
'alpha': function(a, b) {
return a.path.localeCompare(b.path);
},
'method': function(a, b) {
return a.method.localeCompare(b.method);
}
};
MainView.prototype.initialize = function(opts) {
var auth, key, name, url, value, _ref3;
if (opts == null) {
opts = {};
}
this.model.auths = [];
_ref3 = this.model.securityDefinitions;
for (key in _ref3) {
value = _ref3[key];
auth = {
name: key,
type: value.type,
value: value
};
this.model.auths.push(auth);
}
if (this.model.info && this.model.info.license && typeof this.model.info.license === 'string') {
name = this.model.info.license;
url = this.model.info.licenseUrl;
this.model.info.license = {};
this.model.info.license.name = name;
this.model.info.license.url = url;
}
if (!this.model.info) {
this.model.info = {};
}
if (!this.model.info.version) {
this.model.info.version = this.model.apiVersion;
}
if (this.model.swaggerVersion === "2.0") {
if ("validatorUrl" in opts.swaggerOptions) {
return this.model.validatorUrl = opts.swaggerOptions.validatorUrl;
} else if (this.model.url.indexOf("localhost") > 0) {
return this.model.validatorUrl = null;
} else {
return this.model.validatorUrl = "http://online.swagger.io/validator";
}
}
};
MainView.prototype.render = function() {
var auth, button, counter, id, name, resource, resources, _i, _len, _ref3;
if (this.model.securityDefinitions) {
for (name in this.model.securityDefinitions) {
auth = this.model.securityDefinitions[name];
if (auth.type === "apiKey" && $("#apikey_button").length === 0) {
button = new ApiKeyButton({
model: auth
}).render().el;
$('.auth_main_container').append(button);
}
if (auth.type === "basicAuth" && $("#basic_auth_button").length === 0) {
button = new BasicAuthButton({
model: auth
}).render().el;
$('.auth_main_container').append(button);
}
}
}
$(this.el).html(Handlebars.templates.main(this.model));
resources = {};
counter = 0;
_ref3 = this.model.apisArray;
for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
resource = _ref3[_i];
id = resource.name;
while (typeof resources[id] !== 'undefined') {
id = id + "_" + counter;
counter += 1;
}
resource.id = id;
resources[id] = resource;
this.addResource(resource, this.model.auths);
}
return this;
};
MainView.prototype.addResource = function(resource, auths) {
var resourceView;
resource.id = resource.id.replace(/\s/g, '_');
resourceView = new ResourceView({
model: resource,
tagName: 'li',
id: 'resource_' + resource.id,
className: 'resource',
auths: auths,
swaggerOptions: this.options.swaggerOptions
});
return $('#resources').append(resourceView.render().el);
};
MainView.prototype.clear = function() {
return $(this.el).html('');
};
return MainView;
})(Backbone.View);
ResourceView = (function(_super) {
__extends(ResourceView, _super);
function ResourceView() {
_ref3 = ResourceView.__super__.constructor.apply(this, arguments);
return _ref3;
}
ResourceView.prototype.initialize = function(opts) {
if (opts == null) {
opts = {};
}
this.auths = opts.auths;
if ("" === this.model.description) {
return this.model.description = null;
}
};
ResourceView.prototype.render = function() {
var counter, id, methods, operation, _i, _len, _ref4;
$(this.el).html(Handlebars.templates.resource(this.model));
methods = {};
if (this.model.description) {
this.model.summary = this.model.description;
}
_ref4 = this.model.operationsArray;
for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
operation = _ref4[_i];
counter = 0;
id = operation.nickname;
while (typeof methods[id] !== 'undefined') {
id = id + "_" + counter;
counter += 1;
}
methods[id] = operation;
operation.nickname = id;
operation.parentId = this.model.id;
this.addOperation(operation);
}
$('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'));
$('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource'));
$('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource'));
return this;
};
ResourceView.prototype.addOperation = function(operation) {
var operationView;
operation.number = this.number;
operationView = new OperationView({
model: operation,
tagName: 'li',
className: 'endpoint',
swaggerOptions: this.options.swaggerOptions,
auths: this.auths
});
$('.endpoints', $(this.el)).append(operationView.render().el);
return this.number++;
};
ResourceView.prototype.callDocs = function(fnName, e) {
e.preventDefault();
return Docs[fnName](e.currentTarget.getAttribute('data-id'));
};
return ResourceView;
})(Backbone.View);
OperationView = (function(_super) {
__extends(OperationView, _super);
function OperationView() {
_ref4 = OperationView.__super__.constructor.apply(this, arguments);
return _ref4;
}
OperationView.prototype.invocationUrl = null;
OperationView.prototype.events = {
'submit .sandbox': 'submitOperation',
'click .submit': 'submitOperation',
'click .response_hider': 'hideResponse',
'click .toggleOperation': 'toggleOperationContent',
'mouseenter .api-ic': 'mouseEnter',
'mouseout .api-ic': 'mouseExit'
};
OperationView.prototype.initialize = function(opts) {
if (opts == null) {
opts = {};
}
this.auths = opts.auths;
return this;
};
OperationView.prototype.mouseEnter = function(e) {
var elem, hgh, pos, scMaxX, scMaxY, scX, scY, wd, x, y;
elem = $(e.currentTarget.parentNode).find('#api_information_panel');
x = e.pageX;
y = e.pageY;
scX = $(window).scrollLeft();
scY = $(window).scrollTop();
scMaxX = scX + $(window).width();
scMaxY = scY + $(window).height();
wd = elem.width();
hgh = elem.height();
if (x + wd > scMaxX) {
x = scMaxX - wd;
}
if (x < scX) {
x = scX;
}
if (y + hgh > scMaxY) {
y = scMaxY - hgh;
}
if (y < scY) {
y = scY;
}
pos = {};
pos.top = y;
pos.left = x;
elem.css(pos);
return $(e.currentTarget.parentNode).find('#api_information_panel').show();
};
OperationView.prototype.mouseExit = function(e) {
return $(e.currentTarget.parentNode).find('#api_information_panel').hide();
};
OperationView.prototype.render = function() {
var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, o, param, ref, responseContentTypeView, responseSignatureView, schema, schemaObj, signatureModel, statusCode, type, v, value, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref10, _ref11, _ref5, _ref6, _ref7, _ref8, _ref9;
isMethodSubmissionSupported = true;
if (!isMethodSubmissionSupported) {
this.model.isReadOnly = true;
}
this.model.description = this.model.description || this.model.notes;
if (this.model.description) {
this.model.description = this.model.description.replace(/(?:\r\n|\r|\n)/g, '
');
}
this.model.oauth = null;
if (this.model.authorizations) {
if (Array.isArray(this.model.authorizations)) {
_ref5 = this.model.authorizations;
for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
auths = _ref5[_i];
for (key in auths) {
auth = auths[key];
for (a in this.auths) {
auth = this.auths[a];
if (auth.type === 'oauth2') {
this.model.oauth = {};
this.model.oauth.scopes = [];
_ref6 = auth.value.scopes;
for (k in _ref6) {
v = _ref6[k];
o = {
scope: k,
description: v
};
this.model.oauth.scopes.push(o);
}
}
}
}
}
} else {
_ref7 = this.model.authorizations;
for (k in _ref7) {
v = _ref7[k];
if (k === "oauth2") {
if (this.model.oauth === null) {
this.model.oauth = {};
}
if (this.model.oauth.scopes === void 0) {
this.model.oauth.scopes = [];
}
for (_j = 0, _len1 = v.length; _j < _len1; _j++) {
o = v[_j];
this.model.oauth.scopes.push(o);
}
}
}
}
}
if (typeof this.model.responses !== 'undefined') {
this.model.responseMessages = [];
_ref8 = this.model.responses;
for (code in _ref8) {
value = _ref8[code];
schema = null;
schemaObj = this.model.responses[code].schema;
if (schemaObj && schemaObj['$ref']) {
schema = schemaObj['$ref'];
if (schema.indexOf('#/definitions/') === 0) {
schema = schema.substring('#/definitions/'.length);
}
}
this.model.responseMessages.push({
code: code,
message: value.description,
responseModel: schema
});
}
}
if (typeof this.model.responseMessages === 'undefined') {
this.model.responseMessages = [];
}
$(this.el).html(Handlebars.templates.operation(this.model));
if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
signatureModel = {
sampleJSON: this.model.responseSampleJSON,
isParam: false,
signature: this.model.responseClassSignature
};
responseSignatureView = new SignatureView({
model: signatureModel,
tagName: 'div'
});
$('.model-signature', $(this.el)).append(responseSignatureView.render().el);
} else {
this.model.responseClassSignature = 'string';
$('.model-signature', $(this.el)).html(this.model.type);
}
contentTypeModel = {
isParam: false
};
contentTypeModel.consumes = this.model.consumes;
contentTypeModel.produces = this.model.produces;
_ref9 = this.model.parameters;
for (_k = 0, _len2 = _ref9.length; _k < _len2; _k++) {
param = _ref9[_k];
type = param.type || param.dataType;
if (typeof type === 'undefined') {
schema = param.schema;
if (schema && schema['$ref']) {
ref = schema['$ref'];
if (ref.indexOf('#/definitions/') === 0) {
type = ref.substring('#/definitions/'.length);
} else {
type = ref;
}
}
}
if (type && type.toLowerCase() === 'file') {
if (!contentTypeModel.consumes) {
contentTypeModel.consumes = 'multipart/form-data';
}
}
param.type = type;
}
responseContentTypeView = new ResponseContentTypeView({
model: contentTypeModel
});
$('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
_ref10 = this.model.parameters;
for (_l = 0, _len3 = _ref10.length; _l < _len3; _l++) {
param = _ref10[_l];
this.addParameter(param, contentTypeModel.consumes);
}
_ref11 = this.model.responseMessages;
for (_m = 0, _len4 = _ref11.length; _m < _len4; _m++) {
statusCode = _ref11[_m];
this.addStatusCode(statusCode);
}
return this;
};
OperationView.prototype.addParameter = function(param, consumes) {
var paramView;
param.consumes = consumes;
paramView = new ParameterView({
model: param,
tagName: 'tr',
readOnly: this.model.isReadOnly
});
return $('.operation-params', $(this.el)).append(paramView.render().el);
};
OperationView.prototype.addStatusCode = function(statusCode) {
var statusCodeView;
statusCodeView = new StatusCodeView({
model: statusCode,
tagName: 'tr'
});
return $('.operation-status', $(this.el)).append(statusCodeView.render().el);
};
OperationView.prototype.submitOperation = function(e) {
var error_free, form, isFileUpload, map, o, opts, val, _i, _j, _k, _len, _len1, _len2, _ref5, _ref6, _ref7;
if (e != null) {
e.preventDefault();
}
form = $('.sandbox', $(this.el));
error_free = true;
form.find("input.required").each(function() {
var _this = this;
$(this).removeClass("error");
if (jQuery.trim($(this).val()) === "") {
$(this).addClass("error");
$(this).wiggle({
callback: function() {
return $(_this).focus();
}
});
return error_free = false;
}
});
form.find("textarea.required").each(function() {
var _this = this;
$(this).removeClass("error");
if (jQuery.trim($(this).val()) === "") {
$(this).addClass("error");
$(this).wiggle({
callback: function() {
return $(_this).focus();
}
});
return error_free = false;
}
});
if (error_free) {
map = {};
opts = {
parent: this
};
isFileUpload = false;
_ref5 = form.find("input");
for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
o = _ref5[_i];
if ((o.value != null) && jQuery.trim(o.value).length > 0) {
map[o.name] = o.value;
}
if (o.type === "file") {
isFileUpload = true;
}
}
_ref6 = form.find("textarea");
for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
o = _ref6[_j];
if ((o.value != null) && jQuery.trim(o.value).length > 0) {
map[o.name] = o.value;
}
}
_ref7 = form.find("select");
for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
o = _ref7[_k];
val = this.getSelectedValue(o);
if ((val != null) && jQuery.trim(val).length > 0) {
map[o.name] = val;
}
}
opts.responseContentType = $("div select[name=responseContentType]", $(this.el)).val();
opts.requestContentType = $("div select[name=parameterContentType]", $(this.el)).val();
$(".response_throbber", $(this.el)).show();
if (isFileUpload) {
return this.handleFileUpload(map, form);
} else {
return this.model["do"](map, opts, this.showCompleteStatus, this.showErrorStatus, this);
}
}
};
OperationView.prototype.success = function(response, parent) {
return parent.showCompleteStatus(response);
};
OperationView.prototype.handleFileUpload = function(map, form) {
var bodyParam, el, headerParams, o, obj, param, params, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref5, _ref6, _ref7, _ref8,
_this = this;
_ref5 = form.serializeArray();
for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
o = _ref5[_i];
if ((o.value != null) && jQuery.trim(o.value).length > 0) {
map[o.name] = o.value;
}
}
bodyParam = new FormData();
params = 0;
_ref6 = this.model.parameters;
for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
param = _ref6[_j];
if (param.paramType === 'form') {
if (param.type.toLowerCase() !== 'file' && map[param.name] !== void 0) {
bodyParam.append(param.name, map[param.name]);
}
}
}
headerParams = {};
_ref7 = this.model.parameters;
for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
param = _ref7[_k];
if (param.paramType === 'header') {
headerParams[param.name] = map[param.name];
}
}
_ref8 = form.find('input[type~="file"]');
for (_l = 0, _len3 = _ref8.length; _l < _len3; _l++) {
el = _ref8[_l];
if (typeof el.files[0] !== 'undefined') {
bodyParam.append($(el).attr('name'), el.files[0]);
params += 1;
}
}
this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), this.model.urlify(map, false)) : this.model.urlify(map, true);
$(".request_url", $(this.el)).html("
");
$(".request_url pre", $(this.el)).text(this.invocationUrl);
obj = {
type: this.model.method,
url: this.invocationUrl,
headers: headerParams,
data: bodyParam,
dataType: 'json',
contentType: false,
processData: false,
error: function(data, textStatus, error) {
return _this.showErrorStatus(_this.wrap(data), _this);
},
success: function(data) {
return _this.showResponse(data, _this);
},
complete: function(data) {
return _this.showCompleteStatus(_this.wrap(data), _this);
}
};
if (window.authorizations) {
window.authorizations.apply(obj);
}
if (params === 0) {
obj.data.append("fake", "true");
}
jQuery.ajax(obj);
return false;
};
OperationView.prototype.wrap = function(data) {
var h, headerArray, headers, i, o, _i, _len;
headers = {};
headerArray = data.getAllResponseHeaders().split("\r");
for (_i = 0, _len = headerArray.length; _i < _len; _i++) {
i = headerArray[_i];
h = i.split(':');
if (h[0] !== void 0 && h[1] !== void 0) {
headers[h[0].trim()] = h[1].trim();
}
}
o = {};
o.content = {};
o.content.data = data.responseText;
o.headers = headers;
o.request = {};
o.request.url = this.invocationUrl;
o.status = data.status;
return o;
};
OperationView.prototype.getSelectedValue = function(select) {
var opt, options, _i, _len, _ref5;
if (!select.multiple) {
return select.value;
} else {
options = [];
_ref5 = select.options;
for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
opt = _ref5[_i];
if (opt.selected) {
options.push(opt.value);
}
}
if (options.length > 0) {
return options;
} else {
return null;
}
}
};
OperationView.prototype.hideResponse = function(e) {
if (e != null) {
e.preventDefault();
}
$(".response", $(this.el)).slideUp();
return $(".response_hider", $(this.el)).fadeOut();
};
OperationView.prototype.showResponse = function(response) {
var prettyJson;
prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "
");
return $(".response_body", $(this.el)).html(escape(prettyJson));
};
OperationView.prototype.showErrorStatus = function(data, parent) {
return parent.showStatus(data);
};
OperationView.prototype.showCompleteStatus = function(data, parent) {
return parent.showStatus(data);
};
OperationView.prototype.formatXml = function(xml) {
var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
reg = /(>)(<)(\/*)/g;
wsexp = /[ ]*(.*)[ ]+\n/g;
contexp = /(<.+>)(.+\n)/g;
xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
pad = 0;
formatted = '';
lines = xml.split('\n');
indent = 0;
lastType = 'other';
transitions = {
'single->single': 0,
'single->closing': -1,
'single->opening': 0,
'single->other': 0,
'closing->single': 0,
'closing->closing': -1,
'closing->opening': 0,
'closing->other': 0,
'opening->single': 1,
'opening->closing': 0,
'opening->opening': 1,
'opening->other': 1,
'other->single': 0,
'other->closing': -1,
'other->opening': 0,
'other->other': 0
};
_fn = function(ln) {
var fromTo, j, key, padding, type, types, value;
types = {
single: Boolean(ln.match(/<.+\/>/)),
closing: Boolean(ln.match(/<\/.+>/)),
opening: Boolean(ln.match(/<[^!?].*>/))
};
type = ((function() {
var _results;
_results = [];
for (key in types) {
value = types[key];
if (value) {
_results.push(key);
}
}
return _results;
})())[0];
type = type === void 0 ? 'other' : type;
fromTo = lastType + '->' + type;
lastType = type;
padding = '';
indent += transitions[fromTo];
padding = ((function() {
var _j, _ref5, _results;
_results = [];
for (j = _j = 0, _ref5 = indent; 0 <= _ref5 ? _j < _ref5 : _j > _ref5; j = 0 <= _ref5 ? ++_j : --_j) {
_results.push(' ');
}
return _results;
})()).join('');
if (fromTo === 'opening->closing') {
return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
} else {
return formatted += padding + ln + '\n';
}
};
for (_i = 0, _len = lines.length; _i < _len; _i++) {
ln = lines[_i];
_fn(ln);
}
return formatted;
};
OperationView.prototype.showStatus = function(response) {
var code, content, contentType, e, headers, json, opts, pre, response_body, response_body_el, url;
if (response.content === void 0) {
content = response.data;
url = response.url;
} else {
content = response.content.data;
url = response.request.url;
}
headers = response.headers;
contentType = null;
if (headers) {
contentType = headers["Content-Type"] || headers["content-type"];
if (contentType) {
contentType = contentType.split(";")[0].trim();
}
}
if (!content) {
code = $('
').text("no content");
pre = $('
').append(code);
} else if (contentType === "application/json" || /\+json$/.test(contentType)) {
json = null;
try {
json = JSON.stringify(JSON.parse(content), null, " ");
} catch (_error) {
e = _error;
json = "can't parse JSON. Raw result:\n\n" + content;
}
code = $('
').text(json);
pre = $('
').append(code);
} else if (contentType === "application/xml" || /\+xml$/.test(contentType)) {
code = $('
').text(this.formatXml(content));
pre = $('
').append(code);
} else if (contentType === "text/html") {
code = $('
').html(_.escape(content));
pre = $('
').append(code);
} else if (/^image\//.test(contentType)) {
pre = $('
').attr('src', url);
} else {
code = $('
').text(content);
pre = $('
').append(code);
}
response_body = pre;
$(".request_url", $(this.el)).html("
");
$(".request_url pre", $(this.el)).text(url);
$(".response_code", $(this.el)).html("
" + response.status + " ");
$(".response_body", $(this.el)).html(response_body);
$(".response_headers", $(this.el)).html("
" + _.escape(JSON.stringify(response.headers, null, " ")).replace(/\n/g, " ") + " ");
$(".response", $(this.el)).slideDown();
$(".response_hider", $(this.el)).show();
$(".response_throbber", $(this.el)).hide();
response_body_el = $('.response_body', $(this.el))[0];
opts = this.options.swaggerOptions;
if (opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold) {
return response_body_el;
} else {
return hljs.highlightBlock(response_body_el);
}
};
OperationView.prototype.toggleOperationContent = function() {
var elem;
elem = $('#' + Docs.escapeResourceName(this.model.parentId + "_" + this.model.nickname + "_content"));
if (elem.is(':visible')) {
return Docs.collapseOperation(elem);
} else {
return Docs.expandOperation(elem);
}
};
return OperationView;
})(Backbone.View);
StatusCodeView = (function(_super) {
__extends(StatusCodeView, _super);
function StatusCodeView() {
_ref5 = StatusCodeView.__super__.constructor.apply(this, arguments);
return _ref5;
}
StatusCodeView.prototype.initialize = function() {};
StatusCodeView.prototype.render = function() {
var responseModel, responseModelView, template;
template = this.template();
$(this.el).html(template(this.model));
if (swaggerUi.api.models.hasOwnProperty(this.model.responseModel)) {
responseModel = {
sampleJSON: JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(), null, 2),
isParam: false,
signature: swaggerUi.api.models[this.model.responseModel].getMockSignature()
};
responseModelView = new SignatureView({
model: responseModel,
tagName: 'div'
});
$('.model-signature', this.$el).append(responseModelView.render().el);
} else {
$('.model-signature', this.$el).html('');
}
return this;
};
StatusCodeView.prototype.template = function() {
return Handlebars.templates.status_code;
};
return StatusCodeView;
})(Backbone.View);
ParameterView = (function(_super) {
__extends(ParameterView, _super);
function ParameterView() {
_ref6 = ParameterView.__super__.constructor.apply(this, arguments);
return _ref6;
}
ParameterView.prototype.initialize = function() {
return Handlebars.registerHelper('isArray', function(param, opts) {
if (param.type.toLowerCase() === 'array' || param.allowMultiple) {
return opts.fn(this);
} else {
return opts.inverse(this);
}
});
};
ParameterView.prototype.render = function() {
var contentTypeModel, isParam, parameterContentTypeView, ref, responseContentTypeView, schema, signatureModel, signatureView, template, type;
type = this.model.type || this.model.dataType;
if (typeof type === 'undefined') {
schema = this.model.schema;
if (schema && schema['$ref']) {
ref = schema['$ref'];
if (ref.indexOf('#/definitions/') === 0) {
type = ref.substring('#/definitions/'.length);
} else {
type = ref;
}
}
}
this.model.type = type;
this.model.paramType = this.model["in"] || this.model.paramType;
if (this.model.paramType === 'body') {
this.model.isBody = true;
}
if (type && type.toLowerCase() === 'file') {
this.model.isFile = true;
}
this.model["default"] = this.model["default"] || this.model.defaultValue;
if (this.model.allowableValues) {
this.model.isList = true;
}
template = this.template();
$(this.el).html(template(this.model));
signatureModel = {
sampleJSON: this.model.sampleJSON,
isParam: true,
signature: this.model.signature
};
if (this.model.sampleJSON) {
signatureView = new SignatureView({
model: signatureModel,
tagName: 'div'
});
$('.model-signature', $(this.el)).append(signatureView.render().el);
} else {
$('.model-signature', $(this.el)).html(this.model.signature);
}
isParam = false;
if (this.model.isBody) {
isParam = true;
}
contentTypeModel = {
isParam: isParam
};
contentTypeModel.consumes = this.model.consumes;
if (isParam) {
parameterContentTypeView = new ParameterContentTypeView({
model: contentTypeModel
});
$('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
} else {
responseContentTypeView = new ResponseContentTypeView({
model: contentTypeModel
});
$('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
}
return this;
};
ParameterView.prototype.template = function() {
if (this.model.isList) {
return Handlebars.templates.param_list;
} else {
if (this.options.readOnly) {
if (this.model.required) {
return Handlebars.templates.param_readonly_required;
} else {
return Handlebars.templates.param_readonly;
}
} else {
if (this.model.required) {
return Handlebars.templates.param_required;
} else {
return Handlebars.templates.param;
}
}
}
};
return ParameterView;
})(Backbone.View);
SignatureView = (function(_super) {
__extends(SignatureView, _super);
function SignatureView() {
_ref7 = SignatureView.__super__.constructor.apply(this, arguments);
return _ref7;
}
SignatureView.prototype.events = {
'click a.description-link': 'switchToDescription',
'click a.snippet-link': 'switchToSnippet',
'mousedown .snippet': 'snippetToTextArea'
};
SignatureView.prototype.initialize = function() {};
SignatureView.prototype.render = function() {
var template;
template = this.template();
$(this.el).html(template(this.model));
this.switchToSnippet();
this.isParam = this.model.isParam;
if (this.isParam) {
$('.notice', $(this.el)).text('Click to set as parameter value');
}
return this;
};
SignatureView.prototype.template = function() {
return Handlebars.templates.signature;
};
SignatureView.prototype.switchToDescription = function(e) {
if (e != null) {
e.preventDefault();
}
$(".snippet", $(this.el)).hide();
$(".description", $(this.el)).show();
$('.description-link', $(this.el)).addClass('selected');
return $('.snippet-link', $(this.el)).removeClass('selected');
};
SignatureView.prototype.switchToSnippet = function(e) {
if (e != null) {
e.preventDefault();
}
$(".description", $(this.el)).hide();
$(".snippet", $(this.el)).show();
$('.snippet-link', $(this.el)).addClass('selected');
return $('.description-link', $(this.el)).removeClass('selected');
};
SignatureView.prototype.snippetToTextArea = function(e) {
var textArea;
if (this.isParam) {
if (e != null) {
e.preventDefault();
}
textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
if ($.trim(textArea.val()) === '') {
return textArea.val(this.model.sampleJSON);
}
}
};
return SignatureView;
})(Backbone.View);
ContentTypeView = (function(_super) {
__extends(ContentTypeView, _super);
function ContentTypeView() {
_ref8 = ContentTypeView.__super__.constructor.apply(this, arguments);
return _ref8;
}
ContentTypeView.prototype.initialize = function() {};
ContentTypeView.prototype.render = function() {
var template;
template = this.template();
$(this.el).html(template(this.model));
$('label[for=contentType]', $(this.el)).text('Response Content Type');
return this;
};
ContentTypeView.prototype.template = function() {
return Handlebars.templates.content_type;
};
return ContentTypeView;
})(Backbone.View);
ResponseContentTypeView = (function(_super) {
__extends(ResponseContentTypeView, _super);
function ResponseContentTypeView() {
_ref9 = ResponseContentTypeView.__super__.constructor.apply(this, arguments);
return _ref9;
}
ResponseContentTypeView.prototype.initialize = function() {};
ResponseContentTypeView.prototype.render = function() {
var template;
template = this.template();
$(this.el).html(template(this.model));
$('label[for=responseContentType]', $(this.el)).text('Response Content Type');
return this;
};
ResponseContentTypeView.prototype.template = function() {
return Handlebars.templates.response_content_type;
};
return ResponseContentTypeView;
})(Backbone.View);
ParameterContentTypeView = (function(_super) {
__extends(ParameterContentTypeView, _super);
function ParameterContentTypeView() {
_ref10 = ParameterContentTypeView.__super__.constructor.apply(this, arguments);
return _ref10;
}
ParameterContentTypeView.prototype.initialize = function() {};
ParameterContentTypeView.prototype.render = function() {
var template;
template = this.template();
$(this.el).html(template(this.model));
$('label[for=parameterContentType]', $(this.el)).text('Parameter content type:');
return this;
};
ParameterContentTypeView.prototype.template = function() {
return Handlebars.templates.parameter_content_type;
};
return ParameterContentTypeView;
})(Backbone.View);
ApiKeyButton = (function(_super) {
__extends(ApiKeyButton, _super);
function ApiKeyButton() {
_ref11 = ApiKeyButton.__super__.constructor.apply(this, arguments);
return _ref11;
}
ApiKeyButton.prototype.initialize = function() {};
ApiKeyButton.prototype.render = function() {
var template;
template = this.template();
$(this.el).html(template(this.model));
return this;
};
ApiKeyButton.prototype.events = {
"click #apikey_button": "toggleApiKeyContainer",
"click #apply_api_key": "applyApiKey"
};
ApiKeyButton.prototype.applyApiKey = function() {
var elem;
window.authorizations.add(this.model.name, new ApiKeyAuthorization(this.model.name, $("#input_apiKey_entry").val(), this.model["in"]));
window.swaggerUi.load();
return elem = $('#apikey_container').show();
};
ApiKeyButton.prototype.toggleApiKeyContainer = function() {
var elem;
if ($('#apikey_container').length > 0) {
elem = $('#apikey_container').first();
if (elem.is(':visible')) {
return elem.hide();
} else {
$('.auth_container').hide();
return elem.show();
}
}
};
ApiKeyButton.prototype.template = function() {
return Handlebars.templates.apikey_button_view;
};
return ApiKeyButton;
})(Backbone.View);
BasicAuthButton = (function(_super) {
__extends(BasicAuthButton, _super);
function BasicAuthButton() {
_ref12 = BasicAuthButton.__super__.constructor.apply(this, arguments);
return _ref12;
}
BasicAuthButton.prototype.initialize = function() {};
BasicAuthButton.prototype.render = function() {
var template;
template = this.template();
$(this.el).html(template(this.model));
return this;
};
BasicAuthButton.prototype.events = {
"click #basic_auth_button": "togglePasswordContainer",
"click #apply_basic_auth": "applyPassword"
};
BasicAuthButton.prototype.applyPassword = function() {
var elem, password, username;
console.log("applying password");
username = $(".input_username").val();
password = $(".input_password").val();
window.authorizations.add(this.model.type, new PasswordAuthorization("basic", username, password));
window.swaggerUi.load();
return elem = $('#basic_auth_container').hide();
};
BasicAuthButton.prototype.togglePasswordContainer = function() {
var elem;
if ($('#basic_auth_container').length > 0) {
elem = $('#basic_auth_container').show();
if (elem.is(':visible')) {
return elem.slideUp();
} else {
$('.auth_container').hide();
return elem.show();
}
}
};
BasicAuthButton.prototype.template = function() {
return Handlebars.templates.basic_auth_button_view;
};
return BasicAuthButton;
})(Backbone.View);
}).call(this);
`)
func www_swagger_ui_swagger_ui_js_bytes() ([]byte, error) {
return _www_swagger_ui_swagger_ui_js, nil
}
func www_swagger_ui_swagger_ui_js() (*asset, error) {
bytes, err := www_swagger_ui_swagger_ui_js_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "www/swagger-ui/swagger-ui.js", size: 105377, mode: os.FileMode(416), modTime: time.Unix(1419029016, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _www_swagger_ui_swagger_ui_min_js = []byte(`$(function(){$.fn.vAlign=function(){return this.each(function(c){var a=$(this).height();var d=$(this).parent().height();var b=(d-a)/2;$(this).css("margin-top",b)})};$.fn.stretchFormtasticInputWidthToParent=function(){return this.each(function(b){var d=$(this).closest("form").innerWidth();var c=parseInt($(this).closest("form").css("padding-left"),10)+parseInt($(this).closest("form").css("padding-right"),10);var a=parseInt($(this).css("padding-left"),10)+parseInt($(this).css("padding-right"),10);$(this).css("width",d-c-a)})};$("form.formtastic li.string input, form.formtastic textarea").stretchFormtasticInputWidthToParent();$("ul.downplayed li div.content p").vAlign();$("form.sandbox").submit(function(){var a=true;$(this).find("input.required").each(function(){$(this).removeClass("error");if($(this).val()==""){$(this).addClass("error");$(this).wiggle();a=false}});return a})});function clippyCopiedCallback(b){$("#api_key_copied").fadeIn().delay(1000).fadeOut()}log=function(){log.history=log.history||[];log.history.push(arguments);if(this.console){console.log(Array.prototype.slice.call(arguments)[0])}};if(Function.prototype.bind&&console&&typeof console.log=="object"){["log","info","warn","error","assert","dir","clear","profile","profileEnd"].forEach(function(a){console[a]=this.bind(console[a],console)},Function.prototype.call)}var Docs={shebang:function(){var b=$.param.fragment().split("/");b.shift();switch(b.length){case 1:var d="resource_"+b[0];Docs.expandEndpointListForResource(b[0]);$("#"+d).slideto({highlight:false});break;case 2:Docs.expandEndpointListForResource(b[0]);$("#"+d).slideto({highlight:false});var c=b.join("_");var a=c+"_content";Docs.expandOperation($("#"+a));$("#"+c).slideto({highlight:false});break}},toggleEndpointListForResource:function(b){var a=$("li#resource_"+Docs.escapeResourceName(b)+" ul.endpoints");if(a.is(":visible")){Docs.collapseEndpointListForResource(b)}else{Docs.expandEndpointListForResource(b)}},expandEndpointListForResource:function(b){var b=Docs.escapeResourceName(b);if(b==""){$(".resource ul.endpoints").slideDown();return}$("li#resource_"+b).addClass("active");var a=$("li#resource_"+b+" ul.endpoints");a.slideDown()},collapseEndpointListForResource:function(b){var b=Docs.escapeResourceName(b);$("li#resource_"+b).removeClass("active");var a=$("li#resource_"+b+" ul.endpoints");a.slideUp()},expandOperationsForResource:function(a){Docs.expandEndpointListForResource(a);if(a==""){$(".resource ul.endpoints li.operation div.content").slideDown();return}$("li#resource_"+Docs.escapeResourceName(a)+" li.operation div.content").each(function(){Docs.expandOperation($(this))})},collapseOperationsForResource:function(a){Docs.expandEndpointListForResource(a);$("li#resource_"+Docs.escapeResourceName(a)+" li.operation div.content").each(function(){Docs.collapseOperation($(this))})},escapeResourceName:function(a){return a.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^` + "`" + `{|}~]/g,"\\$&")},expandOperation:function(a){a.slideDown()},collapseOperation:function(a){a.slideUp()}};(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.apikey_button_view=b(function(e,k,d,j,i){this.compilerInfo=[4,">= 1.0.0"];d=this.merge(d,e.helpers);i=i||{};var g="",c,f="function",h=this.escapeExpression;g+="
\n
\n\n';return g})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.basic_auth_button_view=b(function(f,g,d,c,e){this.compilerInfo=[4,">= 1.0.0"];d=this.merge(d,f.helpers);e=e||{};return'
\n
\n\n'})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.content_type=b(function(g,l,f,k,j){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);j=j||{};var i="",c,h="function",m=this;function e(r,q){var o="",p;o+="\n ";p=f.each.call(r,r.produces,{hash:{},inverse:m.noop,fn:m.program(2,d,q),data:q});if(p||p===0){o+=p}o+="\n";return o}function d(r,q){var o="",p;o+='\n
';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+=" \n ";return o}function n(p,o){return'\n
application/json \n'}i+='
\n
\n';c=f["if"].call(l,l.produces,{hash:{},inverse:m.program(4,n,j),fn:m.program(1,e,j),data:j});if(c||c===0){i+=c}i+="\n \n";return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.main=b(function(h,n,g,m,l){this.compilerInfo=[4,">= 1.0.0"];g=this.merge(g,h.helpers);l=l||{};var j="",c,s,i="function",k=this.escapeExpression,q=this;function f(x,w){var t="",v,u;t+='\n
'+k(((v=((v=x.info),v==null||v===false?v:v.title)),typeof v===i?v.apply(x):v))+'
\n
';u=((v=((v=x.info),v==null||v===false?v:v.description)),typeof v===i?v.apply(x):v);if(u||u===0){t+=u}t+="
\n ";u=g["if"].call(x,((v=x.info),v==null||v===false?v:v.termsOfServiceUrl),{hash:{},inverse:q.noop,fn:q.program(2,d,w),data:w});if(u||u===0){t+=u}t+="\n ";u=g["if"].call(x,((v=x.info),v==null||v===false?v:v.contact),{hash:{},inverse:q.noop,fn:q.program(4,r,w),data:w});if(u||u===0){t+=u}t+="\n ";u=g["if"].call(x,((v=x.info),v==null||v===false?v:v.license),{hash:{},inverse:q.noop,fn:q.program(6,p,w),data:w});if(u||u===0){t+=u}t+="\n ";return t}function d(w,v){var t="",u;t+='
';return t}function r(w,v){var t="",u;t+="
';return t}function p(w,v){var t="",u;t+="
";return t}function o(w,v){var t="",u;t+='\n ,
api version : '+k(((u=((u=w.info),u==null||u===false?u:u.version)),typeof u===i?u.apply(w):u))+"\n ";return t}function e(w,v){var t="",u;t+='\n
\n \n ';return t}j+="
\n ";c=g["if"].call(n,n.info,{hash:{},inverse:q.noop,fn:q.program(1,f,l),data:l});if(c||c===0){j+=c}j+="\n
\n
\n";return j})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.operation=b(function(j,u,s,o,A){this.compilerInfo=[4,">= 1.0.0"];s=this.merge(s,j.helpers);A=A||{};var t="",k,f,e="function",d=this.escapeExpression,r=this,c=s.blockHelperMissing;function q(C,B){return"deprecated"}function p(C,B){return"\n
Warning: Deprecated \n "}function n(E,D){var B="",C;B+="\n
Implementation Notes \n
";if(C=s.description){C=C.call(E,{hash:{},data:D})}else{C=E.description;C=typeof C===e?C.apply(E):C}if(C||C===0){B+=C}B+="
\n ";return B}function m(C,B){return'\n
\n
'}function i(E,D){var B="",C;B+='\n
\n ';C=s.each.call(E,E,{hash:{},inverse:r.noop,fn:r.program(10,z,D),data:D});if(C||C===0){B+=C}B+="\n
\n ";return B}function z(F,E){var B="",D,C;B+="\n
"+d(((D=F.scope),typeof D===e?D.apply(F):D))+"
\n ";return B}function y(C,B){return"
"}function x(C,B){return'\n
\n \n
\n '}function w(C,B){return'\n
Response Class \n
\n
\n
\n '}function v(C,B){return'\n
Parameters \n
\n \n \n Parameter \n Value \n Description \n Parameter Type \n Data Type \n \n \n \n\n \n
\n '}function l(C,B){return"\n
\n
Response Messages \n
\n \n \n HTTP Status Code \n Reason \n Response Model \n \n \n \n \n \n
\n "}function h(C,B){return"\n "}function g(C,B){return"\n
\n "}t+="\n
\n \n \n \n ";k=s["if"].call(u,u.deprecated,{hash:{},inverse:r.noop,fn:r.program(3,p,A),data:A});if(k||k===0){t+=k}t+="\n ";k=s["if"].call(u,u.description,{hash:{},inverse:r.noop,fn:r.program(5,n,A),data:A});if(k||k===0){t+=k}t+="\n ";f={hash:{},inverse:r.noop,fn:r.program(7,m,A),data:A};if(k=s.oauth){k=k.call(u,f)}else{k=u.oauth;k=typeof k===e?k.apply(u):k}if(!s.oauth){k=c.call(u,k,f)}if(k||k===0){t+=k}t+="\n ";k=s.each.call(u,u.oauth,{hash:{},inverse:r.noop,fn:r.program(9,i,A),data:A});if(k||k===0){t+=k}t+="\n ";f={hash:{},inverse:r.noop,fn:r.program(12,y,A),data:A};if(k=s.oauth){k=k.call(u,f)}else{k=u.oauth;k=typeof k===e?k.apply(u):k}if(!s.oauth){k=c.call(u,k,f)}if(k||k===0){t+=k}t+="\n ";f={hash:{},inverse:r.noop,fn:r.program(14,x,A),data:A};if(k=s.oauth){k=k.call(u,f)}else{k=u.oauth;k=typeof k===e?k.apply(u):k}if(!s.oauth){k=c.call(u,k,f)}if(k||k===0){t+=k}t+="\n ";k=s["if"].call(u,u.type,{hash:{},inverse:r.noop,fn:r.program(16,w,A),data:A});if(k||k===0){t+=k}t+="\n
\n
\n
Request URL \n
\n
Response Body \n
\n
Response Code \n
\n
Response Headers \n \n
\n
\n \n \n";return t})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param=b(function(f,q,o,j,t){this.compilerInfo=[4,">= 1.0.0"];o=this.merge(o,f.helpers);t=t||{};var p="",g,d="function",c=this.escapeExpression,n=this;function m(y,x){var v="",w;v+="\n ";w=o["if"].call(y,y.isFile,{hash:{},inverse:n.program(4,k,x),fn:n.program(2,l,x),data:x});if(w||w===0){v+=w}v+="\n ";return v}function l(y,x){var v="",w;v+='\n
\n
\n ';return v}function k(y,x){var v="",w;v+="\n ";w=o["if"].call(y,y["default"],{hash:{},inverse:n.program(7,h,x),fn:n.program(5,i,x),data:x});if(w||w===0){v+=w}v+="\n ";return v}function i(y,x){var v="",w;v+="\n
\n ";return v}function h(y,x){var v="",w;v+="\n
\n
\n
\n ';return v}function e(y,x){var v="",w;v+="\n ";w=o["if"].call(y,y.isFile,{hash:{},inverse:n.program(10,u,x),fn:n.program(2,l,x),data:x});if(w||w===0){v+=w}v+="\n ";return v}function u(y,x){var v="",w;v+="\n ";w=o["if"].call(y,y["default"],{hash:{},inverse:n.program(13,r,x),fn:n.program(11,s,x),data:x});if(w||w===0){v+=w}v+="\n ";return v}function s(y,x){var v="",w;v+="\n
\n ";return v}function r(y,x){var v="",w;v+="\n
\n ";return v}p+="
";if(g=o.name){g=g.call(q,{hash:{},data:t})}else{g=q.name;g=typeof g===d?g.apply(q):g}p+=c(g)+" \n
\n\n ";g=o["if"].call(q,q.isBody,{hash:{},inverse:n.program(9,e,t),fn:n.program(1,m,t),data:t});if(g||g===0){p+=g}p+="\n\n \n
";if(g=o.description){g=g.call(q,{hash:{},data:t})}else{g=q.description;g=typeof g===d?g.apply(q):g}if(g||g===0){p+=g}p+=" \n
";if(g=o.paramType){g=g.call(q,{hash:{},data:t})}else{g=q.paramType;g=typeof g===d?g.apply(q):g}if(g||g===0){p+=g}p+=' \n
\n \n \n';return p})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param_list=b(function(h,t,r,m,y){this.compilerInfo=[4,">= 1.0.0"];r=this.merge(r,h.helpers);y=y||{};var s="",j,g,e,p=this,q=r.helperMissing,d="function",c=this.escapeExpression;function o(A,z){return" multiple='multiple'"}function n(A,z){return"\n "}function l(C,B){var z="",A;z+="\n ";A=r["if"].call(C,C["default"],{hash:{},inverse:p.program(8,i,B),fn:p.program(6,k,B),data:B});if(A||A===0){z+=A}z+="\n ";return z}function k(A,z){return"\n "}function i(E,D){var z="",C,B,A;z+="\n ";A={hash:{},inverse:p.program(11,x,D),fn:p.program(9,f,D),data:D};B=((C=r.isArray||E.isArray),C?C.call(E,E,A):q.call(E,"isArray",E,A));if(B||B===0){z+=B}z+="\n ";return z}function f(A,z){return"\n "}function x(A,z){return"\n
\n "}function w(C,B){var z="",A;z+="\n ";A=r["if"].call(C,C.isDefault,{hash:{},inverse:p.program(16,u,B),fn:p.program(14,v,B),data:B});if(A||A===0){z+=A}z+="\n ";return z}function v(C,B){var z="",A;z+='\n
";if(A=r.value){A=A.call(C,{hash:{},data:B})}else{A=C.value;A=typeof A===d?A.apply(C):A}z+=c(A)+" (default) \n ";return z}function u(C,B){var z="",A;z+="\n
";if(A=r.value){A=A.call(C,{hash:{},data:B})}else{A=C.value;A=typeof A===d?A.apply(C):A}z+=c(A)+" \n ";return z}s+="
";if(j=r.name){j=j.call(t,{hash:{},data:y})}else{j=t.name;j=typeof j===d?j.apply(t):j}s+=c(j)+" \n
\n \n ";g=r["if"].call(t,t.required,{hash:{},inverse:p.program(5,l,y),fn:p.program(3,n,y),data:y});if(g||g===0){s+=g}s+="\n ";g=r.each.call(t,((j=t.allowableValues),j==null||j===false?j:j.descriptiveValues),{hash:{},inverse:p.noop,fn:p.program(13,w,y),data:y});if(g||g===0){s+=g}s+="\n \n \n
";if(g=r.description){g=g.call(t,{hash:{},data:y})}else{g=t.description;g=typeof g===d?g.apply(t):g}if(g||g===0){s+=g}s+=" \n
";if(g=r.paramType){g=g.call(t,{hash:{},data:y})}else{g=t.paramType;g=typeof g===d?g.apply(t):g}if(g||g===0){s+=g}s+=' \n
';return s})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param_readonly=b(function(g,m,f,l,k){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);k=k||{};var i="",d,h="function",j=this.escapeExpression,o=this;function e(t,s){var q="",r;q+="\n
\n ";return q}function c(t,s){var q="",r;q+="\n ";r=f["if"].call(t,t["default"],{hash:{},inverse:o.program(6,n,s),fn:o.program(4,p,s),data:s});if(r||r===0){q+=r}q+="\n ";return q}function p(t,s){var q="",r;q+="\n ";if(r=f["default"]){r=r.call(t,{hash:{},data:s})}else{r=t["default"];r=typeof r===h?r.apply(t):r}q+=j(r)+"\n ";return q}function n(r,q){return"\n (empty)\n "}i+="
";if(d=f.name){d=d.call(m,{hash:{},data:k})}else{d=m.name;d=typeof d===h?d.apply(m):d}i+=j(d)+" \n
\n ";d=f["if"].call(m,m.isBody,{hash:{},inverse:o.program(3,c,k),fn:o.program(1,e,k),data:k});if(d||d===0){i+=d}i+="\n \n
";if(d=f.description){d=d.call(m,{hash:{},data:k})}else{d=m.description;d=typeof d===h?d.apply(m):d}if(d||d===0){i+=d}i+=" \n
";if(d=f.paramType){d=d.call(m,{hash:{},data:k})}else{d=m.paramType;d=typeof d===h?d.apply(m):d}if(d||d===0){i+=d}i+=' \n
\n';return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param_readonly_required=b(function(g,m,f,l,k){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);k=k||{};var i="",d,h="function",j=this.escapeExpression,o=this;function e(t,s){var q="",r;q+="\n
\n ";return q}function c(t,s){var q="",r;q+="\n ";r=f["if"].call(t,t["default"],{hash:{},inverse:o.program(6,n,s),fn:o.program(4,p,s),data:s});if(r||r===0){q+=r}q+="\n ";return q}function p(t,s){var q="",r;q+="\n ";if(r=f["default"]){r=r.call(t,{hash:{},data:s})}else{r=t["default"];r=typeof r===h?r.apply(t):r}q+=j(r)+"\n ";return q}function n(r,q){return"\n (empty)\n "}i+="
";if(d=f.name){d=d.call(m,{hash:{},data:k})}else{d=m.name;d=typeof d===h?d.apply(m):d}i+=j(d)+" \n
\n ";d=f["if"].call(m,m.isBody,{hash:{},inverse:o.program(3,c,k),fn:o.program(1,e,k),data:k});if(d||d===0){i+=d}i+="\n \n
";if(d=f.description){d=d.call(m,{hash:{},data:k})}else{d=m.description;d=typeof d===h?d.apply(m):d}if(d||d===0){i+=d}i+=" \n
";if(d=f.paramType){d=d.call(m,{hash:{},data:k})}else{d=m.paramType;d=typeof d===h?d.apply(m):d}if(d||d===0){i+=d}i+=' \n
\n';return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param_required=b(function(f,q,o,j,u){this.compilerInfo=[4,">= 1.0.0"];o=this.merge(o,f.helpers);u=u||{};var p="",g,d="function",c=this.escapeExpression,n=this;function m(z,y){var w="",x;w+="\n ";x=o["if"].call(z,z.isFile,{hash:{},inverse:n.program(4,k,y),fn:n.program(2,l,y),data:y});if(x||x===0){w+=x}w+="\n ";return w}function l(z,y){var w="",x;w+='\n
\n ";return w}function k(z,y){var w="",x;w+="\n ";x=o["if"].call(z,z["default"],{hash:{},inverse:n.program(7,h,y),fn:n.program(5,i,y),data:y});if(x||x===0){w+=x}w+="\n ";return w}function i(z,y){var w="",x;w+="\n
\n ";return w}function h(z,y){var w="",x;w+="\n
\n
\n
\n ';return w}function e(z,y){var w="",x;w+="\n ";x=o["if"].call(z,z.isFile,{hash:{},inverse:n.program(12,t,y),fn:n.program(10,v,y),data:y});if(x||x===0){w+=x}w+="\n ";return w}function v(z,y){var w="",x;w+="\n
\n ";return w}function t(z,y){var w="",x;w+="\n ";x=o["if"].call(z,z["default"],{hash:{},inverse:n.program(15,r,y),fn:n.program(13,s,y),data:y});if(x||x===0){w+=x}w+="\n ";return w}function s(z,y){var w="",x;w+="\n
\n ";return w}function r(z,y){var w="",x;w+="\n
\n ";return w}p+="
";if(g=o.name){g=g.call(q,{hash:{},data:u})}else{g=q.name;g=typeof g===d?g.apply(q):g}p+=c(g)+" \n
\n ";g=o["if"].call(q,q.isBody,{hash:{},inverse:n.program(9,e,u),fn:n.program(1,m,u),data:u});if(g||g===0){p+=g}p+="\n \n
\n ";if(g=o.description){g=g.call(q,{hash:{},data:u})}else{g=q.description;g=typeof g===d?g.apply(q):g}if(g||g===0){p+=g}p+=" \n \n
";if(g=o.paramType){g=g.call(q,{hash:{},data:u})}else{g=q.paramType;g=typeof g===d?g.apply(q):g}if(g||g===0){p+=g}p+=' \n
\n';return p})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.parameter_content_type=b(function(g,l,f,k,j){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);j=j||{};var i="",c,h="function",m=this;function e(r,q){var o="",p;o+="\n ";p=f.each.call(r,r.consumes,{hash:{},inverse:m.noop,fn:m.program(2,d,q),data:q});if(p||p===0){o+=p}o+="\n";return o}function d(r,q){var o="",p;o+='\n
';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+=" \n ";return o}function n(p,o){return'\n
application/json \n'}i+='
\n
\n';c=f["if"].call(l,l.consumes,{hash:{},inverse:m.program(4,n,j),fn:m.program(1,e,j),data:j});if(c||c===0){i+=c}i+="\n \n";return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.resource=b(function(g,m,f,l,k){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);k=k||{};var i="",d,p,h="function",j=this.escapeExpression,o=this,n=f.blockHelperMissing;function e(r,q){return" : "}function c(t,s){var q="",r;q+="
\n Raw \n ";return q}i+="
\n
\n ';if(d=f.name){d=d.call(m,{hash:{},data:k})}else{d=m.name;d=typeof d===h?d.apply(m):d}i+=j(d)+" ";p={hash:{},inverse:o.noop,fn:o.program(1,e,k),data:k};if(d=f.summary){d=d.call(m,p)}else{d=m.summary;d=typeof d===h?d.apply(m):d}if(!f.summary){d=n.call(m,d,p)}if(d||d===0){i+=d}if(d=f.summary){d=d.call(m,{hash:{},data:k})}else{d=m.summary;d=typeof d===h?d.apply(m):d}if(d||d===0){i+=d}i+="\n \n
\n";return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.response_content_type=b(function(g,l,f,k,j){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);j=j||{};var i="",c,h="function",m=this;function e(r,q){var o="",p;o+="\n ";p=f.each.call(r,r.produces,{hash:{},inverse:m.noop,fn:m.program(2,d,q),data:q});if(p||p===0){o+=p}o+="\n";return o}function d(r,q){var o="",p;o+='\n
';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+=" \n ";return o}function n(p,o){return'\n
application/json \n'}i+='
\n
\n';c=f["if"].call(l,l.produces,{hash:{},inverse:m.program(4,n,j),fn:m.program(1,e,j),data:j});if(c||c===0){i+=c}i+="\n \n";return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.signature=b(function(e,k,d,j,i){this.compilerInfo=[4,">= 1.0.0"];d=this.merge(d,e.helpers);i=i||{};var g="",c,f="function",h=this.escapeExpression;g+='
\n
\n
\n\n
\n
\n ';if(c=d.signature){c=c.call(k,{hash:{},data:i})}else{c=k.signature;c=typeof c===f?c.apply(k):c}if(c||c===0){g+=c}g+='\n
\n\n
\n
';if(c=d.sampleJSON){c=c.call(k,{hash:{},data:i})}else{c=k.sampleJSON;c=typeof c===f?c.apply(k):c}g+=h(c)+'
\n
\n
\n
\n\n';return g})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.status_code=b(function(e,k,d,j,i){this.compilerInfo=[4,">= 1.0.0"];d=this.merge(d,e.helpers);i=i||{};var g="",c,f="function",h=this.escapeExpression;g+="
";if(c=d.code){c=c.call(k,{hash:{},data:i})}else{c=k.code;c=typeof c===f?c.apply(k):c}g+=h(c)+" \n
";if(c=d.message){c=c.call(k,{hash:{},data:i})}else{c=k.message;c=typeof c===f?c.apply(k):c}if(c||c===0){g+=c}g+=" \n
";return g})})();(function(){var t,k,l,u,x,q,n,m,p,o,j,r,v,s,i,d,b,B,h,g,f,e,c,a,A,z,w={}.hasOwnProperty,y=function(F,D){for(var C in D){if(w.call(D,C)){F[C]=D[C]}}function E(){this.constructor=F}E.prototype=D.prototype;F.prototype=new E();F.__super__=D.prototype;return F};v=(function(D){y(C,D);function C(){s=C.__super__.constructor.apply(this,arguments);return s}C.prototype.dom_id="swagger_ui";C.prototype.options=null;C.prototype.api=null;C.prototype.headerView=null;C.prototype.mainView=null;C.prototype.initialize=function(E){var F=this;if(E==null){E={}}if(E.dom_id!=null){this.dom_id=E.dom_id;delete E.dom_id}if($("#"+this.dom_id)==null){$("body").append('
')}this.options=E;this.options.success=function(){return F.render()};this.options.progress=function(G){return F.showMessage(G)};this.options.failure=function(G){if(F.api&&F.api.isValid===false){log("not a valid 2.0 spec, loading legacy client");F.api=new SwaggerApi(F.options);return F.api.build()}else{return F.onLoadFailure(G)}};this.headerView=new u({el:$("#header")});return this.headerView.on("update-swagger-ui",function(G){return F.updateSwaggerUi(G)})};C.prototype.setOption=function(E,F){return this.options[E]=F};C.prototype.getOption=function(E){return this.options[E]};C.prototype.updateSwaggerUi=function(E){this.options.url=E.url;return this.load()};C.prototype.load=function(){var F,E;if((E=this.mainView)!=null){E.clear()}F=this.options.url;if(F.indexOf("http")!==0){F=this.buildUrl(window.location.href.toString(),F)}this.options.url=F;this.headerView.update(F);this.api=new SwaggerClient(this.options);return this.api.build()};C.prototype.collapseAll=function(){return Docs.collapseEndpointListForResource("")};C.prototype.listAll=function(){return Docs.collapseOperationsForResource("")};C.prototype.expandAll=function(){return Docs.expandOperationsForResource("")};C.prototype.render=function(){var E=this;this.showMessage("Finished Loading Resource Information. Rendering Swagger UI...");this.mainView=new x({model:this.api,el:$("#"+this.dom_id),swaggerOptions:this.options}).render();this.showMessage();switch(this.options.docExpansion){case"full":this.expandAll();break;case"list":this.listAll()}if(this.options.onComplete){this.options.onComplete(this.api,this)}return setTimeout(function(){return Docs.shebang()},400)};C.prototype.buildUrl=function(G,E){var F,H;log("base is "+G);if(E.indexOf("/")===0){H=G.split("/");G=H[0]+"//"+H[2];return G+E}else{F=G.length;if(G.indexOf("?")>-1){F=Math.min(F,G.indexOf("?"))}if(G.indexOf("#")>-1){F=Math.min(F,G.indexOf("#"))}G=G.substring(0,F);if(G.indexOf("/",G.length-1)!==-1){return G+E}return G+"/"+E}};C.prototype.showMessage=function(E){if(E==null){E=""}$("#message-bar").removeClass("message-fail");$("#message-bar").addClass("message-success");return $("#message-bar").html(E)};C.prototype.onLoadFailure=function(E){var F;if(E==null){E=""}$("#message-bar").removeClass("message-success");$("#message-bar").addClass("message-fail");F=$("#message-bar").html(E);if(this.options.onFailure!=null){this.options.onFailure(E)}return F};return C})(Backbone.Router);window.SwaggerUi=v;u=(function(D){y(C,D);function C(){i=C.__super__.constructor.apply(this,arguments);return i}C.prototype.events={"click #show-pet-store-icon":"showPetStore","click #show-wordnik-dev-icon":"showWordnikDev","click #explore":"showCustom","keyup #input_baseUrl":"showCustomOnKeyup","keyup #input_apiKey":"showCustomOnKeyup"};C.prototype.initialize=function(){};C.prototype.showPetStore=function(E){return this.trigger("update-swagger-ui",{url:"http://petstore.swagger.wordnik.com/api/api-docs"})};C.prototype.showWordnikDev=function(E){return this.trigger("update-swagger-ui",{url:"http://api.wordnik.com/v4/resources.json"})};C.prototype.showCustomOnKeyup=function(E){if(E.keyCode===13){return this.showCustom()}};C.prototype.showCustom=function(E){if(E!=null){E.preventDefault()}return this.trigger("update-swagger-ui",{url:$("#input_baseUrl").val(),apiKey:$("#input_apiKey").val()})};C.prototype.update=function(F,G,E){if(E==null){E=false}$("#input_baseUrl").val(F);if(E){return this.trigger("update-swagger-ui",{url:F})}};return C})(Backbone.View);x=(function(C){var D;y(E,C);function E(){h=E.__super__.constructor.apply(this,arguments);return h}D={alpha:function(G,F){return G.path.localeCompare(F.path)},method:function(G,F){return G.method.localeCompare(F.method)}};E.prototype.initialize=function(J){var I,H,G,F,K,L;if(J==null){J={}}this.model.auths=[];L=this.model.securityDefinitions;for(H in L){K=L[H];I={name:H,type:K.type,value:K};this.model.auths.push(I)}if(this.model.info&&this.model.info.license&&typeof this.model.info.license==="string"){G=this.model.info.license;F=this.model.info.licenseUrl;this.model.info.license={};this.model.info.license.name=G;this.model.info.license.url=F}if(!this.model.info){this.model.info={}}if(!this.model.info.version){this.model.info.version=this.model.apiVersion}if(this.model.swaggerVersion==="2.0"){if("validatorUrl" in J.swaggerOptions){return this.model.validatorUrl=J.swaggerOptions.validatorUrl}else{if(this.model.url.indexOf("localhost")>0){return this.model.validatorUrl=null}else{return this.model.validatorUrl="http://online.swagger.io/validator"}}}};E.prototype.render=function(){var K,N,F,H,G,L,I,M,O,J;if(this.model.securityDefinitions){for(G in this.model.securityDefinitions){K=this.model.securityDefinitions[G];if(K.type==="apiKey"&&$("#apikey_button").length===0){N=new t({model:K}).render().el;$(".auth_main_container").append(N)}if(K.type==="basicAuth"&&$("#basic_auth_button").length===0){N=new k({model:K}).render().el;$(".auth_main_container").append(N)}}}$(this.el).html(Handlebars.templates.main(this.model));I={};F=0;J=this.model.apisArray;for(M=0,O=J.length;M
F){O=F-G}if(OE){L=E-I}if(L ")}this.model.oauth=null;if(this.model.authorizations){if(Array.isArray(this.model.authorizations)){Q=this.model.authorizations;for(ai=0,T=Q.length;ai0){H[M.name]=M.value}if(M.type==="file"){R=true}}I=K.find("textarea");for(P=0,J=I.length;P0){H[M.name]=M.value}}F=K.find("select");for(O=0,G=F.length;O0){H[M.name]=N}}E.responseContentType=$("div select[name=responseContentType]",$(this.el)).val();E.requestContentType=$("div select[name=parameterContentType]",$(this.el)).val();$(".response_throbber",$(this.el)).show();if(R){return this.handleFileUpload(H,K)}else{return this.model["do"](H,E,this.showCompleteStatus,this.showErrorStatus,this)}}};C.prototype.success=function(E,F){return F.showCompleteStatus(E)};C.prototype.handleFileUpload=function(V,M){var Q,L,G,R,P,O,T,N,K,J,H,U,Y,X,W,I,F,E,Z,S=this;I=M.serializeArray();for(N=0,U=I.length;N0){V[R.name]=R.value}}Q=new FormData();T=0;F=this.model.parameters;for(K=0,Y=F.length;K");$(".request_url pre",$(this.el)).text(this.invocationUrl);P={type:this.model.method,url:this.invocationUrl,headers:G,data:Q,dataType:"json",contentType:false,processData:false,error:function(ab,ac,aa){return S.showErrorStatus(S.wrap(ab),S)},success:function(aa){return S.showResponse(aa,S)},complete:function(aa){return S.showCompleteStatus(S.wrap(aa),S)}};if(window.authorizations){window.authorizations.apply(P)}if(T===0){P.data.append("fake","true")}jQuery.ajax(P);return false};C.prototype.wrap=function(I){var G,J,L,F,K,H,E;L={};J=I.getAllResponseHeaders().split("\r");for(H=0,E=J.length;H0){return G}else{return null}}};C.prototype.hideResponse=function(E){if(E!=null){E.preventDefault()}$(".response",$(this.el)).slideUp();return $(".response_hider",$(this.el)).fadeOut()};C.prototype.showResponse=function(E){var F;F=JSON.stringify(E,null,"\t").replace(/\n/g," ");return $(".response_body",$(this.el)).html(escape(F))};C.prototype.showErrorStatus=function(F,E){return E.showStatus(F)};C.prototype.showCompleteStatus=function(F,E){return E.showStatus(F)};C.prototype.formatXml=function(L){var H,K,F,M,R,N,G,E,P,Q,J,I,O;E=/(>)(<)(\/*)/g;Q=/[ ]*(.*)[ ]+\n/g;H=/(<.+>)(.+\n)/g;L=L.replace(E,"$1\n$2$3").replace(Q,"$1\n").replace(H,"$1\n$2");G=0;K="";R=L.split("\n");F=0;M="other";P={"single->single":0,"single->closing":-1,"single->opening":0,"single->other":0,"closing->single":0,"closing->closing":-1,"closing->opening":0,"closing->other":0,"opening->single":1,"opening->closing":0,"opening->opening":1,"opening->other":1,"other->single":0,"other->closing":-1,"other->opening":0,"other->other":0};J=function(X){var T,S,V,Z,W,U,Y;U={single:Boolean(X.match(/<.+\/>/)),closing:Boolean(X.match(/<\/.+>/)),opening:Boolean(X.match(/<[^!?].*>/))};W=((function(){var aa;aa=[];for(V in U){Y=U[V];if(Y){aa.push(V)}}return aa})())[0];W=W===void 0?"other":W;T=M+"->"+W;M=W;Z="";F+=P[T];Z=((function(){var ab,ac,aa;aa=[];for(S=ab=0,ac=F;0<=ac?abac;S=0<=ac?++ab:--ab){aa.push(" ")}return aa})()).join("");if(T==="opening->closing"){return K=K.substr(0,K.length-1)+X+"\n"}else{return K+=Z+X+"\n"}};for(I=0,O=R.length;I ").text("no content");I=$(' ').append(G)}else{if(P==="application/json"||/\+json$/.test(P)){Q=null;try{Q=JSON.stringify(JSON.parse(N),null," ")}catch(O){M=O;Q="can't parse JSON. Raw result:\n\n"+N}G=$("
").text(Q);I=$(' ').append(G)}else{if(P==="application/xml"||/\+xml$/.test(P)){G=$("
").text(this.formatXml(N));I=$(' ').append(G)}else{if(P==="text/html"){G=$("
").html(_.escape(N));I=$(' ').append(G)}else{if(/^image\//.test(P)){I=$(" ").attr("src",F)}else{G=$("
").text(N);I=$(' ').append(G)}}}}}L=I;$(".request_url",$(this.el)).html(" ");$(".request_url pre",$(this.el)).text(F);$(".response_code",$(this.el)).html(""+J.status+" ");$(".response_body",$(this.el)).html(L);$(".response_headers",$(this.el)).html(""+_.escape(JSON.stringify(J.headers,null," ")).replace(/\n/g," ")+" ");$(".response",$(this.el)).slideDown();$(".response_hider",$(this.el)).show();$(".response_throbber",$(this.el)).hide();K=$(".response_body",$(this.el))[0];E=this.options.swaggerOptions;if(E.highlightSizeThreshold&&J.data.length>E.highlightSizeThreshold){return K}else{return hljs.highlightBlock(K)}};C.prototype.toggleOperationContent=function(){var E;E=$("#"+Docs.escapeResourceName(this.model.parentId+"_"+this.model.nickname+"_content"));if(E.is(":visible")){return Docs.collapseOperation(E)}else{return Docs.expandOperation(E)}};return C})(Backbone.View);r=(function(D){y(C,D);function C(){e=C.__super__.constructor.apply(this,arguments);return e}C.prototype.initialize=function(){};C.prototype.render=function(){var F,E,G;G=this.template();$(this.el).html(G(this.model));if(swaggerUi.api.models.hasOwnProperty(this.model.responseModel)){F={sampleJSON:JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(),null,2),isParam:false,signature:swaggerUi.api.models[this.model.responseModel].getMockSignature()};E=new j({model:F,tagName:"div"});$(".model-signature",this.$el).append(E.render().el)}else{$(".model-signature",this.$el).html("")}return this};C.prototype.template=function(){return Handlebars.templates.status_code};return C})(Backbone.View);m=(function(D){y(C,D);function C(){c=C.__super__.constructor.apply(this,arguments);return c}C.prototype.initialize=function(){return Handlebars.registerHelper("isArray",function(F,E){if(F.type.toLowerCase()==="array"||F.allowMultiple){return E.fn(this)}else{return E.inverse(this)}})};C.prototype.render=function(){var E,F,I,G,J,H,M,N,L,K;K=this.model.type||this.model.dataType;if(typeof K==="undefined"){H=this.model.schema;if(H&&H["$ref"]){G=H["$ref"];if(G.indexOf("#/definitions/")===0){K=G.substring("#/definitions/".length)}else{K=G}}}this.model.type=K;this.model.paramType=this.model["in"]||this.model.paramType;if(this.model.paramType==="body"){this.model.isBody=true}if(K&&K.toLowerCase()==="file"){this.model.isFile=true}this.model["default"]=this.model["default"]||this.model.defaultValue;if(this.model.allowableValues){this.model.isList=true}L=this.template();$(this.el).html(L(this.model));M={sampleJSON:this.model.sampleJSON,isParam:true,signature:this.model.signature};if(this.model.sampleJSON){N=new j({model:M,tagName:"div"});$(".model-signature",$(this.el)).append(N.render().el)}else{$(".model-signature",$(this.el)).html(this.model.signature)}F=false;if(this.model.isBody){F=true}E={isParam:F};E.consumes=this.model.consumes;if(F){I=new n({model:E});$(".parameter-content-type",$(this.el)).append(I.render().el)}else{J=new o({model:E});$(".response-content-type",$(this.el)).append(J.render().el)}return this};C.prototype.template=function(){if(this.model.isList){return Handlebars.templates.param_list}else{if(this.options.readOnly){if(this.model.required){return Handlebars.templates.param_readonly_required}else{return Handlebars.templates.param_readonly}}else{if(this.model.required){return Handlebars.templates.param_required}else{return Handlebars.templates.param}}}};return C})(Backbone.View);j=(function(D){y(C,D);function C(){a=C.__super__.constructor.apply(this,arguments);return a}C.prototype.events={"click a.description-link":"switchToDescription","click a.snippet-link":"switchToSnippet","mousedown .snippet":"snippetToTextArea"};C.prototype.initialize=function(){};C.prototype.render=function(){var E;E=this.template();$(this.el).html(E(this.model));this.switchToSnippet();this.isParam=this.model.isParam;if(this.isParam){$(".notice",$(this.el)).text("Click to set as parameter value")}return this};C.prototype.template=function(){return Handlebars.templates.signature};C.prototype.switchToDescription=function(E){if(E!=null){E.preventDefault()}$(".snippet",$(this.el)).hide();$(".description",$(this.el)).show();$(".description-link",$(this.el)).addClass("selected");return $(".snippet-link",$(this.el)).removeClass("selected")};C.prototype.switchToSnippet=function(E){if(E!=null){E.preventDefault()}$(".description",$(this.el)).hide();$(".snippet",$(this.el)).show();$(".snippet-link",$(this.el)).addClass("selected");return $(".description-link",$(this.el)).removeClass("selected")};C.prototype.snippetToTextArea=function(E){var F;if(this.isParam){if(E!=null){E.preventDefault()}F=$("textarea",$(this.el.parentNode.parentNode.parentNode));if($.trim(F.val())===""){return F.val(this.model.sampleJSON)}}};return C})(Backbone.View);l=(function(C){y(D,C);function D(){A=D.__super__.constructor.apply(this,arguments);return A}D.prototype.initialize=function(){};D.prototype.render=function(){var E;E=this.template();$(this.el).html(E(this.model));$("label[for=contentType]",$(this.el)).text("Response Content Type");return this};D.prototype.template=function(){return Handlebars.templates.content_type};return D})(Backbone.View);o=(function(C){y(D,C);function D(){z=D.__super__.constructor.apply(this,arguments);return z}D.prototype.initialize=function(){};D.prototype.render=function(){var E;E=this.template();$(this.el).html(E(this.model));$("label[for=responseContentType]",$(this.el)).text("Response Content Type");return this};D.prototype.template=function(){return Handlebars.templates.response_content_type};return D})(Backbone.View);n=(function(D){y(C,D);function C(){d=C.__super__.constructor.apply(this,arguments);return d}C.prototype.initialize=function(){};C.prototype.render=function(){var E;E=this.template();$(this.el).html(E(this.model));$("label[for=parameterContentType]",$(this.el)).text("Parameter content type:");return this};C.prototype.template=function(){return Handlebars.templates.parameter_content_type};return C})(Backbone.View);t=(function(D){y(C,D);function C(){b=C.__super__.constructor.apply(this,arguments);return b}C.prototype.initialize=function(){};C.prototype.render=function(){var E;E=this.template();$(this.el).html(E(this.model));return this};C.prototype.events={"click #apikey_button":"toggleApiKeyContainer","click #apply_api_key":"applyApiKey"};C.prototype.applyApiKey=function(){var E;window.authorizations.add(this.model.name,new ApiKeyAuthorization(this.model.name,$("#input_apiKey_entry").val(),this.model["in"]));window.swaggerUi.load();return E=$("#apikey_container").show()};C.prototype.toggleApiKeyContainer=function(){var E;if($("#apikey_container").length>0){E=$("#apikey_container").first();if(E.is(":visible")){return E.hide()}else{$(".auth_container").hide();return E.show()}}};C.prototype.template=function(){return Handlebars.templates.apikey_button_view};return C})(Backbone.View);k=(function(D){y(C,D);function C(){B=C.__super__.constructor.apply(this,arguments);return B}C.prototype.initialize=function(){};C.prototype.render=function(){var E;E=this.template();$(this.el).html(E(this.model));return this};C.prototype.events={"click #basic_auth_button":"togglePasswordContainer","click #apply_basic_auth":"applyPassword"};C.prototype.applyPassword=function(){var F,E,G;console.log("applying password");G=$(".input_username").val();E=$(".input_password").val();window.authorizations.add(this.model.type,new PasswordAuthorization("basic",G,E));window.swaggerUi.load();return F=$("#basic_auth_container").hide()};C.prototype.togglePasswordContainer=function(){var E;if($("#basic_auth_container").length>0){E=$("#basic_auth_container").show();if(E.is(":visible")){return E.slideUp()}else{$(".auth_container").hide();return E.show()}}};C.prototype.template=function(){return Handlebars.templates.basic_auth_button_view};return C})(Backbone.View)}).call(this);`)
func www_swagger_ui_swagger_ui_min_js_bytes() ([]byte, error) {
return _www_swagger_ui_swagger_ui_min_js, nil
}
func www_swagger_ui_swagger_ui_min_js() (*asset, error) {
bytes, err := www_swagger_ui_swagger_ui_min_js_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "www/swagger-ui/swagger-ui.min.js", size: 58357, mode: os.FileMode(416), modTime: time.Unix(1419029016, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _www_titlelogo_svg = []byte(`
image/svg+xml `)
func www_titlelogo_svg_bytes() ([]byte, error) {
return _www_titlelogo_svg, nil
}
func www_titlelogo_svg() (*asset, error) {
bytes, err := www_titlelogo_svg_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "www/titlelogo.svg", size: 50107, mode: os.FileMode(416), modTime: time.Unix(1418933599, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
// Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func Asset(name string) ([]byte, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
}
return a.bytes, nil
}
return nil, fmt.Errorf("Asset %s not found", name)
}
// AssetInfo loads and returns the asset info for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func AssetInfo(name string) (os.FileInfo, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
}
return a.info, nil
}
return nil, fmt.Errorf("AssetInfo %s not found", name)
}
// AssetNames returns the names of the assets.
func AssetNames() []string {
names := make([]string, 0, len(_bindata))
for name := range _bindata {
names = append(names, name)
}
return names
}
// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() (*asset, error){
"www/box.ng": www_box_ng,
"www/index.html": www_index_html,
"www/k8s-style.css": www_k8s_style_css,
"www/logotext.svg": www_logotext_svg,
"www/partials/groups.html": www_partials_groups_html,
"www/partials/pod.html": www_partials_pod_html,
"www/podcontroller.js": www_podcontroller_js,
"www/swagger-ui/css/reset.css": www_swagger_ui_css_reset_css,
"www/swagger-ui/css/screen.css": www_swagger_ui_css_screen_css,
"www/swagger-ui/images/explorer_icons.png": www_swagger_ui_images_explorer_icons_png,
"www/swagger-ui/images/logo_small.png": www_swagger_ui_images_logo_small_png,
"www/swagger-ui/images/pet_store_api.png": www_swagger_ui_images_pet_store_api_png,
"www/swagger-ui/images/throbber.gif": www_swagger_ui_images_throbber_gif,
"www/swagger-ui/images/wordnik_api.png": www_swagger_ui_images_wordnik_api_png,
"www/swagger-ui/index.html": www_swagger_ui_index_html,
"www/swagger-ui/lib/backbone-min.js": www_swagger_ui_lib_backbone_min_js,
"www/swagger-ui/lib/handlebars-1.0.0.js": www_swagger_ui_lib_handlebars_1_0_0_js,
"www/swagger-ui/lib/highlight.7.3.pack.js": www_swagger_ui_lib_highlight_7_3_pack_js,
"www/swagger-ui/lib/jquery-1.8.0.min.js": www_swagger_ui_lib_jquery_1_8_0_min_js,
"www/swagger-ui/lib/jquery.ba-bbq.min.js": www_swagger_ui_lib_jquery_ba_bbq_min_js,
"www/swagger-ui/lib/jquery.slideto.min.js": www_swagger_ui_lib_jquery_slideto_min_js,
"www/swagger-ui/lib/jquery.wiggle.min.js": www_swagger_ui_lib_jquery_wiggle_min_js,
"www/swagger-ui/lib/shred/content.js": www_swagger_ui_lib_shred_content_js,
"www/swagger-ui/lib/shred.bundle.js": www_swagger_ui_lib_shred_bundle_js,
"www/swagger-ui/lib/swagger-client.js": www_swagger_ui_lib_swagger_client_js,
"www/swagger-ui/lib/swagger-oauth.js": www_swagger_ui_lib_swagger_oauth_js,
"www/swagger-ui/lib/swagger.js": www_swagger_ui_lib_swagger_js,
"www/swagger-ui/lib/underscore-min.js": www_swagger_ui_lib_underscore_min_js,
"www/swagger-ui/o2c.html": www_swagger_ui_o2c_html,
"www/swagger-ui/swagger-ui.js": www_swagger_ui_swagger_ui_js,
"www/swagger-ui/swagger-ui.min.js": www_swagger_ui_swagger_ui_min_js,
"www/titlelogo.svg": www_titlelogo_svg,
}
// AssetDir returns the file names below a certain
// directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the
// following hierarchy:
// data/
// foo.txt
// img/
// a.png
// b.png
// then AssetDir("data") would return []string{"foo.txt", "img"}
// AssetDir("data/img") would return []string{"a.png", "b.png"}
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
// AssetDir("") will return []string{"data"}.
func AssetDir(name string) ([]string, error) {
node := _bintree
if len(name) != 0 {
cannonicalName := strings.Replace(name, "\\", "/", -1)
pathList := strings.Split(cannonicalName, "/")
for _, p := range pathList {
node = node.Children[p]
if node == nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
}
}
if node.Func != nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
rv := make([]string, 0, len(node.Children))
for name := range node.Children {
rv = append(rv, name)
}
return rv, nil
}
type _bintree_t struct {
Func func() (*asset, error)
Children map[string]*_bintree_t
}
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
"www": {nil, map[string]*_bintree_t{
"box.ng": {www_box_ng, map[string]*_bintree_t{}},
"index.html": {www_index_html, map[string]*_bintree_t{}},
"k8s-style.css": {www_k8s_style_css, map[string]*_bintree_t{}},
"logotext.svg": {www_logotext_svg, map[string]*_bintree_t{}},
"partials": {nil, map[string]*_bintree_t{
"groups.html": {www_partials_groups_html, map[string]*_bintree_t{}},
"pod.html": {www_partials_pod_html, map[string]*_bintree_t{}},
}},
"podcontroller.js": {www_podcontroller_js, map[string]*_bintree_t{}},
"swagger-ui": {nil, map[string]*_bintree_t{
"css": {nil, map[string]*_bintree_t{
"reset.css": {www_swagger_ui_css_reset_css, map[string]*_bintree_t{}},
"screen.css": {www_swagger_ui_css_screen_css, map[string]*_bintree_t{}},
}},
"images": {nil, map[string]*_bintree_t{
"explorer_icons.png": {www_swagger_ui_images_explorer_icons_png, map[string]*_bintree_t{}},
"logo_small.png": {www_swagger_ui_images_logo_small_png, map[string]*_bintree_t{}},
"pet_store_api.png": {www_swagger_ui_images_pet_store_api_png, map[string]*_bintree_t{}},
"throbber.gif": {www_swagger_ui_images_throbber_gif, map[string]*_bintree_t{}},
"wordnik_api.png": {www_swagger_ui_images_wordnik_api_png, map[string]*_bintree_t{}},
}},
"index.html": {www_swagger_ui_index_html, map[string]*_bintree_t{}},
"lib": {nil, map[string]*_bintree_t{
"backbone-min.js": {www_swagger_ui_lib_backbone_min_js, map[string]*_bintree_t{}},
"handlebars-1.0.0.js": {www_swagger_ui_lib_handlebars_1_0_0_js, map[string]*_bintree_t{}},
"highlight.7.3.pack.js": {www_swagger_ui_lib_highlight_7_3_pack_js, map[string]*_bintree_t{}},
"jquery-1.8.0.min.js": {www_swagger_ui_lib_jquery_1_8_0_min_js, map[string]*_bintree_t{}},
"jquery.ba-bbq.min.js": {www_swagger_ui_lib_jquery_ba_bbq_min_js, map[string]*_bintree_t{}},
"jquery.slideto.min.js": {www_swagger_ui_lib_jquery_slideto_min_js, map[string]*_bintree_t{}},
"jquery.wiggle.min.js": {www_swagger_ui_lib_jquery_wiggle_min_js, map[string]*_bintree_t{}},
"shred": {nil, map[string]*_bintree_t{
"content.js": {www_swagger_ui_lib_shred_content_js, map[string]*_bintree_t{}},
}},
"shred.bundle.js": {www_swagger_ui_lib_shred_bundle_js, map[string]*_bintree_t{}},
"swagger-client.js": {www_swagger_ui_lib_swagger_client_js, map[string]*_bintree_t{}},
"swagger-oauth.js": {www_swagger_ui_lib_swagger_oauth_js, map[string]*_bintree_t{}},
"swagger.js": {www_swagger_ui_lib_swagger_js, map[string]*_bintree_t{}},
"underscore-min.js": {www_swagger_ui_lib_underscore_min_js, map[string]*_bintree_t{}},
}},
"o2c.html": {www_swagger_ui_o2c_html, map[string]*_bintree_t{}},
"swagger-ui.js": {www_swagger_ui_swagger_ui_js, map[string]*_bintree_t{}},
"swagger-ui.min.js": {www_swagger_ui_swagger_ui_min_js, map[string]*_bintree_t{}},
}},
"titlelogo.svg": {www_titlelogo_svg, map[string]*_bintree_t{}},
}},
}}
// Restore an asset under the given directory
func RestoreAsset(dir, name string) error {
data, err := Asset(name)
if err != nil {
return err
}
info, err := AssetInfo(name)
if err != nil {
return err
}
err = os.MkdirAll(_filePath(dir, path.Dir(name)), os.FileMode(0755))
if err != nil {
return err
}
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
if err != nil {
return err
}
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
if err != nil {
return err
}
return nil
}
// Restore assets under the given directory recursively
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
if err != nil { // File
return RestoreAsset(dir, name)
} else { // Dir
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
}
return nil
}
func _filePath(dir, name string) string {
cannonicalName := strings.Replace(name, "\\", "/", -1)
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
}