swagger-ui
Advanced tools
Comparing version 2.1.0-alpha.2 to 2.1.0-alpha.3
// swagger-client.js | ||
// version 2.1.0-alpha.1 | ||
// version 2.1.0-alpha.2 | ||
/** | ||
@@ -378,3 +378,4 @@ * Array Model | ||
this.host = response.host || ''; | ||
this.schemes = response.schemes || [ 'http' ]; | ||
this.schemes = response.schemes || []; | ||
this.scheme; | ||
this.basePath = response.basePath || ''; | ||
@@ -387,5 +388,15 @@ this.apis = {}; | ||
var location = this.parseUri(this.url); | ||
if(typeof this.schemes === 'undefined' || this.schemes.length === 0) { | ||
this.scheme = location.scheme; | ||
} | ||
else { | ||
this.scheme = this.schemes[0]; | ||
} | ||
if(typeof this.host === 'undefined' || this.host === '') { | ||
var location = this.parseUri(this.url); | ||
this.host = location.host; | ||
if (location.port) { | ||
this.host = this.host + ':' + location.port; | ||
} | ||
} | ||
@@ -471,2 +482,3 @@ | ||
host: parts[11], | ||
port: parts[12], | ||
path: parts[15] | ||
@@ -522,2 +534,3 @@ }; | ||
this.schemes = parent.schemes; | ||
this.scheme = parent.scheme || 'http'; | ||
this.basePath = parent.basePath; | ||
@@ -638,2 +651,4 @@ this.nickname = (operationId||errors.push('Operations must have a nickname.')); | ||
str = 'long'; | ||
else if(type === 'integer' && typeof format === 'undefined') | ||
str = 'long'; | ||
else if(type === 'string' && format === 'date-time') | ||
@@ -647,2 +662,4 @@ str = 'date-time'; | ||
str = 'double'; | ||
else if(type === 'number' && typeof format === 'undefined') | ||
str = 'double'; | ||
else if(type === 'boolean') | ||
@@ -837,2 +854,4 @@ str = 'boolean'; | ||
formParams[param.name] = args[param.name]; | ||
else if (param.in === 'body') | ||
args.body = args[param.name]; | ||
} | ||
@@ -855,4 +874,3 @@ } | ||
} | ||
var scheme = this.schemes[0]; | ||
var url = scheme + '://' + this.host + this.basePath + requestUrl + querystring; | ||
var url = this.scheme + '://' + this.host + this.basePath + requestUrl + querystring; | ||
@@ -1011,3 +1029,3 @@ var obj = { | ||
this.properties = []; | ||
var requiredFields = definition.enum || []; | ||
var requiredFields = definition.required || []; | ||
@@ -1073,3 +1091,3 @@ var key; | ||
var model = models[ref]; | ||
if (model && typeof modelsToIgnore === 'undefined') { | ||
if (model && typeof modelsToIgnore[model.name] === 'undefined') { | ||
returnVal = returnVal + ('<br>' + model.getMockSignature(modelsToIgnore)); | ||
@@ -1096,2 +1114,3 @@ } | ||
this.name = name; | ||
this.description = obj.description; | ||
this.obj = obj; | ||
@@ -1164,2 +1183,4 @@ this.optional = true; | ||
str += 'long'; | ||
else if(obj.type === 'integer' && typeof obj.format === 'undefined') | ||
str += 'long'; | ||
else if(obj.type === 'string' && obj.format === 'date-time') | ||
@@ -1173,2 +1194,4 @@ str += 'date-time'; | ||
str += 'double'; | ||
else if(obj.type === 'number' && typeof obj.format === 'undefined') | ||
str += 'double'; | ||
else if(obj.type === 'boolean') | ||
@@ -1192,8 +1215,13 @@ str += 'boolean'; | ||
var str = getStringSignature(this.obj); | ||
if(str !== '') | ||
str = this.name + ' : ' + str; | ||
if(str !== '') { | ||
str = '<span class="propName ' + this.required + '">' + this.name + '</span> (<span class="propType">' + str + '</span>'; | ||
if(!this.required) | ||
str += ', <span class="propOptKey">optional</span>'; | ||
str += ')'; | ||
} | ||
else | ||
str = this.name + ' : ' + JSON.stringify(this.obj); | ||
if(!this.required) | ||
str += ' (optional)'; | ||
str = this.name + ' (' + JSON.stringify(this.obj) + ')'; | ||
if(typeof this.description !== 'undefined') | ||
str += ': ' + this.description; | ||
return str; | ||
@@ -1208,2 +1236,4 @@ } | ||
str = 'long'; | ||
else if(type === 'integer' && typeof format === 'undefined') | ||
str = 'long'; | ||
else if(type === 'string' && format === 'date-time') | ||
@@ -1217,2 +1247,4 @@ str = 'date-time'; | ||
str = 'double'; | ||
else if(type === 'number' && typeof format === 'undefined') | ||
str = 'double'; | ||
else if(type === 'boolean') | ||
@@ -1219,0 +1251,0 @@ str = 'boolean'; |
// swagger.js | ||
// version 2.0.41 | ||
// version 2.0.34 | ||
(function () { | ||
var __bind = function (fn, me) { | ||
return function () { | ||
return fn.apply(me, arguments); | ||
}; | ||
var __bind = function(fn, me){ | ||
return function(){ | ||
return fn.apply(me, arguments); | ||
}; | ||
}; | ||
var log = function () { | ||
log.history = log.history || []; | ||
log.history.push(arguments); | ||
if (this.console) { | ||
console.log(Array.prototype.slice.call(arguments)[0]); | ||
} | ||
}; | ||
// if you want to apply conditional formatting of parameter values | ||
var parameterMacro = function (value) { | ||
return value; | ||
log = function(){ | ||
log.history = log.history || []; | ||
log.history.push(arguments); | ||
if(this.console){ | ||
console.log( Array.prototype.slice.call(arguments)[0] ); | ||
} | ||
}; | ||
// if you want to apply conditional formatting of model property values | ||
var modelPropertyMacro = function (value) { | ||
return value; | ||
} | ||
if (!Array.prototype.indexOf) { | ||
Array.prototype.indexOf = function (obj, start) { | ||
for (var i = (start || 0), j = this.length; i < j; i++) { | ||
if (this[i] === obj) { return i; } | ||
} | ||
return -1; | ||
if (!Array.prototype.indexOf) { | ||
Array.prototype.indexOf = function(obj, start) { | ||
for (var i = (start || 0), j = this.length; i < j; i++) { | ||
if (this[i] === obj) { return i; } | ||
} | ||
return -1; | ||
} | ||
} | ||
if (!('filter' in Array.prototype)) { | ||
Array.prototype.filter = function (filter, that /*opt*/) { | ||
var other = [], v; | ||
for (var i = 0, n = this.length; i < n; i++) | ||
if (i in this && filter.call(that, v = this[i], i, this)) | ||
other.push(v); | ||
return other; | ||
}; | ||
} | ||
if (!('filter' in Array.prototype)) { | ||
Array.prototype.filter= function(filter, that /*opt*/) { | ||
var other= [], v; | ||
for (var i=0, n= this.length; i<n; i++) | ||
if (i in this && filter.call(that, v= this[i], i, this)) | ||
other.push(v); | ||
return other; | ||
}; | ||
} | ||
if (!('map' in Array.prototype)) { | ||
Array.prototype.map = function (mapper, that /*opt*/) { | ||
var other = new Array(this.length); | ||
for (var i = 0, n = this.length; i < n; i++) | ||
if (i in this) | ||
other[i] = mapper.call(that, this[i], i, this); | ||
return other; | ||
}; | ||
} | ||
if (!('map' in Array.prototype)) { | ||
Array.prototype.map= function(mapper, that /*opt*/) { | ||
var other= new Array(this.length); | ||
for (var i= 0, n= this.length; i<n; i++) | ||
if (i in this) | ||
other[i]= mapper.call(that, this[i], i, this); | ||
return other; | ||
}; | ||
} | ||
Object.keys = Object.keys || (function () { | ||
Object.keys = Object.keys || (function () { | ||
var hasOwnProperty = Object.prototype.hasOwnProperty, | ||
hasDontEnumBug = !{ toString: null }.propertyIsEnumerable("toString"), | ||
DontEnums = [ | ||
'toString', | ||
'toLocaleString', | ||
'valueOf', | ||
'hasOwnProperty', | ||
'isPrototypeOf', | ||
'propertyIsEnumerable', | ||
'constructor' | ||
], | ||
DontEnumsLength = DontEnums.length; | ||
hasDontEnumBug = !{toString:null}.propertyIsEnumerable("toString"), | ||
DontEnums = [ | ||
'toString', | ||
'toLocaleString', | ||
'valueOf', | ||
'hasOwnProperty', | ||
'isPrototypeOf', | ||
'propertyIsEnumerable', | ||
'constructor' | ||
], | ||
DontEnumsLength = DontEnums.length; | ||
return function (o) { | ||
if (typeof o != "object" && typeof o != "function" || o === null) | ||
throw new TypeError("Object.keys called on a non-object"); | ||
if (typeof o != "object" && typeof o != "function" || o === null) | ||
throw new TypeError("Object.keys called on a non-object"); | ||
var result = []; | ||
for (var name in o) { | ||
if (hasOwnProperty.call(o, name)) | ||
result.push(name); | ||
} | ||
var result = []; | ||
for (var name in o) { | ||
if (hasOwnProperty.call(o, name)) | ||
result.push(name); | ||
} | ||
if (hasDontEnumBug) { | ||
for (var i = 0; i < DontEnumsLength; i++) { | ||
if (hasOwnProperty.call(o, DontEnums[i])) | ||
result.push(DontEnums[i]); | ||
if (hasDontEnumBug) { | ||
for (var i = 0; i < DontEnumsLength; i++) { | ||
if (hasOwnProperty.call(o, DontEnums[i])) | ||
result.push(DontEnums[i]); | ||
} | ||
} | ||
} | ||
return result; | ||
return result; | ||
}; | ||
})(); | ||
})(); | ||
var SwaggerApi = function (url, options) { | ||
this.isBuilt = false; | ||
this.url = null; | ||
this.debug = false; | ||
this.basePath = null; | ||
this.authorizations = null; | ||
this.authorizationScheme = null; | ||
this.info = null; | ||
this.useJQuery = false; | ||
this.modelsArray = []; | ||
this.isValid; | ||
options = (options || {}); | ||
if (url) | ||
if (url.url) | ||
options = url; | ||
else | ||
this.url = url; | ||
var SwaggerApi = function(url, options) { | ||
this.url = null; | ||
this.debug = false; | ||
this.basePath = null; | ||
this.authorizations = null; | ||
this.authorizationScheme = null; | ||
this.info = null; | ||
this.useJQuery = false; | ||
options = (options||{}); | ||
if (url) | ||
if (url.url) | ||
options = url; | ||
else | ||
options = url; | ||
this.url = url; | ||
else | ||
options = url; | ||
if (options.url != null) | ||
this.url = options.url; | ||
if (options.url != null) | ||
this.url = options.url; | ||
if (options.success != null) | ||
this.success = options.success; | ||
if (options.success != null) | ||
this.success = options.success; | ||
if (typeof options.useJQuery === 'boolean') | ||
this.useJQuery = options.useJQuery; | ||
if (typeof options.useJQuery === 'boolean') | ||
this.useJQuery = options.useJQuery; | ||
this.failure = options.failure != null ? options.failure : function () { }; | ||
this.progress = options.progress != null ? options.progress : function () { }; | ||
if (options.success != null) { | ||
this.build(); | ||
this.isBuilt = true; | ||
} | ||
} | ||
this.failure = options.failure != null ? options.failure : function() {}; | ||
this.progress = options.progress != null ? options.progress : function() {}; | ||
if (options.success != null) | ||
this.build(); | ||
} | ||
SwaggerApi.prototype.build = function () { | ||
if (this.isBuilt) | ||
return this; | ||
var _this = this; | ||
this.progress('fetching resource list: ' + this.url); | ||
var obj = { | ||
useJQuery: this.useJQuery, | ||
url: this.url, | ||
method: "get", | ||
headers: { | ||
accept: "application/json,application/json;charset=\"utf-8\",*/*" | ||
SwaggerApi.prototype.build = function() { | ||
var _this = this; | ||
this.progress('fetching resource list: ' + this.url); | ||
var obj = { | ||
useJQuery: this.useJQuery, | ||
url: this.url, | ||
method: "get", | ||
headers: { | ||
accept: "application/json" | ||
}, | ||
on: { | ||
error: function(response) { | ||
if (_this.url.substring(0, 4) !== 'http') { | ||
return _this.fail('Please specify the protocol for ' + _this.url); | ||
} else if (response.status === 0) { | ||
return _this.fail('Can\'t read from server. It may not have the appropriate access-control-origin settings.'); | ||
} else if (response.status === 404) { | ||
return _this.fail('Can\'t read swagger JSON from ' + _this.url); | ||
} else { | ||
return _this.fail(response.status + ' : ' + response.statusText + ' ' + _this.url); | ||
} | ||
}, | ||
on: { | ||
error: function (response) { | ||
if (_this.url.substring(0, 4) !== 'http') { | ||
return _this.fail('Please specify the protocol for ' + _this.url); | ||
} else if (response.status === 0) { | ||
return _this.fail('Can\'t read from server. It may not have the appropriate access-control-origin settings.'); | ||
} else if (response.status === 404) { | ||
return _this.fail('Can\'t read swagger JSON from ' + _this.url); | ||
} else { | ||
return _this.fail(response.status + ' : ' + response.statusText + ' ' + _this.url); | ||
} | ||
}, | ||
response: function (resp) { | ||
var responseObj = resp.obj || JSON.parse(resp.data); | ||
_this.swaggerVersion = responseObj.swaggerVersion; | ||
if (_this.swaggerVersion === "1.2") { | ||
return _this.buildFromSpec(responseObj); | ||
} else { | ||
return _this.buildFrom1_1Spec(responseObj); | ||
} | ||
response: function(resp) { | ||
var responseObj = resp.obj || JSON.parse(resp.data); | ||
_this.swaggerVersion = responseObj.swaggerVersion; | ||
if (_this.swaggerVersion === "1.2") { | ||
return _this.buildFromSpec(responseObj); | ||
} else { | ||
return _this.buildFrom1_1Spec(responseObj); | ||
} | ||
} | ||
}; | ||
var e = (typeof window !== 'undefined' ? window : exports); | ||
e.authorizations.apply(obj); | ||
new SwaggerHttp().execute(obj); | ||
return this; | ||
} | ||
}; | ||
var e = (typeof window !== 'undefined' ? window : exports); | ||
e.authorizations.apply(obj); | ||
new SwaggerHttp().execute(obj); | ||
return this; | ||
}; | ||
SwaggerApi.prototype.buildFromSpec = function (response) { | ||
if (response.apiVersion != null) { | ||
this.apiVersion = response.apiVersion; | ||
} | ||
this.apis = {}; | ||
this.apisArray = []; | ||
this.consumes = response.consumes; | ||
this.produces = response.produces; | ||
this.authSchemes = response.authorizations; | ||
if (response.info != null) { | ||
this.info = response.info; | ||
} | ||
var isApi = false; | ||
var i; | ||
for (i = 0; i < response.apis.length; i++) { | ||
var api = response.apis[i]; | ||
if (api.operations) { | ||
var j; | ||
for (j = 0; j < api.operations.length; j++) { | ||
operation = api.operations[j]; | ||
isApi = true; | ||
} | ||
SwaggerApi.prototype.buildFromSpec = function(response) { | ||
if (response.apiVersion != null) { | ||
this.apiVersion = response.apiVersion; | ||
} | ||
this.apis = {}; | ||
this.apisArray = []; | ||
this.produces = response.produces; | ||
this.authSchemes = response.authorizations; | ||
if (response.info != null) { | ||
this.info = response.info; | ||
} | ||
var isApi = false; | ||
var i; | ||
for (i = 0; i < response.apis.length; i++) { | ||
var api = response.apis[i]; | ||
if (api.operations) { | ||
var j; | ||
for (j = 0; j < api.operations.length; j++) { | ||
operation = api.operations[j]; | ||
isApi = true; | ||
} | ||
} | ||
if (response.basePath) | ||
this.basePath = response.basePath; | ||
else if (this.url.indexOf('?') > 0) | ||
this.basePath = this.url.substring(0, this.url.lastIndexOf('?')); | ||
else | ||
this.basePath = this.url; | ||
if (isApi) { | ||
var newName = response.resourcePath.replace(/\//g, ''); | ||
this.resourcePath = response.resourcePath; | ||
var res = new SwaggerResource(response, this); | ||
this.apis[newName] = res; | ||
} | ||
if (response.basePath) { | ||
this.basePath = response.basePath; | ||
} else if (this.url.indexOf('?') > 0) { | ||
this.basePath = this.url.substring(0, this.url.lastIndexOf('?')); | ||
} else { | ||
this.basePath = this.url; | ||
} | ||
if (isApi) { | ||
var newName = response.resourcePath.replace(/\//g, ''); | ||
this.resourcePath = response.resourcePath; | ||
res = new SwaggerResource(response, this); | ||
this.apis[newName] = res; | ||
this.apisArray.push(res); | ||
} else { | ||
var k; | ||
for (k = 0; k < response.apis.length; k++) { | ||
var resource = response.apis[k]; | ||
res = new SwaggerResource(resource, this); | ||
this.apis[res.name] = res; | ||
this.apisArray.push(res); | ||
} else { | ||
var k; | ||
for (k = 0; k < response.apis.length; k++) { | ||
var resource = response.apis[k]; | ||
var res = new SwaggerResource(resource, this); | ||
this.apis[res.name] = res; | ||
this.apisArray.push(res); | ||
} | ||
} | ||
this.isValid = true; | ||
if (this.success) { | ||
this.success(); | ||
} | ||
return this; | ||
}; | ||
} | ||
if (this.success) { | ||
this.success(); | ||
} | ||
return this; | ||
}; | ||
SwaggerApi.prototype.buildFrom1_1Spec = function (response) { | ||
log("This API is using a deprecated version of Swagger! Please see http://github.com/wordnik/swagger-core/wiki for more info"); | ||
if (response.apiVersion != null) | ||
this.apiVersion = response.apiVersion; | ||
this.apis = {}; | ||
this.apisArray = []; | ||
this.produces = response.produces; | ||
if (response.info != null) { | ||
this.info = response.info; | ||
} | ||
var isApi = false; | ||
for (var i = 0; i < response.apis.length; i++) { | ||
var api = response.apis[i]; | ||
if (api.operations) { | ||
for (var j = 0; j < api.operations.length; j++) { | ||
operation = api.operations[j]; | ||
isApi = true; | ||
} | ||
SwaggerApi.prototype.buildFrom1_1Spec = function(response) { | ||
log("This API is using a deprecated version of Swagger! Please see http://github.com/wordnik/swagger-core/wiki for more info"); | ||
if (response.apiVersion != null) | ||
this.apiVersion = response.apiVersion; | ||
this.apis = {}; | ||
this.apisArray = []; | ||
this.produces = response.produces; | ||
if (response.info != null) { | ||
this.info = response.info; | ||
} | ||
var isApi = false; | ||
for (var i = 0; i < response.apis.length; i++) { | ||
var api = response.apis[i]; | ||
if (api.operations) { | ||
for (var j = 0; j < api.operations.length; j++) { | ||
operation = api.operations[j]; | ||
isApi = true; | ||
} | ||
} | ||
if (response.basePath) { | ||
this.basePath = response.basePath; | ||
} else if (this.url.indexOf('?') > 0) { | ||
this.basePath = this.url.substring(0, this.url.lastIndexOf('?')); | ||
} else { | ||
this.basePath = this.url; | ||
} | ||
if (isApi) { | ||
var newName = response.resourcePath.replace(/\//g, ''); | ||
this.resourcePath = response.resourcePath; | ||
var res = new SwaggerResource(response, this); | ||
this.apis[newName] = res; | ||
} | ||
if (response.basePath) { | ||
this.basePath = response.basePath; | ||
} else if (this.url.indexOf('?') > 0) { | ||
this.basePath = this.url.substring(0, this.url.lastIndexOf('?')); | ||
} else { | ||
this.basePath = this.url; | ||
} | ||
if (isApi) { | ||
var newName = response.resourcePath.replace(/\//g, ''); | ||
this.resourcePath = response.resourcePath; | ||
var res = new SwaggerResource(response, this); | ||
this.apis[newName] = res; | ||
this.apisArray.push(res); | ||
} else { | ||
for (k = 0; k < response.apis.length; k++) { | ||
resource = response.apis[k]; | ||
res = new SwaggerResource(resource, this); | ||
this.apis[res.name] = res; | ||
this.apisArray.push(res); | ||
} else { | ||
for (k = 0; k < response.apis.length; k++) { | ||
resource = response.apis[k]; | ||
var res = new SwaggerResource(resource, this); | ||
this.apis[res.name] = res; | ||
this.apisArray.push(res); | ||
} | ||
} | ||
this.isValid = true; | ||
if (this.success) { | ||
this.success(); | ||
} | ||
return this; | ||
}; | ||
} | ||
if (this.success) { | ||
this.success(); | ||
} | ||
return this; | ||
}; | ||
SwaggerApi.prototype.selfReflect = function () { | ||
var resource, resource_name, _ref; | ||
if (this.apis == null) { | ||
SwaggerApi.prototype.selfReflect = function() { | ||
var resource, resource_name, _ref; | ||
if (this.apis == null) { | ||
return false; | ||
} | ||
_ref = this.apis; | ||
for (resource_name in _ref) { | ||
resource = _ref[resource_name]; | ||
if (resource.ready == null) { | ||
return false; | ||
} | ||
_ref = this.apis; | ||
for (resource_name in _ref) { | ||
resource = _ref[resource_name]; | ||
if (resource.ready == null) { | ||
return false; | ||
} | ||
} | ||
this.setConsolidatedModels(); | ||
this.ready = true; | ||
if (this.success != null) { | ||
return this.success(); | ||
} | ||
}; | ||
} | ||
this.setConsolidatedModels(); | ||
this.ready = true; | ||
if (this.success != null) { | ||
return this.success(); | ||
} | ||
}; | ||
SwaggerApi.prototype.fail = function (message) { | ||
this.failure(message); | ||
throw message; | ||
}; | ||
SwaggerApi.prototype.fail = function(message) { | ||
this.failure(message); | ||
throw message; | ||
}; | ||
SwaggerApi.prototype.setConsolidatedModels = function () { | ||
var model, modelName, resource, resource_name, _i, _len, _ref, _ref1, _results; | ||
this.models = {}; | ||
_ref = this.apis; | ||
for (resource_name in _ref) { | ||
resource = _ref[resource_name]; | ||
for (modelName in resource.models) { | ||
if (this.models[modelName] == null) { | ||
this.models[modelName] = resource.models[modelName]; | ||
this.modelsArray.push(resource.models[modelName]); | ||
} | ||
SwaggerApi.prototype.setConsolidatedModels = function() { | ||
var model, modelName, resource, resource_name, _i, _len, _ref, _ref1, _results; | ||
this.modelsArray = []; | ||
this.models = {}; | ||
_ref = this.apis; | ||
for (resource_name in _ref) { | ||
resource = _ref[resource_name]; | ||
for (modelName in resource.models) { | ||
if (this.models[modelName] == null) { | ||
this.models[modelName] = resource.models[modelName]; | ||
this.modelsArray.push(resource.models[modelName]); | ||
} | ||
} | ||
_ref1 = this.modelsArray; | ||
_results = []; | ||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { | ||
model = _ref1[_i]; | ||
_results.push(model.setReferencedModels(this.models)); | ||
} | ||
return _results; | ||
}; | ||
} | ||
_ref1 = this.modelsArray; | ||
_results = []; | ||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { | ||
model = _ref1[_i]; | ||
_results.push(model.setReferencedModels(this.models)); | ||
} | ||
return _results; | ||
}; | ||
SwaggerApi.prototype.help = function () { | ||
var operation, operation_name, parameter, resource, resource_name, _i, _len, _ref, _ref1, _ref2; | ||
_ref = this.apis; | ||
for (resource_name in _ref) { | ||
resource = _ref[resource_name]; | ||
log(resource_name); | ||
_ref1 = resource.operations; | ||
for (operation_name in _ref1) { | ||
operation = _ref1[operation_name]; | ||
log(" " + operation.nickname); | ||
_ref2 = operation.parameters; | ||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) { | ||
parameter = _ref2[_i]; | ||
log(" " + parameter.name + (parameter.required ? ' (required)' : '') + " - " + parameter.description); | ||
} | ||
SwaggerApi.prototype.help = function() { | ||
var operation, operation_name, parameter, resource, resource_name, _i, _len, _ref, _ref1, _ref2; | ||
_ref = this.apis; | ||
for (resource_name in _ref) { | ||
resource = _ref[resource_name]; | ||
log(resource_name); | ||
_ref1 = resource.operations; | ||
for (operation_name in _ref1) { | ||
operation = _ref1[operation_name]; | ||
log(" " + operation.nickname); | ||
_ref2 = operation.parameters; | ||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) { | ||
parameter = _ref2[_i]; | ||
log(" " + parameter.name + (parameter.required ? ' (required)' : '') + " - " + parameter.description); | ||
} | ||
} | ||
return this; | ||
}; | ||
} | ||
return this; | ||
}; | ||
var SwaggerResource = function (resourceObj, api) { | ||
var _this = this; | ||
this.api = api; | ||
this.api = this.api; | ||
var consumes = (this.consumes | []); | ||
var produces = (this.produces | []); | ||
this.path = this.api.resourcePath != null ? this.api.resourcePath : resourceObj.path; | ||
this.description = resourceObj.description; | ||
var SwaggerResource = function(resourceObj, api) { | ||
var _this = this; | ||
this.api = api; | ||
this.api = this.api; | ||
produces = []; | ||
consumes = []; | ||
this.path = this.api.resourcePath != null ? this.api.resourcePath : resourceObj.path; | ||
this.description = resourceObj.description; | ||
var parts = this.path.split("/"); | ||
this.name = parts[parts.length - 1].replace('.{format}', ''); | ||
this.basePath = this.api.basePath; | ||
this.operations = {}; | ||
this.operationsArray = []; | ||
this.modelsArray = []; | ||
this.models = {}; | ||
this.rawModels = {}; | ||
this.useJQuery = (typeof api.useJQuery !== 'undefined' ? api.useJQuery : null); | ||
var parts = this.path.split("/"); | ||
this.name = parts[parts.length - 1].replace('.{format}', ''); | ||
this.basePath = this.api.basePath; | ||
this.operations = {}; | ||
this.operationsArray = []; | ||
this.modelsArray = []; | ||
this.models = {}; | ||
this.rawModels = {}; | ||
this.useJQuery = (typeof api.useJQuery !== 'undefined' ? api.useJQuery : null); | ||
if ((resourceObj.apis != null) && (this.api.resourcePath != null)) { | ||
this.addApiDeclaration(resourceObj); | ||
if ((resourceObj.apis != null) && (this.api.resourcePath != null)) { | ||
this.addApiDeclaration(resourceObj); | ||
} else { | ||
if (this.path == null) { | ||
this.api.fail("SwaggerResources must have a path."); | ||
} | ||
if (this.path.substring(0, 4) === 'http') { | ||
this.url = this.path.replace('{format}', 'json'); | ||
} else { | ||
if (this.path == null) { | ||
this.api.fail("SwaggerResources must have a path."); | ||
} | ||
if (this.path.substring(0, 4) === 'http') { | ||
this.url = this.path.replace('{format}', 'json'); | ||
} else { | ||
this.url = this.api.basePath + this.path.replace('{format}', 'json'); | ||
} | ||
this.api.progress('fetching resource ' + this.name + ': ' + this.url); | ||
var obj = { | ||
url: this.url, | ||
method: "get", | ||
useJQuery: this.useJQuery, | ||
headers: { | ||
accept: "application/json,application/json;charset=\"utf-8\",*/*" | ||
this.url = this.api.basePath + this.path.replace('{format}', 'json'); | ||
} | ||
this.api.progress('fetching resource ' + this.name + ': ' + this.url); | ||
obj = { | ||
url: this.url, | ||
method: "get", | ||
useJQuery: this.useJQuery, | ||
headers: { | ||
accept: "application/json" | ||
}, | ||
on: { | ||
response: function(resp) { | ||
var responseObj = resp.obj || JSON.parse(resp.data); | ||
return _this.addApiDeclaration(responseObj); | ||
}, | ||
on: { | ||
response: function (resp) { | ||
var responseObj = resp.obj || JSON.parse(resp.data); | ||
return _this.addApiDeclaration(responseObj); | ||
}, | ||
error: function (response) { | ||
return _this.api.fail("Unable to read api '" + | ||
_this.name + "' from path " + _this.url + " (server returned " + response.statusText + ")"); | ||
} | ||
error: function(response) { | ||
return _this.api.fail("Unable to read api '" + | ||
_this.name + "' from path " + _this.url + " (server returned " + response.statusText + ")"); | ||
} | ||
}; | ||
var e = typeof window !== 'undefined' ? window : exports; | ||
e.authorizations.apply(obj); | ||
new SwaggerHttp().execute(obj); | ||
} | ||
} | ||
}; | ||
var e = typeof window !== 'undefined' ? window : exports; | ||
e.authorizations.apply(obj); | ||
new SwaggerHttp().execute(obj); | ||
} | ||
} | ||
SwaggerResource.prototype.getAbsoluteBasePath = function (relativeBasePath) { | ||
var pos, url; | ||
url = this.api.basePath; | ||
pos = url.lastIndexOf(relativeBasePath); | ||
var parts = url.split("/"); | ||
var rootUrl = parts[0] + "//" + parts[2]; | ||
SwaggerResource.prototype.getAbsoluteBasePath = function (relativeBasePath) { | ||
var pos, url; | ||
url = this.api.basePath; | ||
pos = url.lastIndexOf(relativeBasePath); | ||
var parts = url.split("/"); | ||
var rootUrl = parts[0] + "//" + parts[2]; | ||
if (relativeBasePath.indexOf("http") === 0) | ||
return relativeBasePath; | ||
if (relativeBasePath === "/") | ||
return rootUrl; | ||
if (relativeBasePath.substring(0, 1) == "/") { | ||
// use root + relative | ||
return rootUrl + relativeBasePath; | ||
} | ||
else { | ||
var pos = this.basePath.lastIndexOf("/"); | ||
var base = this.basePath.substring(0, pos); | ||
if (base.substring(base.length - 1) == "/") | ||
return base + relativeBasePath; | ||
else | ||
return base + "/" + relativeBasePath; | ||
} | ||
}; | ||
if(relativeBasePath.indexOf("http") === 0) | ||
return relativeBasePath; | ||
if(relativeBasePath === "/") | ||
return rootUrl; | ||
if(relativeBasePath.substring(0, 1) == "/") { | ||
// use root + relative | ||
return rootUrl + relativeBasePath; | ||
} | ||
else { | ||
var pos = this.basePath.lastIndexOf("/"); | ||
var base = this.basePath.substring(0, pos); | ||
if(base.substring(base.length - 1) == "/") | ||
return base + relativeBasePath; | ||
else | ||
return base + "/" + relativeBasePath; | ||
} | ||
}; | ||
SwaggerResource.prototype.addApiDeclaration = function (response) { | ||
if (response.produces != null) | ||
this.produces = response.produces; | ||
if (response.consumes != null) | ||
this.consumes = response.consumes; | ||
if ((response.basePath != null) && response.basePath.replace(/\s/g, '').length > 0) | ||
this.basePath = response.basePath.indexOf("http") === -1 ? this.getAbsoluteBasePath(response.basePath) : response.basePath; | ||
SwaggerResource.prototype.addApiDeclaration = function(response) { | ||
if (response.produces != null) | ||
this.produces = response.produces; | ||
if (response.consumes != null) | ||
this.consumes = response.consumes; | ||
if ((response.basePath != null) && response.basePath.replace(/\s/g, '').length > 0) | ||
this.basePath = response.basePath.indexOf("http") === -1 ? this.getAbsoluteBasePath(response.basePath) : response.basePath; | ||
this.addModels(response.models); | ||
if (response.apis) { | ||
for (var i = 0 ; i < response.apis.length; i++) { | ||
var endpoint = response.apis[i]; | ||
this.addOperations(endpoint.path, endpoint.operations, response.consumes, response.produces); | ||
} | ||
this.addModels(response.models); | ||
if (response.apis) { | ||
for (var i = 0 ; i < response.apis.length; i++) { | ||
var endpoint = response.apis[i]; | ||
this.addOperations(endpoint.path, endpoint.operations, response.consumes, response.produces); | ||
} | ||
this.api[this.name] = this; | ||
this.ready = true; | ||
return this.api.selfReflect(); | ||
}; | ||
} | ||
this.api[this.name] = this; | ||
this.ready = true; | ||
return this.api.selfReflect(); | ||
}; | ||
SwaggerResource.prototype.addModels = function (models) { | ||
if (models != null) { | ||
var modelName; | ||
for (modelName in models) { | ||
if (this.models[modelName] == null) { | ||
var swaggerModel = new SwaggerModel(modelName, models[modelName]); | ||
this.modelsArray.push(swaggerModel); | ||
this.models[modelName] = swaggerModel; | ||
this.rawModels[modelName] = models[modelName]; | ||
} | ||
SwaggerResource.prototype.addModels = function(models) { | ||
if (models != null) { | ||
var modelName; | ||
for (modelName in models) { | ||
if (this.models[modelName] == null) { | ||
var swaggerModel = new SwaggerModel(modelName, models[modelName]); | ||
this.modelsArray.push(swaggerModel); | ||
this.models[modelName] = swaggerModel; | ||
this.rawModels[modelName] = models[modelName]; | ||
} | ||
var output = []; | ||
for (var i = 0; i < this.modelsArray.length; i++) { | ||
var model = this.modelsArray[i]; | ||
output.push(model.setReferencedModels(this.models)); | ||
} | ||
return output; | ||
} | ||
}; | ||
var output = []; | ||
for (var i = 0; i < this.modelsArray.length; i++) { | ||
model = this.modelsArray[i]; | ||
output.push(model.setReferencedModels(this.models)); | ||
} | ||
return output; | ||
} | ||
}; | ||
SwaggerResource.prototype.addOperations = function (resource_path, ops, consumes, produces) { | ||
if (ops) { | ||
var output = []; | ||
for (var i = 0; i < ops.length; i++) { | ||
var o = ops[i]; | ||
SwaggerResource.prototype.addOperations = function(resource_path, ops, consumes, produces) { | ||
if (ops) { | ||
output = []; | ||
for (var i = 0; i < ops.length; i++) { | ||
o = ops[i]; | ||
consumes = this.consumes; | ||
produces = this.produces; | ||
if (o.consumes != null) | ||
consumes = o.consumes; | ||
else | ||
consumes = this.consumes; | ||
if (o.produces != null) | ||
produces = o.produces; | ||
else | ||
produces = this.produces; | ||
if (o.consumes != null) | ||
consumes = o.consumes; | ||
else | ||
consumes = this.consumes; | ||
type = (o.type||o.responseClass); | ||
if (o.produces != null) | ||
produces = o.produces; | ||
else | ||
produces = this.produces; | ||
var type = (o.type || o.responseClass); | ||
if (type === "array") { | ||
ref = null; | ||
if (o.items) | ||
ref = o.items["type"] || o.items["$ref"]; | ||
type = "array[" + ref + "]"; | ||
if (type === "array") { | ||
ref = null; | ||
if (o.items) | ||
ref = o.items["type"] || o.items["$ref"]; | ||
type = "array[" + ref + "]"; | ||
} | ||
responseMessages = o.responseMessages; | ||
method = o.method; | ||
if (o.httpMethod) { | ||
method = o.httpMethod; | ||
} | ||
if (o.supportedContentTypes) { | ||
consumes = o.supportedContentTypes; | ||
} | ||
if (o.errorResponses) { | ||
responseMessages = o.errorResponses; | ||
for (var j = 0; j < responseMessages.length; j++) { | ||
r = responseMessages[j]; | ||
r.message = r.reason; | ||
r.reason = null; | ||
} | ||
var responseMessages = o.responseMessages; | ||
var method = o.method; | ||
if (o.httpMethod) { | ||
method = o.httpMethod; | ||
} | ||
if (o.supportedContentTypes) { | ||
consumes = o.supportedContentTypes; | ||
} | ||
if (o.errorResponses) { | ||
responseMessages = o.errorResponses; | ||
for (var j = 0; j < responseMessages.length; j++) { | ||
r = responseMessages[j]; | ||
r.message = r.reason; | ||
r.reason = null; | ||
} | ||
} | ||
o.nickname = this.sanitize(o.nickname); | ||
var op = new SwaggerOperation(o.nickname, resource_path, method, o.parameters, o.summary, o.notes, type, responseMessages, this, consumes, produces, o.authorizations); | ||
this.operations[op.nickname] = op; | ||
output.push(this.operationsArray.push(op)); | ||
} | ||
return output; | ||
o.nickname = this.sanitize(o.nickname); | ||
op = new SwaggerOperation(o.nickname, resource_path, method, o.parameters, o.summary, o.notes, type, responseMessages, this, consumes, produces, o.authorizations); | ||
this.operations[op.nickname] = op; | ||
output.push(this.operationsArray.push(op)); | ||
} | ||
}; | ||
return output; | ||
} | ||
}; | ||
SwaggerResource.prototype.sanitize = function (nickname) { | ||
var op; | ||
op = nickname.replace(/[\s!@#$%^&*()_+=\[{\]};:<>|.\/?,\\'""-]/g, '_'); | ||
op = op.replace(/((_){2,})/g, '_'); | ||
op = op.replace(/^(_)*/g, ''); | ||
op = op.replace(/([_])*$/g, ''); | ||
return op; | ||
}; | ||
SwaggerResource.prototype.sanitize = function(nickname) { | ||
var op; | ||
op = nickname.replace(/[\s!@#$%^&*()_+=\[{\]};:<>|.\/?,\\'""-]/g, '_'); | ||
op = op.replace(/((_){2,})/g, '_'); | ||
op = op.replace(/^(_)*/g, ''); | ||
op = op.replace(/([_])*$/g, ''); | ||
return op; | ||
}; | ||
SwaggerResource.prototype.help = function () { | ||
var op = this.operations; | ||
var output = []; | ||
var operation_name; | ||
for (operation_name in op) { | ||
operation = op[operation_name]; | ||
var msg = " " + operation.nickname; | ||
for (var i = 0; i < operation.parameters; i++) { | ||
parameter = operation.parameters[i]; | ||
msg.concat(" " + parameter.name + (parameter.required ? ' (required)' : '') + " - " + parameter.description); | ||
} | ||
output.push(msg); | ||
SwaggerResource.prototype.help = function() { | ||
var op = this.operations; | ||
var output = []; | ||
var operation_name; | ||
for (operation_name in op) { | ||
operation = op[operation_name]; | ||
var msg = " " + operation.nickname; | ||
for (var i = 0; i < operation.parameters; i++) { | ||
parameter = operation.parameters[i]; | ||
msg.concat(" " + parameter.name + (parameter.required ? ' (required)' : '') + " - " + parameter.description); | ||
} | ||
return output; | ||
}; | ||
output.push(msg); | ||
} | ||
return output; | ||
}; | ||
var SwaggerModel = function (modelName, obj) { | ||
this.name = obj.id != null ? obj.id : modelName; | ||
this.properties = []; | ||
var propertyName; | ||
for (propertyName in obj.properties) { | ||
if (obj.required != null) { | ||
var value; | ||
for (value in obj.required) { | ||
if (propertyName === obj.required[value]) { | ||
obj.properties[propertyName].required = true; | ||
} | ||
var SwaggerModel = function(modelName, obj) { | ||
this.name = obj.id != null ? obj.id : modelName; | ||
this.properties = []; | ||
var propertyName; | ||
for (propertyName in obj.properties) { | ||
if (obj.required != null) { | ||
var value; | ||
for (value in obj.required) { | ||
if (propertyName === obj.required[value]) { | ||
obj.properties[propertyName].required = true; | ||
} | ||
} | ||
var prop = new SwaggerModelProperty(propertyName, obj.properties[propertyName]); | ||
this.properties.push(prop); | ||
} | ||
prop = new SwaggerModelProperty(propertyName, obj.properties[propertyName]); | ||
this.properties.push(prop); | ||
} | ||
} | ||
SwaggerModel.prototype.setReferencedModels = function (allModels) { | ||
var results = []; | ||
for (var i = 0; i < this.properties.length; i++) { | ||
var property = this.properties[i]; | ||
var type = property.type || property.dataType; | ||
if (allModels[type] != null) | ||
results.push(property.refModel = allModels[type]); | ||
else if ((property.refDataType != null) && (allModels[property.refDataType] != null)) | ||
results.push(property.refModel = allModels[property.refDataType]); | ||
else | ||
results.push(void 0); | ||
} | ||
return results; | ||
}; | ||
SwaggerModel.prototype.setReferencedModels = function(allModels) { | ||
var results = []; | ||
for (var i = 0; i < this.properties.length; i++) { | ||
var property = this.properties[i]; | ||
var type = property.type || property.dataType; | ||
if (allModels[type] != null) | ||
results.push(property.refModel = allModels[type]); | ||
else if ((property.refDataType != null) && (allModels[property.refDataType] != null)) | ||
results.push(property.refModel = allModels[property.refDataType]); | ||
else | ||
results.push(void 0); | ||
} | ||
return results; | ||
}; | ||
SwaggerModel.prototype.getMockSignature = function (modelsToIgnore) { | ||
var propertiesStr = []; | ||
for (var i = 0; i < this.properties.length; i++) { | ||
var prop = this.properties[i]; | ||
propertiesStr.push(prop.toString()); | ||
SwaggerModel.prototype.getMockSignature = function(modelsToIgnore) { | ||
var propertiesStr = []; | ||
for (var i = 0; i < this.properties.length; i++) { | ||
prop = this.properties[i]; | ||
propertiesStr.push(prop.toString()); | ||
} | ||
var strong = '<span class="strong">'; | ||
var stronger = '<span class="stronger">'; | ||
var strongClose = '</span>'; | ||
var classOpen = strong + this.name + ' {' + strongClose; | ||
var classClose = strong + '}' + strongClose; | ||
var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose; | ||
if (!modelsToIgnore) | ||
modelsToIgnore = []; | ||
modelsToIgnore.push(this.name); | ||
for (var i = 0; i < this.properties.length; i++) { | ||
prop = this.properties[i]; | ||
if ((prop.refModel != null) && modelsToIgnore.indexOf(prop.refModel.name) === -1) { | ||
returnVal = returnVal + ('<br>' + prop.refModel.getMockSignature(modelsToIgnore)); | ||
} | ||
} | ||
return returnVal; | ||
}; | ||
var strong = '<span class="strong">'; | ||
var stronger = '<span class="stronger">'; | ||
var strongClose = '</span>'; | ||
var classOpen = strong + this.name + ' {' + strongClose; | ||
var classClose = strong + '}' + strongClose; | ||
var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose; | ||
if (!modelsToIgnore) | ||
modelsToIgnore = []; | ||
SwaggerModel.prototype.createJSONSample = function(modelsToIgnore) { | ||
if(sampleModels[this.name]) { | ||
return sampleModels[this.name]; | ||
} | ||
else { | ||
var result = {}; | ||
var modelsToIgnore = (modelsToIgnore||[]) | ||
modelsToIgnore.push(this.name); | ||
for (var i = 0; i < this.properties.length; i++) { | ||
var prop = this.properties[i]; | ||
if ((prop.refModel != null) && modelsToIgnore.indexOf(prop.refModel.name) === -1) { | ||
returnVal = returnVal + ('<br>' + prop.refModel.getMockSignature(modelsToIgnore)); | ||
} | ||
prop = this.properties[i]; | ||
result[prop.name] = prop.getSampleValue(modelsToIgnore); | ||
} | ||
return returnVal; | ||
}; | ||
modelsToIgnore.pop(this.name); | ||
return result; | ||
} | ||
}; | ||
SwaggerModel.prototype.createJSONSample = function (modelsToIgnore) { | ||
if (sampleModels[this.name]) { | ||
return sampleModels[this.name]; | ||
var SwaggerModelProperty = function(name, obj) { | ||
this.name = name; | ||
this.dataType = obj.type || obj.dataType || obj["$ref"]; | ||
this.isCollection = this.dataType && (this.dataType.toLowerCase() === 'array' || this.dataType.toLowerCase() === 'list' || this.dataType.toLowerCase() === 'set'); | ||
this.descr = obj.description; | ||
this.required = obj.required; | ||
if (obj.items != null) { | ||
if (obj.items.type != null) { | ||
this.refDataType = obj.items.type; | ||
} | ||
else { | ||
var result = {}; | ||
var modelsToIgnore = (modelsToIgnore || []) | ||
modelsToIgnore.push(this.name); | ||
for (var i = 0; i < this.properties.length; i++) { | ||
var prop = this.properties[i]; | ||
result[prop.name] = prop.getSampleValue(modelsToIgnore); | ||
} | ||
modelsToIgnore.pop(this.name); | ||
return result; | ||
if (obj.items.$ref != null) { | ||
this.refDataType = obj.items.$ref; | ||
} | ||
}; | ||
var SwaggerModelProperty = function (name, obj) { | ||
this.name = name; | ||
this.dataType = obj.type || obj.dataType || obj["$ref"]; | ||
this.isCollection = this.dataType && (this.dataType.toLowerCase() === 'array' || this.dataType.toLowerCase() === 'list' || this.dataType.toLowerCase() === 'set'); | ||
this.descr = obj.description; | ||
this.required = obj.required; | ||
this.defaultValue = modelPropertyMacro(obj.defaultValue); | ||
if (obj.items != null) { | ||
if (obj.items.type != null) { | ||
this.refDataType = obj.items.type; | ||
} | ||
if (obj.items.$ref != null) { | ||
this.refDataType = obj.items.$ref; | ||
} | ||
} | ||
this.dataTypeWithRef = this.refDataType != null ? (this.dataType + '[' + this.refDataType + ']') : this.dataType; | ||
if (obj.allowableValues != null) { | ||
this.valueType = obj.allowableValues.valueType; | ||
this.values = obj.allowableValues.values; | ||
if (this.values != null) { | ||
this.valuesString = "'" + this.values.join("' or '") + "'"; | ||
} | ||
this.dataTypeWithRef = this.refDataType != null ? (this.dataType + '[' + this.refDataType + ']') : this.dataType; | ||
if (obj.allowableValues != null) { | ||
this.valueType = obj.allowableValues.valueType; | ||
this.values = obj.allowableValues.values; | ||
if (this.values != null) { | ||
this.valuesString = "'" + this.values.join("' or '") + "'"; | ||
} | ||
} | ||
if (obj["enum"] != null) { | ||
this.valueType = "string"; | ||
this.values = obj["enum"]; | ||
if (this.values != null) { | ||
this.valueString = "'" + this.values.join("' or '") + "'"; | ||
} | ||
if (obj["enum"] != null) { | ||
this.valueType = "string"; | ||
this.values = obj["enum"]; | ||
if (this.values != null) { | ||
this.valueString = "'" + this.values.join("' or '") + "'"; | ||
} | ||
} | ||
} | ||
} | ||
SwaggerModelProperty.prototype.getSampleValue = function (modelsToIgnore) { | ||
var result; | ||
if ((this.refModel != null) && (modelsToIgnore.indexOf(this.refModel.name) === -1)) { | ||
result = this.refModel.createJSONSample(modelsToIgnore); | ||
} else { | ||
if (this.isCollection) { | ||
result = this.toSampleValue(this.refDataType); | ||
} else { | ||
result = this.toSampleValue(this.dataType); | ||
} | ||
} | ||
SwaggerModelProperty.prototype.getSampleValue = function(modelsToIgnore) { | ||
var result; | ||
if ((this.refModel != null) && (modelsToIgnore.indexOf(prop.refModel.name) === -1)) { | ||
result = this.refModel.createJSONSample(modelsToIgnore); | ||
} else { | ||
if (this.isCollection) { | ||
return [result]; | ||
result = this.toSampleValue(this.refDataType); | ||
} else { | ||
return result; | ||
result = this.toSampleValue(this.dataType); | ||
} | ||
}; | ||
SwaggerModelProperty.prototype.toSampleValue = function (value) { | ||
var result; | ||
if ((typeof this.defaultValue !== 'undefined') && this.defaultValue !== null) { | ||
result = this.defaultValue; | ||
} else if (value === "integer") { | ||
result = 0; | ||
} else if (value === "boolean") { | ||
result = false; | ||
} else if (value === "double" || value === "number") { | ||
result = 0.0; | ||
} else if (value === "string") { | ||
result = ""; | ||
} else { | ||
result = value; | ||
} | ||
} | ||
if (this.isCollection) { | ||
return [result]; | ||
} else { | ||
return result; | ||
}; | ||
} | ||
}; | ||
SwaggerModelProperty.prototype.toString = function () { | ||
var req = this.required ? 'propReq' : 'propOpt'; | ||
var str = '<span class="propName ' + req + '">' + this.name + '</span> (<span class="propType">' + this.dataTypeWithRef + '</span>'; | ||
if (!this.required) { | ||
str += ', <span class="propOptKey">optional</span>'; | ||
} | ||
str += ')'; | ||
if (this.values != null) { | ||
str += " = <span class='propVals'>['" + this.values.join("' or '") + "']</span>"; | ||
} | ||
if (this.descr != null) { | ||
str += ': <span class="propDesc">' + this.descr + '</span>'; | ||
} | ||
return str; | ||
}; | ||
SwaggerModelProperty.prototype.toSampleValue = function(value) { | ||
var result; | ||
if (value === "integer") { | ||
result = 0; | ||
} else if (value === "boolean") { | ||
result = false; | ||
} else if (value === "double" || value === "number") { | ||
result = 0.0; | ||
} else if (value === "string") { | ||
result = ""; | ||
} else { | ||
result = value; | ||
} | ||
return result; | ||
}; | ||
var SwaggerOperation = function (nickname, path, method, parameters, summary, notes, type, responseMessages, resource, consumes, produces, authorizations) { | ||
var _this = this; | ||
SwaggerModelProperty.prototype.toString = function() { | ||
var req = this.required ? 'propReq' : 'propOpt'; | ||
var str = '<span class="propName ' + req + '">' + this.name + '</span> (<span class="propType">' + this.dataTypeWithRef + '</span>'; | ||
if (!this.required) { | ||
str += ', <span class="propOptKey">optional</span>'; | ||
} | ||
str += ')'; | ||
if (this.values != null) { | ||
str += " = <span class='propVals'>['" + this.values.join("' or '") + "']</span>"; | ||
} | ||
if (this.descr != null) { | ||
str += ': <span class="propDesc">' + this.descr + '</span>'; | ||
} | ||
return str; | ||
}; | ||
var errors = []; | ||
this.nickname = (nickname || errors.push("SwaggerOperations must have a nickname.")); | ||
this.path = (path || errors.push("SwaggerOperation " + nickname + " is missing path.")); | ||
this.method = (method || errors.push("SwaggerOperation " + nickname + " is missing method.")); | ||
this.parameters = parameters != null ? parameters : []; | ||
this.summary = summary; | ||
this.notes = notes; | ||
this.type = type; | ||
this.responseMessages = (responseMessages || []); | ||
this.resource = (resource || errors.push("Resource is required")); | ||
this.consumes = consumes; | ||
this.produces = produces; | ||
this.authorizations = authorizations; | ||
this["do"] = __bind(this["do"], this); | ||
var SwaggerOperation = function(nickname, path, method, parameters, summary, notes, type, responseMessages, resource, consumes, produces, authorizations) { | ||
var _this = this; | ||
if (errors.length > 0) { | ||
console.error('SwaggerOperation errors', errors, arguments); | ||
this.resource.api.fail(errors); | ||
} | ||
var errors = []; | ||
this.nickname = (nickname||errors.push("SwaggerOperations must have a nickname.")); | ||
this.path = (path||errors.push("SwaggerOperation " + nickname + " is missing path.")); | ||
this.method = (method||errors.push("SwaggerOperation " + nickname + " is missing method.")); | ||
this.parameters = parameters != null ? parameters : []; | ||
this.summary = summary; | ||
this.notes = notes; | ||
this.type = type; | ||
this.responseMessages = (responseMessages||[]); | ||
this.resource = (resource||errors.push("Resource is required")); | ||
this.consumes = consumes; | ||
this.produces = produces; | ||
this.authorizations = authorizations; | ||
this["do"] = __bind(this["do"], this); | ||
this.path = this.path.replace('{format}', 'json'); | ||
this.method = this.method.toLowerCase(); | ||
this.isGetMethod = this.method === "get"; | ||
if (errors.length > 0) | ||
this.resource.api.fail(errors); | ||
this.resourceName = this.resource.name; | ||
if (typeof this.type !== 'undefined' && this.type === 'void') | ||
this.type = null; | ||
else { | ||
this.responseClassSignature = this.getSignature(this.type, this.resource.models); | ||
this.responseSampleJSON = this.getSampleJSON(this.type, this.resource.models); | ||
this.path = this.path.replace('{format}', 'json'); | ||
this.method = this.method.toLowerCase(); | ||
this.isGetMethod = this.method === "get"; | ||
this.resourceName = this.resource.name; | ||
if(typeof this.type !== 'undefined' && this.type === 'void') | ||
this.type = null; | ||
else { | ||
this.responseClassSignature = this.getSignature(this.type, this.resource.models); | ||
this.responseSampleJSON = this.getSampleJSON(this.type, this.resource.models); | ||
} | ||
for(var i = 0; i < this.parameters.length; i ++) { | ||
var param = this.parameters[i]; | ||
// might take this away | ||
param.name = param.name || param.type || param.dataType; | ||
// for 1.1 compatibility | ||
var type = param.type || param.dataType; | ||
if(type === 'array') { | ||
type = 'array[' + (param.items.$ref ? param.items.$ref : param.items.type) + ']'; | ||
} | ||
param.type = type; | ||
for (var i = 0; i < this.parameters.length; i++) { | ||
var param = this.parameters[i]; | ||
// might take this away | ||
param.name = param.name || param.type || param.dataType; | ||
if(type.toLowerCase() === 'boolean') { | ||
param.allowableValues = {}; | ||
param.allowableValues.values = ["true", "false"]; | ||
} | ||
param.signature = this.getSignature(type, this.resource.models); | ||
param.sampleJSON = this.getSampleJSON(type, this.resource.models); | ||
// for 1.1 compatibility | ||
var type = param.type || param.dataType; | ||
if (type === 'array') { | ||
type = 'array[' + (param.items.$ref ? param.items.$ref : param.items.type) + ']'; | ||
} | ||
param.type = type; | ||
var enumValue = param["enum"]; | ||
if(enumValue != null) { | ||
param.isList = true; | ||
param.allowableValues = {}; | ||
param.allowableValues.descriptiveValues = []; | ||
if (type.toLowerCase() === 'boolean') { | ||
param.allowableValues = {}; | ||
param.allowableValues.values = ["true", "false"]; | ||
for(var j = 0; j < enumValue.length; j++) { | ||
var v = enumValue[j]; | ||
if(param.defaultValue != null) { | ||
param.allowableValues.descriptiveValues.push ({ | ||
value: String(v), | ||
isDefault: (v === param.defaultValue) | ||
}); | ||
} | ||
else { | ||
param.allowableValues.descriptiveValues.push ({ | ||
value: String(v), | ||
isDefault: false | ||
}); | ||
} | ||
} | ||
param.signature = this.getSignature(type, this.resource.models); | ||
param.sampleJSON = this.getSampleJSON(type, this.resource.models); | ||
var enumValue = param["enum"]; | ||
if (enumValue != null) { | ||
} | ||
else if(param.allowableValues != null) { | ||
if(param.allowableValues.valueType === "RANGE") | ||
param.isRange = true; | ||
else | ||
param.isList = true; | ||
param.allowableValues = {}; | ||
if(param.allowableValues != null) { | ||
param.allowableValues.descriptiveValues = []; | ||
for (var j = 0; j < enumValue.length; j++) { | ||
var v = enumValue[j]; | ||
if (param.defaultValue != null) { | ||
param.allowableValues.descriptiveValues.push({ | ||
value: String(v), | ||
isDefault: (v === param.defaultValue) | ||
}); | ||
} | ||
else { | ||
param.allowableValues.descriptiveValues.push({ | ||
value: String(v), | ||
isDefault: false | ||
}); | ||
} | ||
} | ||
} | ||
else if (param.allowableValues != null) { | ||
if (param.allowableValues.valueType === "RANGE") | ||
param.isRange = true; | ||
else | ||
param.isList = true; | ||
if (param.allowableValues != null) { | ||
param.allowableValues.descriptiveValues = []; | ||
if (param.allowableValues.values) { | ||
for (var j = 0; j < param.allowableValues.values.length; j++) { | ||
var v = param.allowableValues.values[j]; | ||
if (param.defaultValue != null) { | ||
param.allowableValues.descriptiveValues.push({ | ||
value: String(v), | ||
isDefault: (v === param.defaultValue) | ||
}); | ||
} | ||
else { | ||
param.allowableValues.descriptiveValues.push({ | ||
value: String(v), | ||
isDefault: false | ||
}); | ||
} | ||
if(param.allowableValues.values) { | ||
for(var j = 0; j < param.allowableValues.values.length; j++){ | ||
var v = param.allowableValues.values[j]; | ||
if(param.defaultValue != null) { | ||
param.allowableValues.descriptiveValues.push ({ | ||
value: String(v), | ||
isDefault: (v === param.defaultValue) | ||
}); | ||
} | ||
else { | ||
param.allowableValues.descriptiveValues.push ({ | ||
value: String(v), | ||
isDefault: false | ||
}); | ||
} | ||
} | ||
} | ||
} | ||
param.defaultValue = parameterMacro(param.defaultValue); | ||
} | ||
this.resource[this.nickname] = function (args, callback, error) { | ||
return _this["do"](args, callback, error); | ||
}; | ||
this.resource[this.nickname].help = function () { | ||
return _this.help(); | ||
}; | ||
} | ||
SwaggerOperation.prototype.isListType = function (type) { | ||
if (type && type.indexOf('[') >= 0) { | ||
return type.substring(type.indexOf('[') + 1, type.indexOf(']')); | ||
} else { | ||
return void 0; | ||
} | ||
this.resource[this.nickname] = function(args, callback, error) { | ||
return _this["do"](args, callback, error); | ||
}; | ||
this.resource[this.nickname].help = function() { | ||
return _this.help(); | ||
}; | ||
} | ||
SwaggerOperation.prototype.getSignature = function (type, models) { | ||
var isPrimitive, listType; | ||
listType = this.isListType(type); | ||
isPrimitive = ((listType != null) && models[listType]) || (models[type] != null) ? false : true; | ||
if (isPrimitive) { | ||
return type; | ||
SwaggerOperation.prototype.isListType = function(type) { | ||
if (type && type.indexOf('[') >= 0) { | ||
return type.substring(type.indexOf('[') + 1, type.indexOf(']')); | ||
} else { | ||
return void 0; | ||
} | ||
}; | ||
SwaggerOperation.prototype.getSignature = function(type, models) { | ||
var isPrimitive, listType; | ||
listType = this.isListType(type); | ||
isPrimitive = ((listType != null) && models[listType]) || (models[type] != null) ? false : true; | ||
if (isPrimitive) { | ||
return type; | ||
} else { | ||
if (listType != null) { | ||
return models[listType].getMockSignature(); | ||
} else { | ||
if (listType != null) { | ||
return models[listType].getMockSignature(); | ||
} else { | ||
return models[type].getMockSignature(); | ||
} | ||
return models[type].getMockSignature(); | ||
} | ||
}; | ||
} | ||
}; | ||
SwaggerOperation.prototype.getSampleJSON = function (type, models) { | ||
var isPrimitive, listType, val; | ||
listType = this.isListType(type); | ||
isPrimitive = ((listType != null) && models[listType]) || (models[type] != null) ? false : true; | ||
val = isPrimitive ? void 0 : (listType != null ? models[listType].createJSONSample() : models[type].createJSONSample()); | ||
if (val) { | ||
val = listType ? [val] : val; | ||
if (typeof val == "string") | ||
return val; | ||
else if (typeof val === "object") { | ||
var t = val; | ||
if (val instanceof Array && val.length > 0) { | ||
t = val[0]; | ||
} | ||
if (t.nodeName) { | ||
var xmlString = new XMLSerializer().serializeToString(t); | ||
return this.formatXml(xmlString); | ||
} | ||
else | ||
return JSON.stringify(val, null, 2); | ||
SwaggerOperation.prototype.getSampleJSON = function(type, models) { | ||
var isPrimitive, listType, val; | ||
listType = this.isListType(type); | ||
isPrimitive = ((listType != null) && models[listType]) || (models[type] != null) ? false : true; | ||
val = isPrimitive ? void 0 : (listType != null ? models[listType].createJSONSample() : models[type].createJSONSample()); | ||
if (val) { | ||
val = listType ? [val] : val; | ||
if(typeof val == "string") | ||
return val; | ||
else if(typeof val === "object") { | ||
var t = val; | ||
if(val instanceof Array && val.length > 0) { | ||
t = val[0]; | ||
} | ||
if(t.nodeName) { | ||
var xmlString = new XMLSerializer().serializeToString(t); | ||
return this.formatXml(xmlString); | ||
} | ||
else | ||
return val; | ||
return JSON.stringify(val, null, 2); | ||
} | ||
}; | ||
else | ||
return val; | ||
} | ||
}; | ||
SwaggerOperation.prototype["do"] = function (args, opts, callback, error) { | ||
var key, param, params, possibleParams, req, requestContentType, responseContentType, value, _i, _len, _ref; | ||
if (args == null) { | ||
args = {}; | ||
} | ||
if (opts == null) { | ||
opts = {}; | ||
} | ||
requestContentType = null; | ||
responseContentType = null; | ||
if ((typeof args) === "function") { | ||
error = opts; | ||
callback = args; | ||
args = {}; | ||
} | ||
if ((typeof opts) === "function") { | ||
error = callback; | ||
callback = opts; | ||
} | ||
if (error == null) { | ||
error = function (xhr, textStatus, error) { | ||
return log(xhr, textStatus, error); | ||
}; | ||
} | ||
if (callback == null) { | ||
callback = function (response) { | ||
var content; | ||
content = null; | ||
if (response != null) { | ||
content = response.data; | ||
} else { | ||
content = "no data"; | ||
} | ||
return log("default callback: " + content); | ||
}; | ||
} | ||
params = {}; | ||
params.headers = []; | ||
if (args.headers != null) { | ||
params.headers = args.headers; | ||
delete args.headers; | ||
} | ||
var possibleParams = []; | ||
for (var i = 0; i < this.parameters.length; i++) { | ||
var param = this.parameters[i]; | ||
if (param.paramType === 'header') { | ||
if (args[param.name]) | ||
params.headers[param.name] = args[param.name]; | ||
SwaggerOperation.prototype["do"] = function(args, opts, callback, error) { | ||
var key, param, params, possibleParams, req, requestContentType, responseContentType, value, _i, _len, _ref; | ||
if (args == null) { | ||
args = {}; | ||
} | ||
if (opts == null) { | ||
opts = {}; | ||
} | ||
requestContentType = null; | ||
responseContentType = null; | ||
if ((typeof args) === "function") { | ||
error = opts; | ||
callback = args; | ||
args = {}; | ||
} | ||
if ((typeof opts) === "function") { | ||
error = callback; | ||
callback = opts; | ||
} | ||
if (error == null) { | ||
error = function(xhr, textStatus, error) { | ||
return log(xhr, textStatus, error); | ||
}; | ||
} | ||
if (callback == null) { | ||
callback = function(response) { | ||
var content; | ||
content = null; | ||
if (response != null) { | ||
content = response.data; | ||
} else { | ||
content = "no data"; | ||
} | ||
else if (param.paramType === 'form' || param.paramType.toLowerCase() === 'file') | ||
possibleParams.push(param); | ||
} | ||
return log("default callback: " + content); | ||
}; | ||
} | ||
params = {}; | ||
params.headers = []; | ||
if (args.headers != null) { | ||
params.headers = args.headers; | ||
delete args.headers; | ||
} | ||
if (args.body != null) { | ||
params.body = args.body; | ||
delete args.body; | ||
var possibleParams = []; | ||
for(var i = 0; i < this.parameters.length; i++) { | ||
var param = this.parameters[i]; | ||
if(param.paramType === 'header') { | ||
if(args[param.name]) | ||
params.headers[param.name] = args[param.name]; | ||
} | ||
else if(param.paramType === 'form' || param.paramType.toLowerCase() === 'file') | ||
possibleParams.push(param); | ||
} | ||
if (possibleParams) { | ||
var key; | ||
for (key in possibleParams) { | ||
var value = possibleParams[key]; | ||
if (args[value.name]) { | ||
params[value.name] = args[value.name]; | ||
} | ||
if (args.body != null) { | ||
params.body = args.body; | ||
delete args.body; | ||
} | ||
if (possibleParams) { | ||
var key; | ||
for (key in possibleParams) { | ||
value = possibleParams[key]; | ||
if (args[value.name]) { | ||
params[value.name] = args[value.name]; | ||
} | ||
} | ||
} | ||
req = new SwaggerRequest(this.method, this.urlify(args), params, opts, callback, error, this); | ||
if (opts.mock != null) { | ||
return req; | ||
} else { | ||
return true; | ||
} | ||
}; | ||
req = new SwaggerRequest(this.method, this.urlify(args), params, opts, callback, error, this); | ||
if (opts.mock != null) { | ||
return req; | ||
} else { | ||
return true; | ||
} | ||
}; | ||
SwaggerOperation.prototype.pathJson = function () { | ||
return this.path.replace("{format}", "json"); | ||
}; | ||
SwaggerOperation.prototype.pathJson = function() { | ||
return this.path.replace("{format}", "json"); | ||
}; | ||
SwaggerOperation.prototype.pathXml = function () { | ||
return this.path.replace("{format}", "xml"); | ||
}; | ||
SwaggerOperation.prototype.pathXml = function() { | ||
return this.path.replace("{format}", "xml"); | ||
}; | ||
SwaggerOperation.prototype.encodePathParam = function (pathParam) { | ||
var encParts, part, parts, _i, _len; | ||
pathParam = pathParam.toString(); | ||
if (pathParam.indexOf("/") === -1) { | ||
return encodeURIComponent(pathParam); | ||
} else { | ||
parts = pathParam.split("/"); | ||
encParts = []; | ||
for (_i = 0, _len = parts.length; _i < _len; _i++) { | ||
part = parts[_i]; | ||
encParts.push(encodeURIComponent(part)); | ||
} | ||
return encParts.join("/"); | ||
SwaggerOperation.prototype.encodePathParam = function(pathParam) { | ||
var encParts, part, parts, _i, _len; | ||
pathParam = pathParam.toString(); | ||
if (pathParam.indexOf("/") === -1) { | ||
return encodeURIComponent(pathParam); | ||
} else { | ||
parts = pathParam.split("/"); | ||
encParts = []; | ||
for (_i = 0, _len = parts.length; _i < _len; _i++) { | ||
part = parts[_i]; | ||
encParts.push(encodeURIComponent(part)); | ||
} | ||
}; | ||
return encParts.join("/"); | ||
} | ||
}; | ||
SwaggerOperation.prototype.urlify = function (args) { | ||
var url = this.resource.basePath + this.pathJson(); | ||
var params = this.parameters; | ||
for (var i = 0; i < params.length; i++) { | ||
var param = params[i]; | ||
if (param.paramType === 'path') { | ||
if (args[param.name]) { | ||
// apply path params and remove from args | ||
var reg = new RegExp('\\{\\s*?' + param.name + '.*?\\}(?=\\s*?(\\/|$))', 'gi'); | ||
url = url.replace(reg, this.encodePathParam(args[param.name])); | ||
delete args[param.name]; | ||
} | ||
else | ||
throw "" + param.name + " is a required path param."; | ||
SwaggerOperation.prototype.urlify = function(args) { | ||
var url = this.resource.basePath + this.pathJson(); | ||
var params = this.parameters; | ||
for(var i = 0; i < params.length; i ++){ | ||
var param = params[i]; | ||
if (param.paramType === 'path') { | ||
if(args[param.name]) { | ||
// apply path params and remove from args | ||
var reg = new RegExp('\{' + param.name + '[^\}]*\}', 'gi'); | ||
url = url.replace(reg, this.encodePathParam(args[param.name])); | ||
delete args[param.name]; | ||
} | ||
else | ||
throw "" + param.name + " is a required path param."; | ||
} | ||
} | ||
var queryParams = ""; | ||
for (var i = 0; i < params.length; i++) { | ||
var param = params[i]; | ||
if (param.paramType === 'query') { | ||
if (args[param.name] !== undefined) { | ||
var value = args[param.name]; | ||
if (queryParams !== '') | ||
queryParams += '&'; | ||
if (Array.isArray(value)) { | ||
var j; | ||
var output = ''; | ||
for(j = 0; j < value.length; j++) { | ||
if(j > 0) | ||
output += ','; | ||
output += encodeURIComponent(value[j]); | ||
} | ||
queryParams += encodeURIComponent(param.name) + '=' + output; | ||
} | ||
else { | ||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]); | ||
} | ||
} | ||
var queryParams = ""; | ||
for(var i = 0; i < params.length; i ++){ | ||
var param = params[i]; | ||
if(param.paramType === 'query') { | ||
if (args[param.name] !== undefined) { | ||
if (queryParams !== '') | ||
queryParams += "&"; | ||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]); | ||
} | ||
} | ||
if ((queryParams != null) && queryParams.length > 0) | ||
url += '?' + queryParams; | ||
return url; | ||
}; | ||
} | ||
if ((queryParams != null) && queryParams.length > 0) | ||
url += '?' + queryParams; | ||
return url; | ||
}; | ||
SwaggerOperation.prototype.supportHeaderParams = function () { | ||
return this.resource.api.supportHeaderParams; | ||
}; | ||
SwaggerOperation.prototype.supportHeaderParams = function() { | ||
return this.resource.api.supportHeaderParams; | ||
}; | ||
SwaggerOperation.prototype.supportedSubmitMethods = function () { | ||
return this.resource.api.supportedSubmitMethods; | ||
}; | ||
SwaggerOperation.prototype.supportedSubmitMethods = function() { | ||
return this.resource.api.supportedSubmitMethods; | ||
}; | ||
SwaggerOperation.prototype.getQueryParams = function (args) { | ||
return this.getMatchingParams(['query'], args); | ||
}; | ||
SwaggerOperation.prototype.getQueryParams = function(args) { | ||
return this.getMatchingParams(['query'], args); | ||
}; | ||
SwaggerOperation.prototype.getHeaderParams = function (args) { | ||
return this.getMatchingParams(['header'], args); | ||
}; | ||
SwaggerOperation.prototype.getHeaderParams = function(args) { | ||
return this.getMatchingParams(['header'], args); | ||
}; | ||
SwaggerOperation.prototype.getMatchingParams = function (paramTypes, args) { | ||
var matchingParams = {}; | ||
var params = this.parameters; | ||
for (var i = 0; i < params.length; i++) { | ||
param = params[i]; | ||
if (args && args[param.name]) | ||
matchingParams[param.name] = args[param.name]; | ||
} | ||
var headers = this.resource.api.headers; | ||
var name; | ||
for (name in headers) { | ||
var value = headers[name]; | ||
matchingParams[name] = value; | ||
} | ||
return matchingParams; | ||
}; | ||
SwaggerOperation.prototype.getMatchingParams = function(paramTypes, args) { | ||
var matchingParams = {}; | ||
var params = this.parameters; | ||
for (var i = 0; i < params.length; i++) { | ||
param = params[i]; | ||
if (args && args[param.name]) | ||
matchingParams[param.name] = args[param.name]; | ||
} | ||
var headers = this.resource.api.headers; | ||
var name; | ||
for (name in headers) { | ||
var value = headers[name]; | ||
matchingParams[name] = value; | ||
} | ||
return matchingParams; | ||
}; | ||
SwaggerOperation.prototype.help = function () { | ||
var msg = ""; | ||
var params = this.parameters; | ||
for (var i = 0; i < params.length; i++) { | ||
var param = params[i]; | ||
if (msg !== "") | ||
msg += "\n"; | ||
msg += "* " + param.name + (param.required ? ' (required)' : '') + " - " + param.description; | ||
} | ||
return msg; | ||
}; | ||
SwaggerOperation.prototype.help = function() { | ||
var msg = ""; | ||
var params = this.parameters; | ||
for (var i = 0; i < params.length; i++) { | ||
var param = params[i]; | ||
if (msg !== "") | ||
msg += "\n"; | ||
msg += "* " + param.name + (param.required ? ' (required)' : '') + " - " + param.description; | ||
} | ||
return msg; | ||
}; | ||
SwaggerOperation.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 | ||
SwaggerOperation.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(/<[^!?].*>/)) | ||
}; | ||
_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); | ||
} | ||
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 _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'; | ||
} | ||
return formatted; | ||
}; | ||
for (_i = 0, _len = lines.length; _i < _len; _i++) { | ||
ln = lines[_i]; | ||
_fn(ln); | ||
} | ||
return formatted; | ||
}; | ||
var SwaggerRequest = function (type, url, params, opts, successCallback, errorCallback, operation, execution) { | ||
var _this = this; | ||
var errors = []; | ||
this.useJQuery = (typeof operation.resource.useJQuery !== 'undefined' ? operation.resource.useJQuery : null); | ||
this.type = (type || errors.push("SwaggerRequest type is required (get/post/put/delete/patch/options).")); | ||
this.url = (url || errors.push("SwaggerRequest url is required.")); | ||
this.params = params; | ||
this.opts = opts; | ||
this.successCallback = (successCallback || errors.push("SwaggerRequest successCallback is required.")); | ||
this.errorCallback = (errorCallback || errors.push("SwaggerRequest error callback is required.")); | ||
this.operation = (operation || errors.push("SwaggerRequest operation is required.")); | ||
this.execution = execution; | ||
this.headers = (params.headers || {}); | ||
var SwaggerRequest = function(type, url, params, opts, successCallback, errorCallback, operation, execution) { | ||
var _this = this; | ||
var errors = []; | ||
this.useJQuery = (typeof operation.resource.useJQuery !== 'undefined' ? operation.resource.useJQuery : null); | ||
this.type = (type||errors.push("SwaggerRequest type is required (get/post/put/delete/patch/options).")); | ||
this.url = (url||errors.push("SwaggerRequest url is required.")); | ||
this.params = params; | ||
this.opts = opts; | ||
this.successCallback = (successCallback||errors.push("SwaggerRequest successCallback is required.")); | ||
this.errorCallback = (errorCallback||errors.push("SwaggerRequest error callback is required.")); | ||
this.operation = (operation||errors.push("SwaggerRequest operation is required.")); | ||
this.execution = execution; | ||
this.headers = (params.headers||{}); | ||
if (errors.length > 0) { | ||
throw errors; | ||
} | ||
if(errors.length > 0) { | ||
throw errors; | ||
} | ||
this.type = this.type.toUpperCase(); | ||
this.type = this.type.toUpperCase(); | ||
// set request, response content type headers | ||
var headers = this.setHeaders(params, this.operation); | ||
var body = params.body; | ||
// set request, response content type headers | ||
var headers = this.setHeaders(params, this.operation); | ||
var body = params.body; | ||
// encode the body for form submits | ||
if (headers["Content-Type"]) { | ||
var values = {}; | ||
var i; | ||
var operationParams = this.operation.parameters; | ||
for (i = 0; i < operationParams.length; i++) { | ||
var param = operationParams[i]; | ||
if (param.paramType === "form") | ||
values[param.name] = param; | ||
} | ||
// encode the body for form submits | ||
if (headers["Accept"] && headers["Accept"].indexOf("application/x-www-form-urlencoded") === 0) { | ||
var fields = {}; | ||
var possibleParams = {}; | ||
var values = {}; | ||
var key; | ||
for(key in formParams){ | ||
var param = formParams[key]; | ||
values[param.name] = param; | ||
} | ||
if (headers["Content-Type"].indexOf("application/x-www-form-urlencoded") === 0) { | ||
var encoded = ""; | ||
var key, value; | ||
for (key in values) { | ||
value = this.params[key]; | ||
if (typeof value !== 'undefined') { | ||
if (encoded !== "") | ||
encoded += "&"; | ||
encoded += encodeURIComponent(key) + '=' + encodeURIComponent(value); | ||
} | ||
} | ||
body = encoded; | ||
var encoded = ""; | ||
var key; | ||
for(key in values) { | ||
value = this.params[key]; | ||
if(typeof value !== 'undefined'){ | ||
if(encoded !== "") | ||
encoded += "&"; | ||
encoded += encodeURIComponent(key) + '=' + encodeURIComponent(value); | ||
} | ||
else if (headers["Content-Type"].indexOf("multipart/form-data") === 0) { | ||
// encode the body for form submits | ||
var data = ""; | ||
var boundary = "----SwaggerFormBoundary" + Date.now(); | ||
var key, value; | ||
for (key in values) { | ||
value = this.params[key]; | ||
if (typeof value !== 'undefined') { | ||
data += '--' + boundary + '\n'; | ||
data += 'Content-Disposition: form-data; name="' + key + '"'; | ||
data += '\n\n'; | ||
data += value + "\n"; | ||
} | ||
} | ||
data += "--" + boundary + "--\n"; | ||
headers["Content-Type"] = "multipart/form-data; boundary=" + boundary; | ||
body = data; | ||
} | ||
} | ||
body = encoded; | ||
} | ||
var obj; | ||
if (!((this.headers != null) && (this.headers.mock != null))) { | ||
obj = { | ||
url: this.url, | ||
method: this.type, | ||
headers: headers, | ||
body: body, | ||
useJQuery: this.useJQuery, | ||
on: { | ||
error: function (response) { | ||
return _this.errorCallback(response, _this.opts.parent); | ||
}, | ||
redirect: function (response) { | ||
return _this.successCallback(response, _this.opts.parent); | ||
}, | ||
307: function (response) { | ||
return _this.successCallback(response, _this.opts.parent); | ||
}, | ||
response: function (response) { | ||
return _this.successCallback(response, _this.opts.parent); | ||
} | ||
if (!((this.headers != null) && (this.headers.mock != null))) { | ||
obj = { | ||
url: this.url, | ||
method: this.type, | ||
headers: headers, | ||
body: body, | ||
useJQuery: this.useJQuery, | ||
on: { | ||
error: function(response) { | ||
return _this.errorCallback(response, _this.opts.parent); | ||
}, | ||
redirect: function(response) { | ||
return _this.successCallback(response, _this.opts.parent); | ||
}, | ||
307: function(response) { | ||
return _this.successCallback(response, _this.opts.parent); | ||
}, | ||
response: function(response) { | ||
return _this.successCallback(response, _this.opts.parent); | ||
} | ||
}; | ||
var e; | ||
if (typeof window !== 'undefined') { | ||
e = window; | ||
} else { | ||
e = exports; | ||
} | ||
var status = e.authorizations.apply(obj, this.operation.authorizations); | ||
if (opts.mock == null) { | ||
if (status !== false) { | ||
new SwaggerHttp().execute(obj); | ||
} else { | ||
obj.canceled = true; | ||
} | ||
}; | ||
var e; | ||
if (typeof window !== 'undefined') { | ||
e = window; | ||
} else { | ||
e = exports; | ||
} | ||
status = e.authorizations.apply(obj, this.operation.authorizations); | ||
if (opts.mock == null) { | ||
if (status !== false) { | ||
new SwaggerHttp().execute(obj); | ||
} else { | ||
return obj; | ||
obj.canceled = true; | ||
} | ||
} else { | ||
return obj; | ||
} | ||
return obj; | ||
}; | ||
} | ||
}; | ||
SwaggerRequest.prototype.setHeaders = function (params, operation) { | ||
// default type | ||
var accepts = "application/json"; | ||
var consumes = "application/json"; | ||
SwaggerRequest.prototype.setHeaders = function(params, operation) { | ||
// default type | ||
var accepts = "application/json"; | ||
var contentType = null; | ||
var allDefinedParams = this.operation.parameters; | ||
var definedFormParams = []; | ||
var definedFileParams = []; | ||
var body = params.body; | ||
var headers = {}; | ||
var allDefinedParams = this.operation.parameters; | ||
var definedFormParams = []; | ||
var definedFileParams = []; | ||
var body = params.body; | ||
var headers = {}; | ||
// get params from the operation and set them in definedFileParams, definedFormParams, headers | ||
var i; | ||
for (i = 0; i < allDefinedParams.length; i++) { | ||
var param = allDefinedParams[i]; | ||
if (param.paramType === "form") | ||
definedFormParams.push(param); | ||
else if (param.paramType === "file") | ||
definedFileParams.push(param); | ||
else if (param.paramType === "header" && this.params.headers) { | ||
var key = param.name; | ||
var headerValue = this.params.headers[param.name]; | ||
if (typeof this.params.headers[param.name] !== 'undefined') | ||
headers[key] = headerValue; | ||
} | ||
// get params from the operation and set them in definedFileParams, definedFormParams, headers | ||
var i; | ||
for(i = 0; i < allDefinedParams.length; i++) { | ||
var param = allDefinedParams[i]; | ||
if(param.paramType === "form") | ||
definedFormParams.push(param); | ||
else if(param.paramType === "file") | ||
definedFileParams.push(param); | ||
else if(param.paramType === "header" && this.params.headers) { | ||
var key = param.name; | ||
var headerValue = this.params.headers[param.name]; | ||
if(typeof this.params.headers[param.name] !== 'undefined') | ||
headers[key] = headerValue; | ||
} | ||
} | ||
// if there's a body, need to set the accepts header via requestContentType | ||
if (body && (this.type === "POST" || this.type === "PUT" || this.type === "PATCH" || this.type === "DELETE")) { | ||
if (this.opts.requestContentType) | ||
consumes = this.opts.requestContentType; | ||
} else { | ||
// if any form params, content type must be set | ||
if (definedFormParams.length > 0) { | ||
if (definedFileParams.length > 0) | ||
consumes = "multipart/form-data"; | ||
else | ||
consumes = "application/x-www-form-urlencoded"; | ||
} | ||
else if (this.type === "DELETE") | ||
body = "{}"; | ||
else if (this.type != "DELETE") | ||
accepts = null; | ||
// if there's a body, need to set the accepts header via requestContentType | ||
if (body && (this.type === "POST" || this.type === "PUT" || this.type === "PATCH" || this.type === "DELETE")) { | ||
if (this.opts.requestContentType) | ||
accepts = this.opts.requestContentType; | ||
} else { | ||
// if any form params, content type must be set | ||
if(definedFormParams.length > 0) { | ||
if(definedFileParams.length > 0) | ||
accepts = "multipart/form-data"; | ||
else | ||
accepts = "application/x-www-form-urlencoded"; | ||
} | ||
else if (this.type == "DELETE") | ||
body = "{}"; | ||
else if (this.type != "DELETE") | ||
accepts = null; | ||
} | ||
if (consumes && this.operation.consumes) { | ||
if (this.operation.consumes.indexOf(consumes) === -1) { | ||
log("server doesn't consume " + consumes + ", try " + JSON.stringify(this.operation.consumes)); | ||
consumes = this.operation.consumes[0]; | ||
} | ||
if (contentType && this.operation.consumes) { | ||
if (this.operation.consumes.indexOf(contentType) === -1) { | ||
log("server doesn't consume " + contentType + ", try " + JSON.stringify(this.operation.consumes)); | ||
contentType = this.operation.consumes[0]; | ||
} | ||
} | ||
if (this.opts.responseContentType) { | ||
accepts = this.opts.responseContentType; | ||
} else { | ||
accepts = "application/json"; | ||
if (this.opts.responseContentType) { | ||
accepts = this.opts.responseContentType; | ||
} else { | ||
accepts = "application/json"; | ||
} | ||
if (accepts && this.operation.produces) { | ||
if (this.operation.produces.indexOf(accepts) === -1) { | ||
log("server can't produce " + accepts); | ||
accepts = this.operation.produces[0]; | ||
} | ||
if (accepts && this.operation.produces) { | ||
if (this.operation.produces.indexOf(accepts) === -1) { | ||
log("server can't produce " + accepts); | ||
accepts = this.operation.produces[0]; | ||
} | ||
if (contentType && contentType.indexOf("application/x-www-form-urlencoded") === 0) { | ||
var fields = {}; | ||
var possibleParams = {}; | ||
var values = {}; | ||
var key; | ||
for(key in formParams){ | ||
var param = formParams[key]; | ||
values[param.name] = param; | ||
} | ||
var encoded = ""; | ||
var key; | ||
for(key in values) { | ||
value = this.params[key]; | ||
if(typeof value !== 'undefined'){ | ||
if(encoded !== "") | ||
encoded += "&"; | ||
encoded += encodeURIComponent(key) + '=' + encodeURIComponent(value); | ||
} | ||
} | ||
if ((consumes && body !== "") || (consumes === "application/x-www-form-urlencoded")) | ||
headers["Content-Type"] = consumes; | ||
if (accepts) | ||
headers["Accept"] = accepts; | ||
return headers; | ||
body = encoded; | ||
} | ||
if ((contentType && body !== "") || (contentType === "application/x-www-form-urlencoded")) | ||
headers["Content-Type"] = contentType; | ||
if (accepts) | ||
headers["Accept"] = accepts; | ||
SwaggerRequest.prototype.asCurl = function () { | ||
var results = []; | ||
if (this.headers) { | ||
var key; | ||
for (key in this.headers) { | ||
results.push("--header \"" + key + ": " + this.headers[v] + "\""); | ||
} | ||
return headers; | ||
} | ||
SwaggerRequest.prototype.asCurl = function() { | ||
var results = []; | ||
if(this.headers) { | ||
var key; | ||
for(key in this.headers) { | ||
results.push("--header \"" + key + ": " + this.headers[v] + "\""); | ||
} | ||
return "curl " + (results.join(" ")) + " " + this.url; | ||
}; | ||
} | ||
return "curl " + (results.join(" ")) + " " + this.url; | ||
}; | ||
/** | ||
* SwaggerHttp is a wrapper for executing requests | ||
*/ | ||
var SwaggerHttp = function () { }; | ||
/** | ||
* SwaggerHttp is a wrapper for executing requests | ||
*/ | ||
var SwaggerHttp = function() {}; | ||
SwaggerHttp.prototype.execute = function (obj) { | ||
if (obj && (typeof obj.useJQuery === 'boolean')) | ||
this.useJQuery = obj.useJQuery; | ||
else | ||
this.useJQuery = this.isIE8(); | ||
SwaggerHttp.prototype.execute = function(obj) { | ||
if(obj && (typeof obj.useJQuery === 'boolean')) | ||
this.useJQuery = obj.useJQuery; | ||
else | ||
this.useJQuery = this.isIE8(); | ||
if (this.useJQuery) | ||
return new JQueryHttpClient().execute(obj); | ||
else | ||
return new ShredHttpClient().execute(obj); | ||
} | ||
if(this.useJQuery) | ||
return new JQueryHttpClient().execute(obj); | ||
else | ||
return new ShredHttpClient().execute(obj); | ||
} | ||
SwaggerHttp.prototype.isIE8 = function () { | ||
var detectedIE = false; | ||
if (typeof navigator !== 'undefined' && navigator.userAgent) { | ||
nav = navigator.userAgent.toLowerCase(); | ||
if (nav.indexOf('msie') !== -1) { | ||
var version = parseInt(nav.split('msie')[1]); | ||
if (version <= 8) { | ||
detectedIE = true; | ||
} | ||
SwaggerHttp.prototype.isIE8 = function() { | ||
var detectedIE = false; | ||
if (typeof navigator !== 'undefined' && navigator.userAgent) { | ||
nav = navigator.userAgent.toLowerCase(); | ||
if (nav.indexOf('msie') !== -1) { | ||
var version = parseInt(nav.split('msie')[1]); | ||
if (version <= 8) { | ||
detectedIE = true; | ||
} | ||
} | ||
return detectedIE; | ||
}; | ||
} | ||
return detectedIE; | ||
}; | ||
/* | ||
* JQueryHttpClient lets a browser take advantage of JQuery's cross-browser magic. | ||
* NOTE: when jQuery is available it will export both '$' and 'jQuery' to the global space. | ||
* Since we are using closures here we need to alias it for internal use. | ||
*/ | ||
var JQueryHttpClient = function (options) { | ||
"use strict"; | ||
if (!jQuery) { | ||
var jQuery = window.jQuery; | ||
} | ||
/* | ||
* JQueryHttpClient lets a browser take advantage of JQuery's cross-browser magic. | ||
* NOTE: when jQuery is available it will export both '$' and 'jQuery' to the global space. | ||
* Since we are using closures here we need to alias it for internal use. | ||
*/ | ||
var JQueryHttpClient = function(options) { | ||
"use strict"; | ||
if(!jQuery){ | ||
var jQuery = window.jQuery; | ||
} | ||
} | ||
JQueryHttpClient.prototype.execute = function (obj) { | ||
var cb = obj.on; | ||
var request = obj; | ||
JQueryHttpClient.prototype.execute = function(obj) { | ||
var cb = obj.on; | ||
var request = obj; | ||
obj.type = obj.method; | ||
obj.cache = false; | ||
obj.type = obj.method; | ||
obj.cache = false; | ||
obj.beforeSend = function (xhr) { | ||
var key, results; | ||
if (obj.headers) { | ||
results = []; | ||
var key; | ||
for (key in obj.headers) { | ||
if (key.toLowerCase() === "content-type") { | ||
results.push(obj.contentType = obj.headers[key]); | ||
} else if (key.toLowerCase() === "accept") { | ||
results.push(obj.accepts = obj.headers[key]); | ||
} else { | ||
results.push(xhr.setRequestHeader(key, obj.headers[key])); | ||
} | ||
obj.beforeSend = function(xhr) { | ||
var key, results; | ||
if (obj.headers) { | ||
results = []; | ||
var key; | ||
for (key in obj.headers) { | ||
if (key.toLowerCase() === "content-type") { | ||
results.push(obj.contentType = obj.headers[key]); | ||
} else if (key.toLowerCase() === "accept") { | ||
results.push(obj.accepts = obj.headers[key]); | ||
} else { | ||
results.push(xhr.setRequestHeader(key, obj.headers[key])); | ||
} | ||
return results; | ||
} | ||
}; | ||
return results; | ||
} | ||
}; | ||
obj.data = obj.body; | ||
obj.complete = function (response, textStatus, opts) { | ||
var headers = {}, | ||
obj.data = obj.body; | ||
obj.complete = function(response, textStatus, opts) { | ||
var headers = {}, | ||
headerArray = response.getAllResponseHeaders().split("\n"); | ||
for (var i = 0; i < headerArray.length; i++) { | ||
var toSplit = headerArray[i].trim(); | ||
if (toSplit.length === 0) | ||
continue; | ||
var separator = toSplit.indexOf(":"); | ||
if (separator === -1) { | ||
// Name but no value in the header | ||
headers[toSplit] = null; | ||
continue; | ||
} | ||
var name = toSplit.substring(0, separator).trim(), | ||
for(var i = 0; i < headerArray.length; i++) { | ||
var toSplit = headerArray[i].trim(); | ||
if(toSplit.length === 0) | ||
continue; | ||
var separator = toSplit.indexOf(":"); | ||
if(separator === -1) { | ||
// Name but no value in the header | ||
headers[toSplit] = null; | ||
continue; | ||
} | ||
var name = toSplit.substring(0, separator).trim(), | ||
value = toSplit.substring(separator + 1).trim(); | ||
headers[name] = value; | ||
} | ||
headers[name] = value; | ||
} | ||
var out = { | ||
url: request.url, | ||
method: request.method, | ||
status: response.status, | ||
data: response.responseText, | ||
headers: headers | ||
}; | ||
var out = { | ||
url: request.url, | ||
method: request.method, | ||
status: response.status, | ||
data: response.responseText, | ||
headers: headers | ||
}; | ||
var contentType = (headers["content-type"] || headers["Content-Type"] || null) | ||
var contentType = (headers["content-type"]||headers["Content-Type"]||null) | ||
if (contentType != null) { | ||
if (contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) { | ||
if (response.responseText && response.responseText !== "") | ||
out.obj = JSON.parse(response.responseText); | ||
else | ||
out.obj = {} | ||
} | ||
if(contentType != null) { | ||
if(contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) { | ||
if(response.responseText && response.responseText !== "") | ||
out.obj = JSON.parse(response.responseText); | ||
else | ||
out.obj = {} | ||
} | ||
} | ||
if (response.status >= 200 && response.status < 300) | ||
cb.response(out); | ||
else if (response.status === 0 || (response.status >= 400 && response.status < 599)) | ||
cb.error(out); | ||
else | ||
return cb.response(out); | ||
}; | ||
if(response.status >= 200 && response.status < 300) | ||
cb.response(out); | ||
else if(response.status === 0 || (response.status >= 400 && response.status < 599)) | ||
cb.error(out); | ||
else | ||
return cb.response(out); | ||
}; | ||
jQuery.support.cors = true; | ||
return jQuery.ajax(obj); | ||
} | ||
jQuery.support.cors = true; | ||
return jQuery.ajax(obj); | ||
} | ||
/* | ||
* ShredHttpClient is a light-weight, node or browser HTTP client | ||
*/ | ||
var ShredHttpClient = function (options) { | ||
this.options = (options || {}); | ||
this.isInitialized = false; | ||
/* | ||
* ShredHttpClient is a light-weight, node or browser HTTP client | ||
*/ | ||
var ShredHttpClient = function(options) { | ||
this.options = (options||{}); | ||
this.isInitialized = false; | ||
var identity, toString; | ||
var identity, toString; | ||
if (typeof window !== 'undefined') { | ||
this.Shred = require("./shred"); | ||
this.content = require("./shred/content"); | ||
} | ||
else | ||
this.Shred = require("shred"); | ||
this.shred = new this.Shred(); | ||
if (typeof window !== 'undefined') { | ||
this.Shred = require("./shred"); | ||
this.content = require("./shred/content"); | ||
} | ||
else | ||
this.Shred = require("shred"); | ||
this.shred = new this.Shred(); | ||
} | ||
ShredHttpClient.prototype.initShred = function () { | ||
this.isInitialized = true; | ||
this.registerProcessors(this.shred); | ||
} | ||
ShredHttpClient.prototype.initShred = function () { | ||
this.isInitialized = true; | ||
this.registerProcessors(this.shred); | ||
} | ||
ShredHttpClient.prototype.registerProcessors = function (shred) { | ||
var identity = function (x) { | ||
return x; | ||
}; | ||
var toString = function (x) { | ||
return x.toString(); | ||
}; | ||
ShredHttpClient.prototype.registerProcessors = function(shred) { | ||
var identity = function(x) { | ||
return x; | ||
}; | ||
var toString = function(x) { | ||
return x.toString(); | ||
}; | ||
if (typeof window !== 'undefined') { | ||
this.content.registerProcessor(["application/json; charset=utf-8", "application/json", "json"], { | ||
parser: identity, | ||
stringify: toString | ||
}); | ||
} else { | ||
this.Shred.registerProcessor(["application/json; charset=utf-8", "application/json", "json"], { | ||
parser: identity, | ||
stringify: toString | ||
}); | ||
} | ||
if (typeof window !== 'undefined') { | ||
this.content.registerProcessor(["application/json; charset=utf-8", "application/json", "json"], { | ||
parser: identity, | ||
stringify: toString | ||
}); | ||
} else { | ||
this.Shred.registerProcessor(["application/json; charset=utf-8", "application/json", "json"], { | ||
parser: identity, | ||
stringify: toString | ||
}); | ||
} | ||
} | ||
ShredHttpClient.prototype.execute = function (obj) { | ||
if (!this.isInitialized) | ||
this.initShred(); | ||
ShredHttpClient.prototype.execute = function(obj) { | ||
if(!this.isInitialized) | ||
this.initShred(); | ||
var cb = obj.on, res; | ||
var cb = obj.on, res; | ||
var transform = function (response) { | ||
var out = { | ||
headers: response._headers, | ||
url: response.request.url, | ||
method: response.request.method, | ||
status: response.status, | ||
data: response.content.data | ||
}; | ||
var contentType = (response._headers["content-type"] || response._headers["Content-Type"] || null) | ||
if (contentType != null) { | ||
if (contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) { | ||
if (response.content.data && response.content.data !== "") | ||
out.obj = JSON.parse(response.content.data); | ||
else | ||
out.obj = {} | ||
} | ||
} | ||
return out; | ||
var transform = function(response) { | ||
var out = { | ||
headers: response._headers, | ||
url: response.request.url, | ||
method: response.request.method, | ||
status: response.status, | ||
data: response.content.data | ||
}; | ||
// Transform an error into a usable response-like object | ||
var transformError = function (error) { | ||
var out = { | ||
// Default to a status of 0 - The client will treat this as a generic permissions sort of error | ||
status: 0, | ||
data: error.message || error | ||
}; | ||
var contentType = (response._headers["content-type"]||response._headers["Content-Type"]||null) | ||
if (error.code) { | ||
out.obj = error; | ||
if (error.code === 'ENOTFOUND' || error.code === 'ECONNREFUSED') { | ||
// We can tell the client that this should be treated as a missing resource and not as a permissions thing | ||
out.status = 404; | ||
} | ||
if(contentType != null) { | ||
if(contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) { | ||
if(response.content.data && response.content.data !== "") | ||
out.obj = JSON.parse(response.content.data); | ||
else | ||
out.obj = {} | ||
} | ||
return out; | ||
}; | ||
var res = { | ||
error: function (response) { | ||
if (obj) | ||
return cb.error(transform(response)); | ||
}, | ||
// Catch the Shred error raised when the request errors as it is made (i.e. No Response is coming) | ||
request_error: function (err) { | ||
if (obj) | ||
return cb.error(transformError(err)); | ||
}, | ||
redirect: function (response) { | ||
if (obj) | ||
return cb.redirect(transform(response)); | ||
}, | ||
307: function (response) { | ||
if (obj) | ||
return cb.redirect(transform(response)); | ||
}, | ||
response: function (response) { | ||
if (obj) | ||
return cb.response(transform(response)); | ||
} | ||
}; | ||
if (obj) { | ||
obj.on = res; | ||
} | ||
return this.shred.request(obj); | ||
return out; | ||
}; | ||
/** | ||
* SwaggerAuthorizations applys the correct authorization to an operation being executed | ||
*/ | ||
var SwaggerAuthorizations = function () { | ||
this.authz = {}; | ||
res = { | ||
error: function(response) { | ||
if (obj) | ||
return cb.error(transform(response)); | ||
}, | ||
redirect: function(response) { | ||
if (obj) | ||
return cb.redirect(transform(response)); | ||
}, | ||
307: function(response) { | ||
if (obj) | ||
return cb.redirect(transform(response)); | ||
}, | ||
response: function(response) { | ||
if (obj) | ||
return cb.response(transform(response)); | ||
} | ||
}; | ||
if (obj) { | ||
obj.on = res; | ||
} | ||
return this.shred.request(obj); | ||
}; | ||
SwaggerAuthorizations.prototype.add = function (name, auth) { | ||
this.authz[name] = auth; | ||
return auth; | ||
}; | ||
/** | ||
* SwaggerAuthorizations applys the correct authorization to an operation being executed | ||
*/ | ||
var SwaggerAuthorizations = function() { | ||
this.authz = {}; | ||
}; | ||
SwaggerAuthorizations.prototype.remove = function (name) { | ||
return delete this.authz[name]; | ||
}; | ||
SwaggerAuthorizations.prototype.add = function(name, auth) { | ||
this.authz[name] = auth; | ||
return auth; | ||
}; | ||
SwaggerAuthorizations.prototype.apply = function (obj, authorizations) { | ||
var status = null; | ||
var key, value, result; | ||
SwaggerAuthorizations.prototype.remove = function(name) { | ||
return delete this.authz[name]; | ||
}; | ||
// if the "authorizations" key is undefined, or has an empty array, add all keys | ||
if (typeof authorizations === 'undefined' || Object.keys(authorizations).length == 0) { | ||
SwaggerAuthorizations.prototype.apply = function(obj, authorizations) { | ||
var status = null; | ||
var key; | ||
// if the "authorizations" key is undefined, or has an empty array, add all keys | ||
if(typeof authorizations === 'undefined' || Object.keys(authorizations).length == 0) { | ||
for (key in this.authz) { | ||
value = this.authz[key]; | ||
result = value.apply(obj, authorizations); | ||
if (result === true) | ||
status = true; | ||
} | ||
} | ||
else { | ||
for(name in authorizations) { | ||
for (key in this.authz) { | ||
value = this.authz[key]; | ||
result = value.apply(obj, authorizations); | ||
if (result === true) | ||
status = true; | ||
} | ||
} | ||
else { | ||
for (name in authorizations) { | ||
for (key in this.authz) { | ||
if (key == name) { | ||
value = this.authz[key]; | ||
result = value.apply(obj, authorizations); | ||
if (result === true) | ||
status = true; | ||
} | ||
if(key == name) { | ||
value = this.authz[key]; | ||
result = value.apply(obj, authorizations); | ||
if (result === true) | ||
status = true; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
return status; | ||
}; | ||
return status; | ||
}; | ||
/** | ||
* ApiKeyAuthorization allows a query param or header to be injected | ||
*/ | ||
var ApiKeyAuthorization = function (name, value, type, delimiter) { | ||
this.name = name; | ||
this.value = value; | ||
this.type = type; | ||
this.delimiter = delimiter; | ||
}; | ||
/** | ||
* ApiKeyAuthorization allows a query param or header to be injected | ||
*/ | ||
var ApiKeyAuthorization = function(name, value, type) { | ||
this.name = name; | ||
this.value = value; | ||
this.type = type; | ||
}; | ||
ApiKeyAuthorization.prototype.apply = function (obj, authorizations) { | ||
if (this.type === "query") { | ||
if (obj.url.indexOf('?') > 0) | ||
obj.url = obj.url + "&" + this.name + "=" + this.value; | ||
else | ||
obj.url = obj.url + "?" + this.name + "=" + this.value; | ||
return true; | ||
} else if (this.type === "header") { | ||
if (typeof obj.headers[this.name] !== 'undefined') { | ||
if (typeof this.delimiter !== 'undefined') | ||
obj.headers[this.name] = obj.headers[this.name] + this.delimiter + this.value; | ||
} | ||
else | ||
obj.headers[this.name] = this.value; | ||
return true; | ||
} | ||
}; | ||
var CookieAuthorization = function (cookie) { | ||
this.cookie = cookie; | ||
} | ||
CookieAuthorization.prototype.apply = function (obj, authorizations) { | ||
obj.cookieJar = obj.cookieJar || CookieJar(); | ||
obj.cookieJar.setCookie(this.cookie); | ||
ApiKeyAuthorization.prototype.apply = function(obj, authorizations) { | ||
if (this.type === "query") { | ||
if (obj.url.indexOf('?') > 0) | ||
obj.url = obj.url + "&" + this.name + "=" + this.value; | ||
else | ||
obj.url = obj.url + "?" + this.name + "=" + this.value; | ||
return true; | ||
} else if (this.type === "header") { | ||
obj.headers[this.name] = this.value; | ||
return true; | ||
} | ||
}; | ||
/** | ||
* Password Authorization is a basic auth implementation | ||
*/ | ||
var PasswordAuthorization = function (name, username, password) { | ||
this.name = name; | ||
this.username = username; | ||
this.password = password; | ||
this._btoa = null; | ||
if (typeof window !== 'undefined') | ||
this._btoa = btoa; | ||
else | ||
this._btoa = require("btoa"); | ||
}; | ||
var CookieAuthorization = function(cookie) { | ||
this.cookie = cookie; | ||
} | ||
PasswordAuthorization.prototype.apply = function (obj, authorizations) { | ||
var base64encoder = this._btoa; | ||
obj.headers["Authorization"] = "Basic " + base64encoder(this.username + ":" + this.password); | ||
return true; | ||
}; | ||
CookieAuthorization.prototype.apply = function(obj, authorizations) { | ||
obj.cookieJar = obj.cookieJar || CookieJar(); | ||
obj.cookieJar.setCookie(this.cookie); | ||
return true; | ||
} | ||
var e = (typeof window !== 'undefined' ? window : exports); | ||
/** | ||
* Password Authorization is a basic auth implementation | ||
*/ | ||
var PasswordAuthorization = function(name, username, password) { | ||
this.name = name; | ||
this.username = username; | ||
this.password = password; | ||
this._btoa = null; | ||
if (typeof window !== 'undefined') | ||
this._btoa = btoa; | ||
else | ||
this._btoa = require("btoa"); | ||
}; | ||
var sampleModels = {}; | ||
var cookies = {}; | ||
PasswordAuthorization.prototype.apply = function(obj, authorizations) { | ||
var base64encoder = this._btoa; | ||
obj.headers["Authorization"] = "Basic " + base64encoder(this.username + ":" + this.password); | ||
return true; | ||
}; | ||
e.SampleModels = sampleModels; | ||
e.SwaggerHttp = SwaggerHttp; | ||
e.SwaggerRequest = SwaggerRequest; | ||
e.authorizations = new SwaggerAuthorizations(); | ||
e.ApiKeyAuthorization = ApiKeyAuthorization; | ||
e.PasswordAuthorization = PasswordAuthorization; | ||
e.CookieAuthorization = CookieAuthorization; | ||
e.JQueryHttpClient = JQueryHttpClient; | ||
e.ShredHttpClient = ShredHttpClient; | ||
e.SwaggerOperation = SwaggerOperation; | ||
e.SwaggerModel = SwaggerModel; | ||
e.SwaggerModelProperty = SwaggerModelProperty; | ||
e.SwaggerResource = SwaggerResource; | ||
e.SwaggerApi = SwaggerApi; | ||
e.log = log; | ||
var e = (typeof window !== 'undefined' ? window : exports); | ||
})(); | ||
var sampleModels = {}; | ||
var cookies = {}; | ||
e.SampleModels = sampleModels; | ||
e.SwaggerHttp = SwaggerHttp; | ||
e.SwaggerRequest = SwaggerRequest; | ||
e.authorizations = new SwaggerAuthorizations(); | ||
e.ApiKeyAuthorization = ApiKeyAuthorization; | ||
e.PasswordAuthorization = PasswordAuthorization; | ||
e.CookieAuthorization = CookieAuthorization; | ||
e.JQueryHttpClient = JQueryHttpClient; | ||
e.ShredHttpClient = ShredHttpClient; | ||
e.SwaggerOperation = SwaggerOperation; | ||
e.SwaggerModel = SwaggerModel; | ||
e.SwaggerModelProperty = SwaggerModelProperty; | ||
e.SwaggerResource = SwaggerResource; | ||
e.SwaggerApi = SwaggerApi; |
@@ -20,3 +20,3 @@ var spec = { | ||
"/pet/findByStatus": { | ||
"get": { | ||
"post": { | ||
"tags": [ | ||
@@ -28,18 +28,12 @@ "pet" | ||
"operationId": "findPetsByStatus", | ||
"produces": [ | ||
"application/json", | ||
"application/xml" | ||
], | ||
"consumes": [ "application/json" ], | ||
"parameters": [ | ||
{ | ||
"in": "query", | ||
"in": "body", | ||
"name": "status", | ||
"description": "Status values that need to be considered for filter", | ||
"required": false, | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"enum": [ "option-a", "option-b" ], | ||
"collectionFormat": "multi" | ||
"schema": { | ||
"$ref": "Pet" | ||
} | ||
}, | ||
@@ -105,2 +99,3 @@ { | ||
"id": { | ||
"description": "the id", | ||
"type": "integer", | ||
@@ -107,0 +102,0 @@ "format": "int64", |
@@ -1,1 +0,1 @@ | ||
$(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.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 <option value="';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+='">';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+="</option>\n ";return o}function n(p,o){return'\n <option value="application/json">application/json</option>\n'}i+='<label for="contentType"></label>\n<select name="contentType">\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</select>\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 <div class="info_title">'+k(((v=((v=x.info),v==null||v===false?v:v.title)),typeof v===i?v.apply(x):v))+'</div>\n <div class="info_description">';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+="</div>\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+='<div class="info_tos"><a href="'+k(((u=((u=w.info),u==null||u===false?u:u.termsOfServiceUrl)),typeof u===i?u.apply(w):u))+'">Terms of service</a></div>';return t}function r(w,v){var t="",u;t+="<div class='info_contact'><a href=\"mailto:"+k(((u=((u=((u=w.info),u==null||u===false?u:u.contact)),u==null||u===false?u:u.name)),typeof u===i?u.apply(w):u))+'">Contact the developer</a></div>';return t}function p(w,v){var t="",u;t+="<div class='info_license'><a href='"+k(((u=((u=((u=w.info),u==null||u===false?u:u.license)),u==null||u===false?u:u.url)),typeof u===i?u.apply(w):u))+"'>"+k(((u=((u=((u=w.info),u==null||u===false?u:u.license)),u==null||u===false?u:u.name)),typeof u===i?u.apply(w):u))+"</a></div>";return t}function o(w,v){var t="",u;t+='\n , <span style="font-variant: small-caps">api version</span>: '+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 <span style="float:right"><a href="http://online.swagger.io/validator/debug?url=';if(u=g.url){u=u.call(w,{hash:{},data:v})}else{u=w.url;u=typeof u===i?u.apply(w):u}t+=k(u)+'"><img id="validator" src="http://online.swagger.io/validator?url=';if(u=g.url){u=u.call(w,{hash:{},data:v})}else{u=w.url;u=typeof u===i?u.apply(w):u}t+=k(u)+'"></a>\n </span>\n ';return t}j+="<div class='info' id='api_info'>\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</div>\n<div class='container' id='resources_container'>\n <ul id='resources'>\n </ul>\n\n <div class=\"footer\">\n <br>\n <br>\n <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: ";if(c=g.basePath){c=c.call(n,{hash:{},data:l})}else{c=n.basePath;c=typeof c===i?c.apply(n):c}j+=k(c)+"\n ";s=g["if"].call(n,((c=n.info),c==null||c===false?c:c.version),{hash:{},inverse:q.noop,fn:q.program(8,o,l),data:l});if(s||s===0){j+=s}j+="]\n ";s=g["if"].call(n,n.validatorUrl,{hash:{},inverse:q.noop,fn:q.program(10,e,l),data:l});if(s||s===0){j+=s}j+="\n </h4>\n </div>\n</div>\n";return j})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.operation=b(function(g,s,q,m,y){this.compilerInfo=[4,">= 1.0.0"];q=this.merge(q,g.helpers);y=y||{};var r="",i,f,e="function",d=this.escapeExpression,p=this,c=q.blockHelperMissing;function o(C,B){var z="",A;z+="\n <h4>Implementation Notes</h4>\n <p>";if(A=q.description){A=A.call(C,{hash:{},data:B})}else{A=C.description;A=typeof A===e?A.apply(C):A}if(A||A===0){z+=A}z+="</p>\n ";return z}function n(A,z){return'\n <div class="auth">\n <span class="api-ic ic-error"></span>'}function l(C,B){var z="",A;z+='\n <div id="api_information_panel" style="top: 526px; left: 776px; display: none;">\n ';A=q.each.call(C,C,{hash:{},inverse:p.noop,fn:p.program(6,k,B),data:B});if(A||A===0){z+=A}z+="\n </div>\n ";return z}function k(D,C){var z="",B,A;z+="\n <div title='";A=((B=D.description),typeof B===e?B.apply(D):B);if(A||A===0){z+=A}z+="'>"+d(((B=D.scope),typeof B===e?B.apply(D):B))+"</div>\n ";return z}function h(A,z){return"</div>"}function x(A,z){return'\n <div class=\'access\'>\n <span class="api-ic ic-off" title="click to authenticate"></span>\n </div>\n '}function w(A,z){return'\n <h4>Response Class</h4>\n <p><span class="model-signature" /></p>\n <br/>\n <div class="response-content-type" />\n '}function v(A,z){return'\n <h4>Parameters</h4>\n <table class=\'fullwidth\'>\n <thead>\n <tr>\n <th style="width: 100px; max-width: 100px">Parameter</th>\n <th style="width: 310px; max-width: 310px">Value</th>\n <th style="width: 200px; max-width: 200px">Description</th>\n <th style="width: 100px; max-width: 100px">Parameter Type</th>\n <th style="width: 220px; max-width: 230px">Data Type</th>\n </tr>\n </thead>\n <tbody class="operation-params">\n\n </tbody>\n </table>\n '}function u(A,z){return"\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Response Messages</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n <th>Response Model</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n "}function t(A,z){return"\n "}function j(A,z){return"\n <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <span class='response_throbber' style='display:none'></span>\n </div>\n "}r+="\n <ul class='operations' >\n <li class='";if(i=q.method){i=i.call(s,{hash:{},data:y})}else{i=s.method;i=typeof i===e?i.apply(s):i}r+=d(i)+" operation' id='";if(i=q.parentId){i=i.call(s,{hash:{},data:y})}else{i=s.parentId;i=typeof i===e?i.apply(s):i}r+=d(i)+"_";if(i=q.nickname){i=i.call(s,{hash:{},data:y})}else{i=s.nickname;i=typeof i===e?i.apply(s):i}r+=d(i)+"'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/";if(i=q.parentId){i=i.call(s,{hash:{},data:y})}else{i=s.parentId;i=typeof i===e?i.apply(s):i}r+=d(i)+"/";if(i=q.nickname){i=i.call(s,{hash:{},data:y})}else{i=s.nickname;i=typeof i===e?i.apply(s):i}r+=d(i)+'\' class="toggleOperation">';if(i=q.method){i=i.call(s,{hash:{},data:y})}else{i=s.method;i=typeof i===e?i.apply(s):i}r+=d(i)+"</a>\n </span>\n <span class='path'>\n <a href='#!/";if(i=q.parentId){i=i.call(s,{hash:{},data:y})}else{i=s.parentId;i=typeof i===e?i.apply(s):i}r+=d(i)+"/";if(i=q.nickname){i=i.call(s,{hash:{},data:y})}else{i=s.nickname;i=typeof i===e?i.apply(s):i}r+=d(i)+'\' class="toggleOperation">';if(i=q.path){i=i.call(s,{hash:{},data:y})}else{i=s.path;i=typeof i===e?i.apply(s):i}r+=d(i)+"</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/";if(i=q.parentId){i=i.call(s,{hash:{},data:y})}else{i=s.parentId;i=typeof i===e?i.apply(s):i}r+=d(i)+"/";if(i=q.nickname){i=i.call(s,{hash:{},data:y})}else{i=s.nickname;i=typeof i===e?i.apply(s):i}r+=d(i)+'\' class="toggleOperation">';if(i=q.summary){i=i.call(s,{hash:{},data:y})}else{i=s.summary;i=typeof i===e?i.apply(s):i}if(i||i===0){r+=i}r+="</a>\n </li>\n </ul>\n </div>\n <div class='content' id='";if(i=q.parentId){i=i.call(s,{hash:{},data:y})}else{i=s.parentId;i=typeof i===e?i.apply(s):i}r+=d(i)+"_";if(i=q.nickname){i=i.call(s,{hash:{},data:y})}else{i=s.nickname;i=typeof i===e?i.apply(s):i}r+=d(i)+"_content' style='display:none'>\n ";i=q["if"].call(s,s.description,{hash:{},inverse:p.noop,fn:p.program(1,o,y),data:y});if(i||i===0){r+=i}r+="\n ";f={hash:{},inverse:p.noop,fn:p.program(3,n,y),data:y};if(i=q.oauth){i=i.call(s,f)}else{i=s.oauth;i=typeof i===e?i.apply(s):i}if(!q.oauth){i=c.call(s,i,f)}if(i||i===0){r+=i}r+="\n ";i=q.each.call(s,s.oauth,{hash:{},inverse:p.noop,fn:p.program(5,l,y),data:y});if(i||i===0){r+=i}r+="\n ";f={hash:{},inverse:p.noop,fn:p.program(8,h,y),data:y};if(i=q.oauth){i=i.call(s,f)}else{i=s.oauth;i=typeof i===e?i.apply(s):i}if(!q.oauth){i=c.call(s,i,f)}if(i||i===0){r+=i}r+="\n ";f={hash:{},inverse:p.noop,fn:p.program(10,x,y),data:y};if(i=q.oauth){i=i.call(s,f)}else{i=s.oauth;i=typeof i===e?i.apply(s):i}if(!q.oauth){i=c.call(s,i,f)}if(i||i===0){r+=i}r+="\n ";i=q["if"].call(s,s.type,{hash:{},inverse:p.noop,fn:p.program(12,w,y),data:y});if(i||i===0){r+=i}r+="\n <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n ";i=q["if"].call(s,s.parameters,{hash:{},inverse:p.noop,fn:p.program(14,v,y),data:y});if(i||i===0){r+=i}r+="\n ";i=q["if"].call(s,s.responseMessages,{hash:{},inverse:p.noop,fn:p.program(16,u,y),data:y});if(i||i===0){r+=i}r+="\n ";i=q["if"].call(s,s.isReadOnly,{hash:{},inverse:p.program(20,j,y),fn:p.program(18,t,y),data:y});if(i||i===0){r+=i}r+="\n </form>\n <div class='response' style='display:none'>\n <h4>Request URL</h4>\n <div class='block request_url'></div>\n <h4>Response Body</h4>\n <div class='block response_body'></div>\n <h4>Response Code</h4>\n <div class='block response_code'></div>\n <h4>Response Headers</h4>\n <div class='block response_headers'></div>\n </div>\n </div>\n </li>\n </ul>\n";return r})})();(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 <input type="file" name=\'';if(w=o.name){w=w.call(y,{hash:{},data:x})}else{w=y.name;w=typeof w===d?w.apply(y):w}v+=c(w)+'\'/>\n <div class="parameter-content-type" />\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 <textarea class='body-textarea' name='";if(w=o.name){w=w.call(y,{hash:{},data:x})}else{w=y.name;w=typeof w===d?w.apply(y):w}v+=c(w)+"'>";if(w=o["default"]){w=w.call(y,{hash:{},data:x})}else{w=y["default"];w=typeof w===d?w.apply(y):w}v+=c(w)+"</textarea>\n ";return v}function h(y,x){var v="",w;v+="\n <textarea class='body-textarea' name='";if(w=o.name){w=w.call(y,{hash:{},data:x})}else{w=y.name;w=typeof w===d?w.apply(y):w}v+=c(w)+'\'></textarea>\n <br />\n <div class="parameter-content-type" />\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 <input class='parameter' minlength='0' name='";if(w=o.name){w=w.call(y,{hash:{},data:x})}else{w=y.name;w=typeof w===d?w.apply(y):w}v+=c(w)+"' placeholder='' type='text' value='";if(w=o["default"]){w=w.call(y,{hash:{},data:x})}else{w=y["default"];w=typeof w===d?w.apply(y):w}v+=c(w)+"'/>\n ";return v}function r(y,x){var v="",w;v+="\n <input class='parameter' minlength='0' name='";if(w=o.name){w=w.call(y,{hash:{},data:x})}else{w=y.name;w=typeof w===d?w.apply(y):w}v+=c(w)+"' placeholder='' type='text' value=''/>\n ";return v}p+="<td class='code'>";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)+"</td>\n<td>\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</td>\n<td>";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+="</td>\n<td>";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+='</td>\n<td>\n <span class="model-signature"></span>\n</td>\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.defaultValue,{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 <option selected=\"\" value=''></option>\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 <option selected="" value=\'';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)+"'>";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)</option>\n ";return z}function u(C,B){var z="",A;z+="\n <option value='";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)+"'>";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)+"</option>\n ";return z}s+="<td class='code'>";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)+"</td>\n<td>\n <select ";e={hash:{},inverse:p.noop,fn:p.program(1,o,y),data:y};g=((j=r.isArray||t.isArray),j?j.call(t,t,e):q.call(t,"isArray",t,e));if(g||g===0){s+=g}s+=" class='parameter' name='";if(g=r.name){g=g.call(t,{hash:{},data:y})}else{g=t.name;g=typeof g===d?g.apply(t):g}s+=c(g)+"'>\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 </select>\n</td>\n<td>";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+="</td>\n<td>";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+='</td>\n<td><span class="model-signature"></span></td>';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 <textarea class='body-textarea' readonly='readonly' name='";if(r=f.name){r=r.call(t,{hash:{},data:s})}else{r=t.name;r=typeof r===h?r.apply(t):r}q+=j(r)+"'>";if(r=f.defaultValue){r=r.call(t,{hash:{},data:s})}else{r=t.defaultValue;r=typeof r===h?r.apply(t):r}q+=j(r)+"</textarea>\n ";return q}function c(t,s){var q="",r;q+="\n ";r=f["if"].call(t,t.defaultValue,{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.defaultValue){r=r.call(t,{hash:{},data:s})}else{r=t.defaultValue;r=typeof r===h?r.apply(t):r}q+=j(r)+"\n ";return q}function n(r,q){return"\n (empty)\n "}i+="<td class='code'>";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)+"</td>\n<td>\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</td>\n<td>";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+="</td>\n<td>";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+='</td>\n<td><span class="model-signature"></span></td>\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 <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='";if(r=f.name){r=r.call(t,{hash:{},data:s})}else{r=t.name;r=typeof r===h?r.apply(t):r}q+=j(r)+"'>";if(r=f.defaultValue){r=r.call(t,{hash:{},data:s})}else{r=t.defaultValue;r=typeof r===h?r.apply(t):r}q+=j(r)+"</textarea>\n ";return q}function c(t,s){var q="",r;q+="\n ";r=f["if"].call(t,t.defaultValue,{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.defaultValue){r=r.call(t,{hash:{},data:s})}else{r=t.defaultValue;r=typeof r===h?r.apply(t):r}q+=j(r)+"\n ";return q}function n(r,q){return"\n (empty)\n "}i+="<td class='code required'>";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)+"</td>\n<td>\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</td>\n<td>";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+="</td>\n<td>";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+='</td>\n<td><span class="model-signature"></span></td>\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 <input type="file" name=\'';if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"'/>\n ";return w}function k(z,y){var w="",x;w+="\n ";x=o["if"].call(z,z.defaultValue,{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 <textarea class='body-textarea' placeholder='(required)' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"'>";if(x=o.defaultValue){x=x.call(z,{hash:{},data:y})}else{x=z.defaultValue;x=typeof x===d?x.apply(z):x}w+=c(x)+"</textarea>\n ";return w}function h(z,y){var w="",x;w+="\n <textarea class='body-textarea' placeholder='(required)' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+'\'></textarea>\n <br />\n <div class="parameter-content-type" />\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 <input class='parameter' class='required' type='file' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"'/>\n ";return w}function t(z,y){var w="",x;w+="\n ";x=o["if"].call(z,z.defaultValue,{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 <input class='parameter required' minlength='1' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"' placeholder='(required)' type='text' value='";if(x=o.defaultValue){x=x.call(z,{hash:{},data:y})}else{x=z.defaultValue;x=typeof x===d?x.apply(z):x}w+=c(x)+"'/>\n ";return w}function r(z,y){var w="",x;w+="\n <input class='parameter required' minlength='1' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"' placeholder='(required)' type='text' value=''/>\n ";return w}p+="<td class='code required'>";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)+"</td>\n<td>\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</td>\n<td>\n <strong>";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+="</strong>\n</td>\n<td>";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+='</td>\n<td><span class="model-signature"></span></td>\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 <option value="';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+='">';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+="</option>\n ";return o}function n(p,o){return'\n <option value="application/json">application/json</option>\n'}i+='<label for="parameterContentType"></label>\n<select name="parameterContentType">\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</select>\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+="<li>\n <a href='";if(r=f.url){r=r.call(t,{hash:{},data:s})}else{r=t.url;r=typeof r===h?r.apply(t):r}q+=j(r)+"'>Raw</a>\n </li>";return q}i+="<div class='heading'>\n <h2>\n <a href='#!/";if(d=f.id){d=d.call(m,{hash:{},data:k})}else{d=m.id;d=typeof d===h?d.apply(m):d}i+=j(d)+'\' class="toggleEndpointList" data-id="';if(d=f.id){d=d.call(m,{hash:{},data:k})}else{d=m.id;d=typeof d===h?d.apply(m):d}i+=j(d)+'">';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)+"</a> ";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 </h2>\n <ul class='options'>\n <li>\n <a href='#!/";if(d=f.id){d=d.call(m,{hash:{},data:k})}else{d=m.id;d=typeof d===h?d.apply(m):d}i+=j(d)+"' id='endpointListTogger_";if(d=f.id){d=d.call(m,{hash:{},data:k})}else{d=m.id;d=typeof d===h?d.apply(m):d}i+=j(d)+'\' class="toggleEndpointList" data-id="';if(d=f.id){d=d.call(m,{hash:{},data:k})}else{d=m.id;d=typeof d===h?d.apply(m):d}i+=j(d)+'">Show/Hide</a>\n </li>\n <li>\n <a href=\'#\' class="collapseResource" data-id="';if(d=f.id){d=d.call(m,{hash:{},data:k})}else{d=m.id;d=typeof d===h?d.apply(m):d}i+=j(d)+'">\n List Operations\n </a>\n </li>\n <li>\n <a href=\'#\' class="expandResource" data-id=';if(d=f.id){d=d.call(m,{hash:{},data:k})}else{d=m.id;d=typeof d===h?d.apply(m):d}i+=j(d)+">\n Expand Operations\n </a>\n </li>\n ";p={hash:{},inverse:o.noop,fn:o.program(3,c,k),data:k};if(d=f.url){d=d.call(m,p)}else{d=m.url;d=typeof d===h?d.apply(m):d}if(!f.url){d=n.call(m,d,p)}if(d||d===0){i+=d}i+="\n </ul>\n</div>\n<ul class='endpoints' id='";if(d=f.id){d=d.call(m,{hash:{},data:k})}else{d=m.id;d=typeof d===h?d.apply(m):d}i+=j(d)+"_endpoint_list' style='display:none'>\n\n</ul>\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 <option value="';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+='">';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+="</option>\n ";return o}function n(p,o){return'\n <option value="application/json">application/json</option>\n'}i+='<label for="responseContentType"></label>\n<select name="responseContentType">\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</select>\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+='<div>\n<ul class="signature-nav">\n <li><a class="description-link" href="#">Model</a></li>\n <li><a class="snippet-link" href="#">Model Schema</a></li>\n</ul>\n<div>\n\n<div class="signature-container">\n <div class="description">\n ';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 </div>\n\n <div class="snippet">\n <pre><code>';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)+'</code></pre>\n <small class="notice"></small>\n </div>\n</div>\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+="<td width='15%' class='code'>";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)+"</td>\n<td>";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+="</td>\n<td width='50%'><span class=\"model-signature\" /></td>";return g})})();(function(){var j,r,u,o,l,k,n,m,i,p,s,q,h,c,g,f,e,d,b,a,x,w,t={}.hasOwnProperty,v=function(B,z){for(var y in z){if(t.call(z,y)){B[y]=z[y]}}function A(){this.constructor=B}A.prototype=z.prototype;B.prototype=new A();B.__super__=z.prototype;return B};s=(function(z){v(y,z);function y(){q=y.__super__.constructor.apply(this,arguments);return q}y.prototype.dom_id="swagger_ui";y.prototype.options=null;y.prototype.api=null;y.prototype.headerView=null;y.prototype.mainView=null;y.prototype.initialize=function(A){var B=this;if(A==null){A={}}if(A.dom_id!=null){this.dom_id=A.dom_id;delete A.dom_id}if($("#"+this.dom_id)==null){$("body").append('<div id="'+this.dom_id+'"></div>')}this.options=A;this.options.success=function(){return B.render()};this.options.progress=function(C){return B.showMessage(C)};this.options.failure=function(C){if(B.api&&B.api.isValid===false){log("not a valid 2.0 spec, loading legacy client");B.api=new SwaggerApi(B.options);return B.api.build()}else{return B.onLoadFailure(C)}};this.headerView=new r({el:$("#header")});return this.headerView.on("update-swagger-ui",function(C){return B.updateSwaggerUi(C)})};y.prototype.updateSwaggerUi=function(A){this.options.url=A.url;return this.load()};y.prototype.load=function(){var B,A;if((A=this.mainView)!=null){A.clear()}B=this.options.url;if(B.indexOf("http")!==0){B=this.buildUrl(window.location.href.toString(),B)}this.options.url=B;this.headerView.update(B);this.api=new SwaggerClient(this.options);return this.api.build()};y.prototype.render=function(){var A=this;this.showMessage("Finished Loading Resource Information. Rendering Swagger UI...");this.mainView=new u({model:this.api,el:$("#"+this.dom_id),swaggerOptions:this.options}).render();this.showMessage();switch(this.options.docExpansion){case"full":Docs.expandOperationsForResource("");break;case"list":Docs.collapseOperationsForResource("")}if(this.options.onComplete){this.options.onComplete(this.api,this)}return setTimeout(function(){return Docs.shebang()},400)};y.prototype.buildUrl=function(C,A){var B,D;log("base is "+C);if(A.indexOf("/")===0){D=C.split("/");C=D[0]+"//"+D[2];return C+A}else{B=C.length;if(C.indexOf("?")>-1){B=Math.min(B,C.indexOf("?"))}if(C.indexOf("#")>-1){B=Math.min(B,C.indexOf("#"))}C=C.substring(0,B);if(C.indexOf("/",C.length-1)!==-1){return C+A}return C+"/"+A}};y.prototype.showMessage=function(A){if(A==null){A=""}$("#message-bar").removeClass("message-fail");$("#message-bar").addClass("message-success");return $("#message-bar").html(A)};y.prototype.onLoadFailure=function(A){var B;if(A==null){A=""}$("#message-bar").removeClass("message-success");$("#message-bar").addClass("message-fail");B=$("#message-bar").html(A);if(this.options.onFailure!=null){this.options.onFailure(A)}return B};return y})(Backbone.Router);window.SwaggerUi=s;r=(function(z){v(y,z);function y(){h=y.__super__.constructor.apply(this,arguments);return h}y.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"};y.prototype.initialize=function(){};y.prototype.showPetStore=function(A){return this.trigger("update-swagger-ui",{url:"http://petstore.swagger.wordnik.com/api/api-docs"})};y.prototype.showWordnikDev=function(A){return this.trigger("update-swagger-ui",{url:"http://api.wordnik.com/v4/resources.json"})};y.prototype.showCustomOnKeyup=function(A){if(A.keyCode===13){return this.showCustom()}};y.prototype.showCustom=function(A){if(A!=null){A.preventDefault()}return this.trigger("update-swagger-ui",{url:$("#input_baseUrl").val(),apiKey:$("#input_apiKey").val()})};y.prototype.update=function(B,C,A){if(A==null){A=false}$("#input_baseUrl").val(B);if(A){return this.trigger("update-swagger-ui",{url:B})}};return y})(Backbone.View);u=(function(y){var z;v(A,y);function A(){g=A.__super__.constructor.apply(this,arguments);return g}z={alpha:function(C,B){return C.path.localeCompare(B.path)},method:function(C,B){return C.method.localeCompare(B.method)}};A.prototype.initialize=function(B){var C,I,J,E,D,G,H,F;if(B==null){B={}}if(B.swaggerOptions.sorter){E=B.swaggerOptions.sorter;J=z[E];if(this.model.apisArray){F=this.model.apisArray;for(G=0,H=F.length;G<H;G++){I=F[G];I.operationsArray.sort(J)}if(E==="alpha"){this.model.apisArray.sort(J)}}}if(this.model.info&&this.model.info.license&&typeof this.model.info.license==="string"){C=this.model.info.license;D=this.model.info.licenseUrl;this.model.info.license={};this.model.info.license.name=C;this.model.info.license.url=D}if(!this.model.info){this.model.info={}}if(!this.model.info.version){this.model.info.version=this.model.apiVersion}if(this.model.url.indexOf("http://localhost")===-1&&this.model.swaggerVersion===2){return this.model.validatorUrl=this.model.url}};A.prototype.render=function(){var C,H,E,F,D,B,G;$(this.el).html(Handlebars.templates.main(this.model));F={};C=0;G=this.model.apisArray;for(D=0,B=G.length;D<B;D++){E=G[D];H=E.name;while(typeof F[H]!=="undefined"){H=H+"_"+C;C+=1}E.id=H;F[H]=E;this.addResource(E)}return this};A.prototype.addResource=function(C){var B;C.id=C.id.replace(/\s/g,"_");B=new n({model:C,tagName:"li",id:"resource_"+C.id,className:"resource",swaggerOptions:this.options.swaggerOptions});return $("#resources").append(B.render().el)};A.prototype.clear=function(){return $(this.el).html("")};return A})(Backbone.View);n=(function(z){v(y,z);function y(){f=y.__super__.constructor.apply(this,arguments);return f}y.prototype.initialize=function(){if(""===this.model.description){return this.model.description=null}};y.prototype.render=function(){var B,G,D,C,E,A,F;$(this.el).html(Handlebars.templates.resource(this.model));D={};if(this.model.description){this.model.summary=this.model.description}F=this.model.operationsArray;for(E=0,A=F.length;E<A;E++){C=F[E];B=0;G=C.nickname;while(typeof D[G]!=="undefined"){G=G+"_"+B;B+=1}D[G]=C;C.nickname=G;C.parentId=this.model.id;this.addOperation(C)}$(".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};y.prototype.addOperation=function(A){var B;A.number=this.number;B=new o({model:A,tagName:"li",className:"endpoint",swaggerOptions:this.options.swaggerOptions});$(".endpoints",$(this.el)).append(B.render().el);return this.number++};y.prototype.callDocs=function(B,A){A.preventDefault();return Docs[B](A.currentTarget.getAttribute("data-id"))};return y})(Backbone.View);o=(function(z){v(y,z);function y(){e=y.__super__.constructor.apply(this,arguments);return e}y.prototype.invocationUrl=null;y.prototype.events={"submit .sandbox":"submitOperation","click .submit":"submitOperation","click .response_hider":"hideResponse","click .toggleOperation":"toggleOperationContent","mouseenter .api-ic":"mouseEnter","mouseout .api-ic":"mouseExit"};y.prototype.initialize=function(){};y.prototype.mouseEnter=function(F){var D,E,I,B,A,J,G,C,K,H;D=$(F.currentTarget.parentNode).find("#api_information_panel");K=F.pageX;H=F.pageY;J=$(window).scrollLeft();G=$(window).scrollTop();B=J+$(window).width();A=G+$(window).height();C=D.width();E=D.height();if(K+C>B){K=B-C}if(K<J){K=J}if(H+E>A){H=A-E}if(H<G){H=G}I={};I.top=H;I.left=K;D.css(I);return $(F.currentTarget.parentNode).find("#api_information_panel").show()};y.prototype.mouseExit=function(A){return $(A.currentTarget.parentNode).find("#api_information_panel").hide()};y.prototype.render=function(){var D,U,V,T,R,K,J,Q,L,P,W,O,M,I,N,S,H,G,F,C,Y,ab,Z,X,E,B,A,ac,aa;V=true;if(!V){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,"<br />")}this.model.oauth=null;if(this.model.authorizations){E=this.model.authorizations;for(T in E){N=E[T];if(T==="oauth2"){if(this.model.oauth===null){this.model.oauth={}}if(this.model.oauth.scopes===void 0){this.model.oauth.scopes=[]}for(H=0,Y=N.length;H<Y;H++){R=N[H];this.model.oauth.scopes.push(R)}}}}if(typeof this.model.responses!=="undefined"){this.model.responseMessages=[];B=this.model.responses;for(D in B){S=B[D];P=null;W=this.model.responses[D].schema;if(W&&W["$ref"]){P=W["$ref"];if(P.indexOf("#/definitions/")===0){P=P.substring("#/definitions/".length)}}this.model.responseMessages.push({code:D,message:S.description,responseModel:P})}}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"){O={sampleJSON:this.model.responseSampleJSON,isParam:false,signature:this.model.responseClassSignature};L=new i({model:O,tagName:"div"});$(".model-signature",$(this.el)).append(L.render().el)}else{this.model.responseClassSignature="string";$(".model-signature",$(this.el)).html(this.model.type)}U={isParam:false};U.consumes=this.model.consumes;U.produces=this.model.produces;A=this.model.parameters;for(G=0,ab=A.length;G<ab;G++){K=A[G];I=K.type||K.dataType;if(typeof I==="undefined"){P=K.schema;if(P&&P["$ref"]){J=P["$ref"];if(J.indexOf("#/definitions/")===0){I=J.substring("#/definitions/".length)}else{I=J}}}if(I&&I.toLowerCase()==="file"){if(!U.consumes){U.consumes="multipart/form-data"}}K.type=I}Q=new m({model:U});$(".response-content-type",$(this.el)).append(Q.render().el);ac=this.model.parameters;for(F=0,Z=ac.length;F<Z;F++){K=ac[F];this.addParameter(K,U.consumes)}aa=this.model.responseMessages;for(C=0,X=aa.length;C<X;C++){M=aa[C];this.addStatusCode(M)}return this};y.prototype.addParameter=function(C,A){var B;C.consumes=A;B=new k({model:C,tagName:"tr",readOnly:this.model.isReadOnly});return $(".operation-params",$(this.el)).append(B.render().el)};y.prototype.addStatusCode=function(B){var A;A=new p({model:B,tagName:"tr"});return $(".operation-status",$(this.el)).append(A.render().el)};y.prototype.submitOperation=function(O){var Q,G,N,D,I,A,J,M,L,K,P,F,C,H,E,B;if(O!=null){O.preventDefault()}G=$(".sandbox",$(this.el));Q=true;G.find("input.required").each(function(){var R=this;$(this).removeClass("error");if(jQuery.trim($(this).val())===""){$(this).addClass("error");$(this).wiggle({callback:function(){return $(R).focus()}});return Q=false}});if(Q){D={};A={parent:this};N=false;H=G.find("input");for(M=0,P=H.length;M<P;M++){I=H[M];if((I.value!=null)&&jQuery.trim(I.value).length>0){D[I.name]=I.value}if(I.type==="file"){N=true}}E=G.find("textarea");for(L=0,F=E.length;L<F;L++){I=E[L];if((I.value!=null)&&jQuery.trim(I.value).length>0){D.body=I.value}}B=G.find("select");for(K=0,C=B.length;K<C;K++){I=B[K];J=this.getSelectedValue(I);if((J!=null)&&jQuery.trim(J).length>0){D[I.name]=J}}A.responseContentType=$("div select[name=responseContentType]",$(this.el)).val();A.requestContentType=$("div select[name=parameterContentType]",$(this.el)).val();$(".response_throbber",$(this.el)).show();if(N){return this.handleFileUpload(D,G)}else{return this.model["do"](D,A,this.showCompleteStatus,this.showErrorStatus,this)}}};y.prototype.success=function(A,B){return B.showCompleteStatus(A)};y.prototype.handleFileUpload=function(R,I){var M,H,C,N,L,K,P,J,G,F,D,Q,U,T,S,E,B,A,V,O=this;E=I.serializeArray();for(J=0,Q=E.length;J<Q;J++){N=E[J];if((N.value!=null)&&jQuery.trim(N.value).length>0){R[N.name]=N.value}}M=new FormData();P=0;B=this.model.parameters;for(G=0,U=B.length;G<U;G++){K=B[G];if(K.paramType==="form"){if(K.type.toLowerCase()!=="file"&&R[K.name]!==void 0){M.append(K.name,R[K.name])}}}C={};A=this.model.parameters;for(F=0,T=A.length;F<T;F++){K=A[F];if(K.paramType==="header"){C[K.name]=R[K.name]}}V=I.find('input[type~="file"]');for(D=0,S=V.length;D<S;D++){H=V[D];if(typeof H.files[0]!=="undefined"){M.append($(H).attr("name"),H.files[0]);P+=1}}this.invocationUrl=this.model.supportHeaderParams()?(C=this.model.getHeaderParams(R),this.model.urlify(R,false)):this.model.urlify(R,true);$(".request_url",$(this.el)).html("<pre></pre>");$(".request_url pre",$(this.el)).text(this.invocationUrl);L={type:this.model.method,url:this.invocationUrl,headers:C,data:M,dataType:"json",contentType:false,processData:false,error:function(X,Y,W){return O.showErrorStatus(O.wrap(X),O)},success:function(W){return O.showResponse(W,O)},complete:function(W){return O.showCompleteStatus(O.wrap(W),O)}};if(window.authorizations){window.authorizations.apply(L)}if(P===0){L.data.append("fake","true")}jQuery.ajax(L);return false};y.prototype.wrap=function(E){var C,F,H,B,G,D,A;H={};F=E.getAllResponseHeaders().split("\r");for(D=0,A=F.length;D<A;D++){B=F[D];C=B.split(":");if(C[0]!==void 0&&C[1]!==void 0){H[C[0].trim()]=C[1].trim()}}G={};G.content={};G.content.data=E.responseText;G.headers=H;G.request={};G.request.url=this.invocationUrl;G.status=E.status;return G};y.prototype.getSelectedValue=function(A){var D,C,F,B,E;if(!A.multiple){return A.value}else{C=[];E=A.options;for(F=0,B=E.length;F<B;F++){D=E[F];if(D.selected){C.push(D.value)}}if(C.length>0){return C}else{return null}}};y.prototype.hideResponse=function(A){if(A!=null){A.preventDefault()}$(".response",$(this.el)).slideUp();return $(".response_hider",$(this.el)).fadeOut()};y.prototype.showResponse=function(A){var B;B=JSON.stringify(A,null,"\t").replace(/\n/g,"<br>");return $(".response_body",$(this.el)).html(escape(B))};y.prototype.showErrorStatus=function(B,A){return A.showStatus(B)};y.prototype.showCompleteStatus=function(B,A){return A.showStatus(B)};y.prototype.formatXml=function(H){var D,G,B,I,N,J,C,A,L,M,F,E,K;A=/(>)(<)(\/*)/g;M=/[ ]*(.*)[ ]+\n/g;D=/(<.+>)(.+\n)/g;H=H.replace(A,"$1\n$2$3").replace(M,"$1\n").replace(D,"$1\n$2");C=0;G="";N=H.split("\n");B=0;I="other";L={"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};F=function(T){var P,O,R,V,S,Q,U;Q={single:Boolean(T.match(/<.+\/>/)),closing:Boolean(T.match(/<\/.+>/)),opening:Boolean(T.match(/<[^!?].*>/))};S=((function(){var W;W=[];for(R in Q){U=Q[R];if(U){W.push(R)}}return W})())[0];S=S===void 0?"other":S;P=I+"->"+S;I=S;V="";B+=L[P];V=((function(){var X,Y,W;W=[];for(O=X=0,Y=B;0<=Y?X<Y:X>Y;O=0<=Y?++X:--X){W.push(" ")}return W})()).join("");if(P==="opening->closing"){return G=G.substr(0,G.length-1)+T+"\n"}else{return G+=V+T+"\n"}};for(E=0,K=N.length;E<K;E++){J=N[E];F(J)}return G};y.prototype.showStatus=function(F){var C,J,L,I,D,M,A,E,H,G,B;if(F.content===void 0){J=F.data;B=F.url}else{J=F.content.data;B=F.request.url}D=F.headers;L=D&&D["Content-Type"]?D["Content-Type"].split(";")[0].trim():null;if(!J){C=$("<code />").text("no content");E=$('<pre class="json" />').append(C)}else{if(L==="application/json"||/\+json$/.test(L)){M=null;try{M=JSON.stringify(JSON.parse(J),null," ")}catch(K){I=K;M="can't parse JSON. Raw result:\n\n"+J}C=$("<code />").text(M);E=$('<pre class="json" />').append(C)}else{if(L==="application/xml"||/\+xml$/.test(L)){C=$("<code />").text(this.formatXml(J));E=$('<pre class="xml" />').append(C)}else{if(L==="text/html"){C=$("<code />").html(_.escape(J));E=$('<pre class="xml" />').append(C)}else{if(/^image\//.test(L)){E=$("<img>").attr("src",B)}else{C=$("<code />").text(J);E=$('<pre class="json" />').append(C)}}}}}H=E;$(".request_url",$(this.el)).html("<pre></pre>");$(".request_url pre",$(this.el)).text(B);$(".response_code",$(this.el)).html("<pre>"+F.status+"</pre>");$(".response_body",$(this.el)).html(H);$(".response_headers",$(this.el)).html("<pre>"+_.escape(JSON.stringify(F.headers,null," ")).replace(/\n/g,"<br>")+"</pre>");$(".response",$(this.el)).slideDown();$(".response_hider",$(this.el)).show();$(".response_throbber",$(this.el)).hide();G=$(".response_body",$(this.el))[0];A=this.options.swaggerOptions;if(A.highlightSizeThreshold&&F.data.length>A.highlightSizeThreshold){return G}else{return hljs.highlightBlock(G)}};y.prototype.toggleOperationContent=function(){var A;A=$("#"+Docs.escapeResourceName(this.model.parentId)+"_"+this.model.nickname+"_content");if(A.is(":visible")){return Docs.collapseOperation(A)}else{return Docs.expandOperation(A)}};return y})(Backbone.View);p=(function(z){v(y,z);function y(){d=y.__super__.constructor.apply(this,arguments);return d}y.prototype.initialize=function(){};y.prototype.render=function(){var B,A,C;C=this.template();$(this.el).html(C(this.model));if(swaggerUi.api.models.hasOwnProperty(this.model.responseModel)){B={sampleJSON:JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(),null,2),isParam:false,signature:swaggerUi.api.models[this.model.responseModel].getMockSignature()};A=new i({model:B,tagName:"div"});$(".model-signature",this.$el).append(A.render().el)}else{$(".model-signature",this.$el).html("")}return this};y.prototype.template=function(){return Handlebars.templates.status_code};return y})(Backbone.View);k=(function(z){v(y,z);function y(){b=y.__super__.constructor.apply(this,arguments);return b}y.prototype.initialize=function(){return Handlebars.registerHelper("isArray",function(B,A){if(B.type.toLowerCase()==="array"||B.allowMultiple){return A.fn(this)}else{return A.inverse(this)}})};y.prototype.render=function(){var A,B,E,C,F,D,I,J,H,G;G=this.model.type||this.model.dataType;if(typeof G==="undefined"){D=this.model.schema;if(D&&D["$ref"]){C=D["$ref"];if(C.indexOf("#/definitions/")===0){G=C.substring("#/definitions/".length)}else{G=C}}}this.model.type=G;this.model.paramType=this.model["in"]||this.model.paramType;if(this.model.paramType==="body"){this.model.isBody=true}if(G&&G.toLowerCase()==="file"){this.model.isFile=true}this.model["default"]=this.model["default"]||this.model.defaultValue;H=this.template();$(this.el).html(H(this.model));I={sampleJSON:this.model.sampleJSON,isParam:true,signature:this.model.signature};if(this.model.sampleJSON){J=new i({model:I,tagName:"div"});$(".model-signature",$(this.el)).append(J.render().el)}else{$(".model-signature",$(this.el)).html(this.model.signature)}B=false;if(this.model.isBody){B=true}A={isParam:B};A.consumes=this.model.consumes;if(B){E=new l({model:A});$(".parameter-content-type",$(this.el)).append(E.render().el)}else{F=new m({model:A});$(".response-content-type",$(this.el)).append(F.render().el)}return this};y.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 y})(Backbone.View);i=(function(z){v(y,z);function y(){a=y.__super__.constructor.apply(this,arguments);return a}y.prototype.events={"click a.description-link":"switchToDescription","click a.snippet-link":"switchToSnippet","mousedown .snippet":"snippetToTextArea"};y.prototype.initialize=function(){};y.prototype.render=function(){var A;A=this.template();$(this.el).html(A(this.model));this.switchToSnippet();this.isParam=this.model.isParam;if(this.isParam){$(".notice",$(this.el)).text("Click to set as parameter value")}return this};y.prototype.template=function(){return Handlebars.templates.signature};y.prototype.switchToDescription=function(A){if(A!=null){A.preventDefault()}$(".snippet",$(this.el)).hide();$(".description",$(this.el)).show();$(".description-link",$(this.el)).addClass("selected");return $(".snippet-link",$(this.el)).removeClass("selected")};y.prototype.switchToSnippet=function(A){if(A!=null){A.preventDefault()}$(".description",$(this.el)).hide();$(".snippet",$(this.el)).show();$(".snippet-link",$(this.el)).addClass("selected");return $(".description-link",$(this.el)).removeClass("selected")};y.prototype.snippetToTextArea=function(A){var B;if(this.isParam){if(A!=null){A.preventDefault()}B=$("textarea",$(this.el.parentNode.parentNode.parentNode));if($.trim(B.val())===""){return B.val(this.model.sampleJSON)}}};return y})(Backbone.View);j=(function(y){v(z,y);function z(){x=z.__super__.constructor.apply(this,arguments);return x}z.prototype.initialize=function(){};z.prototype.render=function(){var A;A=this.template();$(this.el).html(A(this.model));$("label[for=contentType]",$(this.el)).text("Response Content Type");return this};z.prototype.template=function(){return Handlebars.templates.content_type};return z})(Backbone.View);m=(function(y){v(z,y);function z(){w=z.__super__.constructor.apply(this,arguments);return w}z.prototype.initialize=function(){};z.prototype.render=function(){var A;A=this.template();$(this.el).html(A(this.model));$("label[for=responseContentType]",$(this.el)).text("Response Content Type");return this};z.prototype.template=function(){return Handlebars.templates.response_content_type};return z})(Backbone.View);l=(function(z){v(y,z);function y(){c=y.__super__.constructor.apply(this,arguments);return c}y.prototype.initialize=function(){};y.prototype.render=function(){var A;A=this.template();$(this.el).html(A(this.model));$("label[for=parameterContentType]",$(this.el)).text("Parameter content type:");return this};y.prototype.template=function(){return Handlebars.templates.parameter_content_type};return y})(Backbone.View)}).call(this); | ||
$(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.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 <option value="';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+='">';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+="</option>\n ";return o}function n(p,o){return'\n <option value="application/json">application/json</option>\n'}i+='<label for="contentType"></label>\n<select name="contentType">\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</select>\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 <div class="info_title">'+k(((v=((v=x.info),v==null||v===false?v:v.title)),typeof v===i?v.apply(x):v))+'</div>\n <div class="info_description">';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+="</div>\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+='<div class="info_tos"><a href="'+k(((u=((u=w.info),u==null||u===false?u:u.termsOfServiceUrl)),typeof u===i?u.apply(w):u))+'">Terms of service</a></div>';return t}function r(w,v){var t="",u;t+="<div class='info_contact'><a href=\"mailto:"+k(((u=((u=((u=w.info),u==null||u===false?u:u.contact)),u==null||u===false?u:u.name)),typeof u===i?u.apply(w):u))+'">Contact the developer</a></div>';return t}function p(w,v){var t="",u;t+="<div class='info_license'><a href='"+k(((u=((u=((u=w.info),u==null||u===false?u:u.license)),u==null||u===false?u:u.url)),typeof u===i?u.apply(w):u))+"'>"+k(((u=((u=((u=w.info),u==null||u===false?u:u.license)),u==null||u===false?u:u.name)),typeof u===i?u.apply(w):u))+"</a></div>";return t}function o(w,v){var t="",u;t+='\n , <span style="font-variant: small-caps">api version</span>: '+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 <span style="float:right"><a href="';if(u=g.validatorUrl){u=u.call(w,{hash:{},data:v})}else{u=w.validatorUrl;u=typeof u===i?u.apply(w):u}t+=k(u)+"/debug?url=";if(u=g.url){u=u.call(w,{hash:{},data:v})}else{u=w.url;u=typeof u===i?u.apply(w):u}t+=k(u)+'"><img id="validator" src="';if(u=g.validatorUrl){u=u.call(w,{hash:{},data:v})}else{u=w.validatorUrl;u=typeof u===i?u.apply(w):u}t+=k(u)+"?url=";if(u=g.url){u=u.call(w,{hash:{},data:v})}else{u=w.url;u=typeof u===i?u.apply(w):u}t+=k(u)+'"></a>\n </span>\n ';return t}j+="<div class='info' id='api_info'>\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</div>\n<div class='container' id='resources_container'>\n <ul id='resources'>\n </ul>\n\n <div class=\"footer\">\n <br>\n <br>\n <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: ";if(c=g.basePath){c=c.call(n,{hash:{},data:l})}else{c=n.basePath;c=typeof c===i?c.apply(n):c}j+=k(c)+"\n ";s=g["if"].call(n,((c=n.info),c==null||c===false?c:c.version),{hash:{},inverse:q.noop,fn:q.program(8,o,l),data:l});if(s||s===0){j+=s}j+="]\n ";s=g["if"].call(n,n.validatorUrl,{hash:{},inverse:q.noop,fn:q.program(10,e,l),data:l});if(s||s===0){j+=s}j+="\n </h4>\n </div>\n</div>\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 <h4>Warning: Deprecated</h4>\n "}function n(E,D){var B="",C;B+="\n <h4>Implementation Notes</h4>\n <p>";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+="</p>\n ";return B}function m(C,B){return'\n <div class="auth">\n <span class="api-ic ic-error"></span>'}function i(E,D){var B="",C;B+='\n <div id="api_information_panel" style="top: 526px; left: 776px; display: none;">\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 </div>\n ";return B}function z(F,E){var B="",D,C;B+="\n <div title='";C=((D=F.description),typeof D===e?D.apply(F):D);if(C||C===0){B+=C}B+="'>"+d(((D=F.scope),typeof D===e?D.apply(F):D))+"</div>\n ";return B}function y(C,B){return"</div>"}function x(C,B){return'\n <div class=\'access\'>\n <span class="api-ic ic-off" title="click to authenticate"></span>\n </div>\n '}function w(C,B){return'\n <h4>Response Class</h4>\n <p><span class="model-signature" /></p>\n <br/>\n <div class="response-content-type" />\n '}function v(C,B){return'\n <h4>Parameters</h4>\n <table class=\'fullwidth\'>\n <thead>\n <tr>\n <th style="width: 100px; max-width: 100px">Parameter</th>\n <th style="width: 310px; max-width: 310px">Value</th>\n <th style="width: 200px; max-width: 200px">Description</th>\n <th style="width: 100px; max-width: 100px">Parameter Type</th>\n <th style="width: 220px; max-width: 230px">Data Type</th>\n </tr>\n </thead>\n <tbody class="operation-params">\n\n </tbody>\n </table>\n '}function l(C,B){return"\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Response Messages</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n <th>Response Model</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n "}function h(C,B){return"\n "}function g(C,B){return"\n <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <span class='response_throbber' style='display:none'></span>\n </div>\n "}t+="\n <ul class='operations' >\n <li class='";if(k=s.method){k=k.call(u,{hash:{},data:A})}else{k=u.method;k=typeof k===e?k.apply(u):k}t+=d(k)+" operation' id='";if(k=s.parentId){k=k.call(u,{hash:{},data:A})}else{k=u.parentId;k=typeof k===e?k.apply(u):k}t+=d(k)+"_";if(k=s.nickname){k=k.call(u,{hash:{},data:A})}else{k=u.nickname;k=typeof k===e?k.apply(u):k}t+=d(k)+"'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/";if(k=s.parentId){k=k.call(u,{hash:{},data:A})}else{k=u.parentId;k=typeof k===e?k.apply(u):k}t+=d(k)+"/";if(k=s.nickname){k=k.call(u,{hash:{},data:A})}else{k=u.nickname;k=typeof k===e?k.apply(u):k}t+=d(k)+'\' class="toggleOperation">';if(k=s.method){k=k.call(u,{hash:{},data:A})}else{k=u.method;k=typeof k===e?k.apply(u):k}t+=d(k)+"</a>\n </span>\n <span class='path'>\n <a href='#!/";if(k=s.parentId){k=k.call(u,{hash:{},data:A})}else{k=u.parentId;k=typeof k===e?k.apply(u):k}t+=d(k)+"/";if(k=s.nickname){k=k.call(u,{hash:{},data:A})}else{k=u.nickname;k=typeof k===e?k.apply(u):k}t+=d(k)+"' class=\"toggleOperation ";k=s["if"].call(u,u.deprecated,{hash:{},inverse:r.noop,fn:r.program(1,q,A),data:A});if(k||k===0){t+=k}t+='">';if(k=s.path){k=k.call(u,{hash:{},data:A})}else{k=u.path;k=typeof k===e?k.apply(u):k}t+=d(k)+"</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/";if(k=s.parentId){k=k.call(u,{hash:{},data:A})}else{k=u.parentId;k=typeof k===e?k.apply(u):k}t+=d(k)+"/";if(k=s.nickname){k=k.call(u,{hash:{},data:A})}else{k=u.nickname;k=typeof k===e?k.apply(u):k}t+=d(k)+'\' class="toggleOperation">';if(k=s.summary){k=k.call(u,{hash:{},data:A})}else{k=u.summary;k=typeof k===e?k.apply(u):k}if(k||k===0){t+=k}t+="</a>\n </li>\n </ul>\n </div>\n <div class='content' id='";if(k=s.parentId){k=k.call(u,{hash:{},data:A})}else{k=u.parentId;k=typeof k===e?k.apply(u):k}t+=d(k)+"_";if(k=s.nickname){k=k.call(u,{hash:{},data:A})}else{k=u.nickname;k=typeof k===e?k.apply(u):k}t+=d(k)+"_content' style='display:none'>\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 <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n ";k=s["if"].call(u,u.parameters,{hash:{},inverse:r.noop,fn:r.program(18,v,A),data:A});if(k||k===0){t+=k}t+="\n ";k=s["if"].call(u,u.responseMessages,{hash:{},inverse:r.noop,fn:r.program(20,l,A),data:A});if(k||k===0){t+=k}t+="\n ";k=s["if"].call(u,u.isReadOnly,{hash:{},inverse:r.program(24,g,A),fn:r.program(22,h,A),data:A});if(k||k===0){t+=k}t+="\n </form>\n <div class='response' style='display:none'>\n <h4>Request URL</h4>\n <div class='block request_url'></div>\n <h4>Response Body</h4>\n <div class='block response_body'></div>\n <h4>Response Code</h4>\n <div class='block response_code'></div>\n <h4>Response Headers</h4>\n <div class='block response_headers'></div>\n </div>\n </div>\n </li>\n </ul>\n";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 <input type="file" name=\'';if(w=o.name){w=w.call(y,{hash:{},data:x})}else{w=y.name;w=typeof w===d?w.apply(y):w}v+=c(w)+'\'/>\n <div class="parameter-content-type" />\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 <textarea class='body-textarea' name='";if(w=o.name){w=w.call(y,{hash:{},data:x})}else{w=y.name;w=typeof w===d?w.apply(y):w}v+=c(w)+"'>";if(w=o["default"]){w=w.call(y,{hash:{},data:x})}else{w=y["default"];w=typeof w===d?w.apply(y):w}v+=c(w)+"</textarea>\n ";return v}function h(y,x){var v="",w;v+="\n <textarea class='body-textarea' name='";if(w=o.name){w=w.call(y,{hash:{},data:x})}else{w=y.name;w=typeof w===d?w.apply(y):w}v+=c(w)+'\'></textarea>\n <br />\n <div class="parameter-content-type" />\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 <input class='parameter' minlength='0' name='";if(w=o.name){w=w.call(y,{hash:{},data:x})}else{w=y.name;w=typeof w===d?w.apply(y):w}v+=c(w)+"' placeholder='' type='text' value='";if(w=o["default"]){w=w.call(y,{hash:{},data:x})}else{w=y["default"];w=typeof w===d?w.apply(y):w}v+=c(w)+"'/>\n ";return v}function r(y,x){var v="",w;v+="\n <input class='parameter' minlength='0' name='";if(w=o.name){w=w.call(y,{hash:{},data:x})}else{w=y.name;w=typeof w===d?w.apply(y):w}v+=c(w)+"' placeholder='' type='text' value=''/>\n ";return v}p+="<td class='code'>";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)+"</td>\n<td>\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</td>\n<td>";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+="</td>\n<td>";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+='</td>\n<td>\n <span class="model-signature"></span>\n</td>\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.defaultValue,{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 <option selected=\"\" value=''></option>\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 <option selected="" value=\'';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)+"'>";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)</option>\n ";return z}function u(C,B){var z="",A;z+="\n <option value='";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)+"'>";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)+"</option>\n ";return z}s+="<td class='code'>";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)+"</td>\n<td>\n <select ";e={hash:{},inverse:p.noop,fn:p.program(1,o,y),data:y};g=((j=r.isArray||t.isArray),j?j.call(t,t,e):q.call(t,"isArray",t,e));if(g||g===0){s+=g}s+=" class='parameter' name='";if(g=r.name){g=g.call(t,{hash:{},data:y})}else{g=t.name;g=typeof g===d?g.apply(t):g}s+=c(g)+"'>\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 </select>\n</td>\n<td>";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+="</td>\n<td>";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+='</td>\n<td><span class="model-signature"></span></td>';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 <textarea class='body-textarea' readonly='readonly' name='";if(r=f.name){r=r.call(t,{hash:{},data:s})}else{r=t.name;r=typeof r===h?r.apply(t):r}q+=j(r)+"'>";if(r=f.defaultValue){r=r.call(t,{hash:{},data:s})}else{r=t.defaultValue;r=typeof r===h?r.apply(t):r}q+=j(r)+"</textarea>\n ";return q}function c(t,s){var q="",r;q+="\n ";r=f["if"].call(t,t.defaultValue,{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.defaultValue){r=r.call(t,{hash:{},data:s})}else{r=t.defaultValue;r=typeof r===h?r.apply(t):r}q+=j(r)+"\n ";return q}function n(r,q){return"\n (empty)\n "}i+="<td class='code'>";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)+"</td>\n<td>\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</td>\n<td>";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+="</td>\n<td>";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+='</td>\n<td><span class="model-signature"></span></td>\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 <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='";if(r=f.name){r=r.call(t,{hash:{},data:s})}else{r=t.name;r=typeof r===h?r.apply(t):r}q+=j(r)+"'>";if(r=f.defaultValue){r=r.call(t,{hash:{},data:s})}else{r=t.defaultValue;r=typeof r===h?r.apply(t):r}q+=j(r)+"</textarea>\n ";return q}function c(t,s){var q="",r;q+="\n ";r=f["if"].call(t,t.defaultValue,{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.defaultValue){r=r.call(t,{hash:{},data:s})}else{r=t.defaultValue;r=typeof r===h?r.apply(t):r}q+=j(r)+"\n ";return q}function n(r,q){return"\n (empty)\n "}i+="<td class='code required'>";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)+"</td>\n<td>\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</td>\n<td>";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+="</td>\n<td>";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+='</td>\n<td><span class="model-signature"></span></td>\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 <input type="file" name=\'';if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"'/>\n ";return w}function k(z,y){var w="",x;w+="\n ";x=o["if"].call(z,z.defaultValue,{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 <textarea class='body-textarea' placeholder='(required)' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"'>";if(x=o.defaultValue){x=x.call(z,{hash:{},data:y})}else{x=z.defaultValue;x=typeof x===d?x.apply(z):x}w+=c(x)+"</textarea>\n ";return w}function h(z,y){var w="",x;w+="\n <textarea class='body-textarea' placeholder='(required)' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+'\'></textarea>\n <br />\n <div class="parameter-content-type" />\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 <input class='parameter' class='required' type='file' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"'/>\n ";return w}function t(z,y){var w="",x;w+="\n ";x=o["if"].call(z,z.defaultValue,{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 <input class='parameter required' minlength='1' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"' placeholder='(required)' type='text' value='";if(x=o.defaultValue){x=x.call(z,{hash:{},data:y})}else{x=z.defaultValue;x=typeof x===d?x.apply(z):x}w+=c(x)+"'/>\n ";return w}function r(z,y){var w="",x;w+="\n <input class='parameter required' minlength='1' name='";if(x=o.name){x=x.call(z,{hash:{},data:y})}else{x=z.name;x=typeof x===d?x.apply(z):x}w+=c(x)+"' placeholder='(required)' type='text' value=''/>\n ";return w}p+="<td class='code required'>";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)+"</td>\n<td>\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</td>\n<td>\n <strong>";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+="</strong>\n</td>\n<td>";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+='</td>\n<td><span class="model-signature"></span></td>\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 <option value="';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+='">';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+="</option>\n ";return o}function n(p,o){return'\n <option value="application/json">application/json</option>\n'}i+='<label for="parameterContentType"></label>\n<select name="parameterContentType">\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</select>\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+="<li>\n <a href='";if(r=f.url){r=r.call(t,{hash:{},data:s})}else{r=t.url;r=typeof r===h?r.apply(t):r}q+=j(r)+"'>Raw</a>\n </li>";return q}i+="<div class='heading'>\n <h2>\n <a href='#!/";if(d=f.id){d=d.call(m,{hash:{},data:k})}else{d=m.id;d=typeof d===h?d.apply(m):d}i+=j(d)+'\' class="toggleEndpointList" data-id="';if(d=f.id){d=d.call(m,{hash:{},data:k})}else{d=m.id;d=typeof d===h?d.apply(m):d}i+=j(d)+'">';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)+"</a> ";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 </h2>\n <ul class='options'>\n <li>\n <a href='#!/";if(d=f.id){d=d.call(m,{hash:{},data:k})}else{d=m.id;d=typeof d===h?d.apply(m):d}i+=j(d)+"' id='endpointListTogger_";if(d=f.id){d=d.call(m,{hash:{},data:k})}else{d=m.id;d=typeof d===h?d.apply(m):d}i+=j(d)+'\' class="toggleEndpointList" data-id="';if(d=f.id){d=d.call(m,{hash:{},data:k})}else{d=m.id;d=typeof d===h?d.apply(m):d}i+=j(d)+'">Show/Hide</a>\n </li>\n <li>\n <a href=\'#\' class="collapseResource" data-id="';if(d=f.id){d=d.call(m,{hash:{},data:k})}else{d=m.id;d=typeof d===h?d.apply(m):d}i+=j(d)+'">\n List Operations\n </a>\n </li>\n <li>\n <a href=\'#\' class="expandResource" data-id=';if(d=f.id){d=d.call(m,{hash:{},data:k})}else{d=m.id;d=typeof d===h?d.apply(m):d}i+=j(d)+">\n Expand Operations\n </a>\n </li>\n ";p={hash:{},inverse:o.noop,fn:o.program(3,c,k),data:k};if(d=f.url){d=d.call(m,p)}else{d=m.url;d=typeof d===h?d.apply(m):d}if(!f.url){d=n.call(m,d,p)}if(d||d===0){i+=d}i+="\n </ul>\n</div>\n<ul class='endpoints' id='";if(d=f.id){d=d.call(m,{hash:{},data:k})}else{d=m.id;d=typeof d===h?d.apply(m):d}i+=j(d)+"_endpoint_list' style='display:none'>\n\n</ul>\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 <option value="';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+='">';p=(typeof r===h?r.apply(r):r);if(p||p===0){o+=p}o+="</option>\n ";return o}function n(p,o){return'\n <option value="application/json">application/json</option>\n'}i+='<label for="responseContentType"></label>\n<select name="responseContentType">\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</select>\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+='<div>\n<ul class="signature-nav">\n <li><a class="description-link" href="#">Model</a></li>\n <li><a class="snippet-link" href="#">Model Schema</a></li>\n</ul>\n<div>\n\n<div class="signature-container">\n <div class="description">\n ';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 </div>\n\n <div class="snippet">\n <pre><code>';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)+'</code></pre>\n <small class="notice"></small>\n </div>\n</div>\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+="<td width='15%' class='code'>";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)+"</td>\n<td>";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+="</td>\n<td width='50%'><span class=\"model-signature\" /></td>";return g})})();(function(){var j,r,u,o,l,k,n,m,i,p,s,q,h,c,g,f,e,d,b,a,x,w,t={}.hasOwnProperty,v=function(B,z){for(var y in z){if(t.call(z,y)){B[y]=z[y]}}function A(){this.constructor=B}A.prototype=z.prototype;B.prototype=new A();B.__super__=z.prototype;return B};s=(function(z){v(y,z);function y(){q=y.__super__.constructor.apply(this,arguments);return q}y.prototype.dom_id="swagger_ui";y.prototype.options=null;y.prototype.api=null;y.prototype.headerView=null;y.prototype.mainView=null;y.prototype.initialize=function(A){var B=this;if(A==null){A={}}if(A.dom_id!=null){this.dom_id=A.dom_id;delete A.dom_id}if($("#"+this.dom_id)==null){$("body").append('<div id="'+this.dom_id+'"></div>')}this.options=A;this.options.success=function(){return B.render()};this.options.progress=function(C){return B.showMessage(C)};this.options.failure=function(C){if(B.api&&B.api.isValid===false){log("not a valid 2.0 spec, loading legacy client");B.api=new SwaggerApi(B.options);return B.api.build()}else{return B.onLoadFailure(C)}};this.headerView=new r({el:$("#header")});return this.headerView.on("update-swagger-ui",function(C){return B.updateSwaggerUi(C)})};y.prototype.setOption=function(A,B){return this.options[A]=B};y.prototype.getOption=function(A){return this.options[A]};y.prototype.updateSwaggerUi=function(A){this.options.url=A.url;return this.load()};y.prototype.load=function(){var B,A;if((A=this.mainView)!=null){A.clear()}B=this.options.url;if(B.indexOf("http")!==0){B=this.buildUrl(window.location.href.toString(),B)}this.options.url=B;this.headerView.update(B);this.api=new SwaggerClient(this.options);return this.api.build()};y.prototype.render=function(){var A=this;this.showMessage("Finished Loading Resource Information. Rendering Swagger UI...");this.mainView=new u({model:this.api,el:$("#"+this.dom_id),swaggerOptions:this.options}).render();this.showMessage();switch(this.options.docExpansion){case"full":Docs.expandOperationsForResource("");break;case"list":Docs.collapseOperationsForResource("")}if(this.options.onComplete){this.options.onComplete(this.api,this)}return setTimeout(function(){return Docs.shebang()},400)};y.prototype.buildUrl=function(C,A){var B,D;log("base is "+C);if(A.indexOf("/")===0){D=C.split("/");C=D[0]+"//"+D[2];return C+A}else{B=C.length;if(C.indexOf("?")>-1){B=Math.min(B,C.indexOf("?"))}if(C.indexOf("#")>-1){B=Math.min(B,C.indexOf("#"))}C=C.substring(0,B);if(C.indexOf("/",C.length-1)!==-1){return C+A}return C+"/"+A}};y.prototype.showMessage=function(A){if(A==null){A=""}$("#message-bar").removeClass("message-fail");$("#message-bar").addClass("message-success");return $("#message-bar").html(A)};y.prototype.onLoadFailure=function(A){var B;if(A==null){A=""}$("#message-bar").removeClass("message-success");$("#message-bar").addClass("message-fail");B=$("#message-bar").html(A);if(this.options.onFailure!=null){this.options.onFailure(A)}return B};return y})(Backbone.Router);window.SwaggerUi=s;r=(function(z){v(y,z);function y(){h=y.__super__.constructor.apply(this,arguments);return h}y.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"};y.prototype.initialize=function(){};y.prototype.showPetStore=function(A){return this.trigger("update-swagger-ui",{url:"http://petstore.swagger.wordnik.com/api/api-docs"})};y.prototype.showWordnikDev=function(A){return this.trigger("update-swagger-ui",{url:"http://api.wordnik.com/v4/resources.json"})};y.prototype.showCustomOnKeyup=function(A){if(A.keyCode===13){return this.showCustom()}};y.prototype.showCustom=function(A){if(A!=null){A.preventDefault()}return this.trigger("update-swagger-ui",{url:$("#input_baseUrl").val(),apiKey:$("#input_apiKey").val()})};y.prototype.update=function(B,C,A){if(A==null){A=false}$("#input_baseUrl").val(B);if(A){return this.trigger("update-swagger-ui",{url:B})}};return y})(Backbone.View);u=(function(y){var z;v(A,y);function A(){g=A.__super__.constructor.apply(this,arguments);return g}z={alpha:function(C,B){return C.path.localeCompare(B.path)},method:function(C,B){return C.method.localeCompare(B.method)}};A.prototype.initialize=function(B){var C,I,J,E,D,G,H,F;if(B==null){B={}}if(B.swaggerOptions.sorter){E=B.swaggerOptions.sorter;J=z[E];if(this.model.apisArray){F=this.model.apisArray;for(G=0,H=F.length;G<H;G++){I=F[G];I.operationsArray.sort(J)}if(E==="alpha"){this.model.apisArray.sort(J)}}}if(this.model.info&&this.model.info.license&&typeof this.model.info.license==="string"){C=this.model.info.license;D=this.model.info.licenseUrl;this.model.info.license={};this.model.info.license.name=C;this.model.info.license.url=D}if(!this.model.info){this.model.info={}}if(!this.model.info.version){this.model.info.version=this.model.apiVersion}if("validatorUrl" in B.swaggerOptions){return this.model.validatorUrl=B.swaggerOptions.validatorUrl}else{if(this.model.url.match(/https?:\/\/localhost/)&&this.model.swaggerVersion===2){return this.model.validatorUrl=this.model.url}else{return this.model.validatorUrl="http://online.swagger.io/validator"}}};A.prototype.render=function(){var C,H,E,F,D,B,G;$(this.el).html(Handlebars.templates.main(this.model));F={};C=0;G=this.model.apisArray;for(D=0,B=G.length;D<B;D++){E=G[D];H=E.name;while(typeof F[H]!=="undefined"){H=H+"_"+C;C+=1}E.id=H;F[H]=E;this.addResource(E)}return this};A.prototype.addResource=function(C){var B;C.id=C.id.replace(/\s/g,"_");B=new n({model:C,tagName:"li",id:"resource_"+C.id,className:"resource",swaggerOptions:this.options.swaggerOptions});return $("#resources").append(B.render().el)};A.prototype.clear=function(){return $(this.el).html("")};return A})(Backbone.View);n=(function(z){v(y,z);function y(){f=y.__super__.constructor.apply(this,arguments);return f}y.prototype.initialize=function(){if(""===this.model.description){return this.model.description=null}};y.prototype.render=function(){var B,G,D,C,E,A,F;$(this.el).html(Handlebars.templates.resource(this.model));D={};if(this.model.description){this.model.summary=this.model.description}F=this.model.operationsArray;for(E=0,A=F.length;E<A;E++){C=F[E];B=0;G=C.nickname;while(typeof D[G]!=="undefined"){G=G+"_"+B;B+=1}D[G]=C;C.nickname=G;C.parentId=this.model.id;this.addOperation(C)}$(".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};y.prototype.addOperation=function(A){var B;A.number=this.number;B=new o({model:A,tagName:"li",className:"endpoint",swaggerOptions:this.options.swaggerOptions});$(".endpoints",$(this.el)).append(B.render().el);return this.number++};y.prototype.callDocs=function(B,A){A.preventDefault();return Docs[B](A.currentTarget.getAttribute("data-id"))};return y})(Backbone.View);o=(function(z){v(y,z);function y(){e=y.__super__.constructor.apply(this,arguments);return e}y.prototype.invocationUrl=null;y.prototype.events={"submit .sandbox":"submitOperation","click .submit":"submitOperation","click .response_hider":"hideResponse","click .toggleOperation":"toggleOperationContent","mouseenter .api-ic":"mouseEnter","mouseout .api-ic":"mouseExit"};y.prototype.initialize=function(){};y.prototype.mouseEnter=function(F){var D,E,I,B,A,J,G,C,K,H;D=$(F.currentTarget.parentNode).find("#api_information_panel");K=F.pageX;H=F.pageY;J=$(window).scrollLeft();G=$(window).scrollTop();B=J+$(window).width();A=G+$(window).height();C=D.width();E=D.height();if(K+C>B){K=B-C}if(K<J){K=J}if(H+E>A){H=A-E}if(H<G){H=G}I={};I.top=H;I.left=K;D.css(I);return $(F.currentTarget.parentNode).find("#api_information_panel").show()};y.prototype.mouseExit=function(A){return $(A.currentTarget.parentNode).find("#api_information_panel").hide()};y.prototype.render=function(){var D,U,V,T,R,K,J,Q,L,P,W,O,M,I,N,S,H,G,F,C,Y,ab,Z,X,E,B,A,ac,aa;V=true;if(!V){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,"<br />")}this.model.oauth=null;if(this.model.authorizations){E=this.model.authorizations;for(T in E){N=E[T];if(T==="oauth2"){if(this.model.oauth===null){this.model.oauth={}}if(this.model.oauth.scopes===void 0){this.model.oauth.scopes=[]}for(H=0,Y=N.length;H<Y;H++){R=N[H];this.model.oauth.scopes.push(R)}}}}if(typeof this.model.responses!=="undefined"){this.model.responseMessages=[];B=this.model.responses;for(D in B){S=B[D];P=null;W=this.model.responses[D].schema;if(W&&W["$ref"]){P=W["$ref"];if(P.indexOf("#/definitions/")===0){P=P.substring("#/definitions/".length)}}this.model.responseMessages.push({code:D,message:S.description,responseModel:P})}}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"){O={sampleJSON:this.model.responseSampleJSON,isParam:false,signature:this.model.responseClassSignature};L=new i({model:O,tagName:"div"});$(".model-signature",$(this.el)).append(L.render().el)}else{this.model.responseClassSignature="string";$(".model-signature",$(this.el)).html(this.model.type)}U={isParam:false};U.consumes=this.model.consumes;U.produces=this.model.produces;A=this.model.parameters;for(G=0,ab=A.length;G<ab;G++){K=A[G];I=K.type||K.dataType;if(typeof I==="undefined"){P=K.schema;if(P&&P["$ref"]){J=P["$ref"];if(J.indexOf("#/definitions/")===0){I=J.substring("#/definitions/".length)}else{I=J}}}if(I&&I.toLowerCase()==="file"){if(!U.consumes){U.consumes="multipart/form-data"}}K.type=I}Q=new m({model:U});$(".response-content-type",$(this.el)).append(Q.render().el);ac=this.model.parameters;for(F=0,Z=ac.length;F<Z;F++){K=ac[F];this.addParameter(K,U.consumes)}aa=this.model.responseMessages;for(C=0,X=aa.length;C<X;C++){M=aa[C];this.addStatusCode(M)}return this};y.prototype.addParameter=function(C,A){var B;C.consumes=A;B=new k({model:C,tagName:"tr",readOnly:this.model.isReadOnly});return $(".operation-params",$(this.el)).append(B.render().el)};y.prototype.addStatusCode=function(B){var A;A=new p({model:B,tagName:"tr"});return $(".operation-status",$(this.el)).append(A.render().el)};y.prototype.submitOperation=function(O){var Q,G,N,D,I,A,J,M,L,K,P,F,C,H,E,B;if(O!=null){O.preventDefault()}G=$(".sandbox",$(this.el));Q=true;G.find("input.required").each(function(){var R=this;$(this).removeClass("error");if(jQuery.trim($(this).val())===""){$(this).addClass("error");$(this).wiggle({callback:function(){return $(R).focus()}});return Q=false}});if(Q){D={};A={parent:this};N=false;H=G.find("input");for(M=0,P=H.length;M<P;M++){I=H[M];if((I.value!=null)&&jQuery.trim(I.value).length>0){D[I.name]=I.value}if(I.type==="file"){N=true}}E=G.find("textarea");for(L=0,F=E.length;L<F;L++){I=E[L];if((I.value!=null)&&jQuery.trim(I.value).length>0){D[I.name]=I.value}}B=G.find("select");for(K=0,C=B.length;K<C;K++){I=B[K];J=this.getSelectedValue(I);if((J!=null)&&jQuery.trim(J).length>0){D[I.name]=J}}A.responseContentType=$("div select[name=responseContentType]",$(this.el)).val();A.requestContentType=$("div select[name=parameterContentType]",$(this.el)).val();$(".response_throbber",$(this.el)).show();if(N){return this.handleFileUpload(D,G)}else{return this.model["do"](D,A,this.showCompleteStatus,this.showErrorStatus,this)}}};y.prototype.success=function(A,B){return B.showCompleteStatus(A)};y.prototype.handleFileUpload=function(R,I){var M,H,C,N,L,K,P,J,G,F,D,Q,U,T,S,E,B,A,V,O=this;E=I.serializeArray();for(J=0,Q=E.length;J<Q;J++){N=E[J];if((N.value!=null)&&jQuery.trim(N.value).length>0){R[N.name]=N.value}}M=new FormData();P=0;B=this.model.parameters;for(G=0,U=B.length;G<U;G++){K=B[G];if(K.paramType==="form"){if(K.type.toLowerCase()!=="file"&&R[K.name]!==void 0){M.append(K.name,R[K.name])}}}C={};A=this.model.parameters;for(F=0,T=A.length;F<T;F++){K=A[F];if(K.paramType==="header"){C[K.name]=R[K.name]}}V=I.find('input[type~="file"]');for(D=0,S=V.length;D<S;D++){H=V[D];if(typeof H.files[0]!=="undefined"){M.append($(H).attr("name"),H.files[0]);P+=1}}this.invocationUrl=this.model.supportHeaderParams()?(C=this.model.getHeaderParams(R),this.model.urlify(R,false)):this.model.urlify(R,true);$(".request_url",$(this.el)).html("<pre></pre>");$(".request_url pre",$(this.el)).text(this.invocationUrl);L={type:this.model.method,url:this.invocationUrl,headers:C,data:M,dataType:"json",contentType:false,processData:false,error:function(X,Y,W){return O.showErrorStatus(O.wrap(X),O)},success:function(W){return O.showResponse(W,O)},complete:function(W){return O.showCompleteStatus(O.wrap(W),O)}};if(window.authorizations){window.authorizations.apply(L)}if(P===0){L.data.append("fake","true")}jQuery.ajax(L);return false};y.prototype.wrap=function(E){var C,F,H,B,G,D,A;H={};F=E.getAllResponseHeaders().split("\r");for(D=0,A=F.length;D<A;D++){B=F[D];C=B.split(":");if(C[0]!==void 0&&C[1]!==void 0){H[C[0].trim()]=C[1].trim()}}G={};G.content={};G.content.data=E.responseText;G.headers=H;G.request={};G.request.url=this.invocationUrl;G.status=E.status;return G};y.prototype.getSelectedValue=function(A){var D,C,F,B,E;if(!A.multiple){return A.value}else{C=[];E=A.options;for(F=0,B=E.length;F<B;F++){D=E[F];if(D.selected){C.push(D.value)}}if(C.length>0){return C}else{return null}}};y.prototype.hideResponse=function(A){if(A!=null){A.preventDefault()}$(".response",$(this.el)).slideUp();return $(".response_hider",$(this.el)).fadeOut()};y.prototype.showResponse=function(A){var B;B=JSON.stringify(A,null,"\t").replace(/\n/g,"<br>");return $(".response_body",$(this.el)).html(escape(B))};y.prototype.showErrorStatus=function(B,A){return A.showStatus(B)};y.prototype.showCompleteStatus=function(B,A){return A.showStatus(B)};y.prototype.formatXml=function(H){var D,G,B,I,N,J,C,A,L,M,F,E,K;A=/(>)(<)(\/*)/g;M=/[ ]*(.*)[ ]+\n/g;D=/(<.+>)(.+\n)/g;H=H.replace(A,"$1\n$2$3").replace(M,"$1\n").replace(D,"$1\n$2");C=0;G="";N=H.split("\n");B=0;I="other";L={"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};F=function(T){var P,O,R,V,S,Q,U;Q={single:Boolean(T.match(/<.+\/>/)),closing:Boolean(T.match(/<\/.+>/)),opening:Boolean(T.match(/<[^!?].*>/))};S=((function(){var W;W=[];for(R in Q){U=Q[R];if(U){W.push(R)}}return W})())[0];S=S===void 0?"other":S;P=I+"->"+S;I=S;V="";B+=L[P];V=((function(){var X,Y,W;W=[];for(O=X=0,Y=B;0<=Y?X<Y:X>Y;O=0<=Y?++X:--X){W.push(" ")}return W})()).join("");if(P==="opening->closing"){return G=G.substr(0,G.length-1)+T+"\n"}else{return G+=V+T+"\n"}};for(E=0,K=N.length;E<K;E++){J=N[E];F(J)}return G};y.prototype.showStatus=function(F){var C,J,L,I,D,M,A,E,H,G,B;if(F.content===void 0){J=F.data;B=F.url}else{J=F.content.data;B=F.request.url}D=F.headers;L=D&&D["Content-Type"]?D["Content-Type"].split(";")[0].trim():null;if(!J){C=$("<code />").text("no content");E=$('<pre class="json" />').append(C)}else{if(L==="application/json"||/\+json$/.test(L)){M=null;try{M=JSON.stringify(JSON.parse(J),null," ")}catch(K){I=K;M="can't parse JSON. Raw result:\n\n"+J}C=$("<code />").text(M);E=$('<pre class="json" />').append(C)}else{if(L==="application/xml"||/\+xml$/.test(L)){C=$("<code />").text(this.formatXml(J));E=$('<pre class="xml" />').append(C)}else{if(L==="text/html"){C=$("<code />").html(_.escape(J));E=$('<pre class="xml" />').append(C)}else{if(/^image\//.test(L)){E=$("<img>").attr("src",B)}else{C=$("<code />").text(J);E=$('<pre class="json" />').append(C)}}}}}H=E;$(".request_url",$(this.el)).html("<pre></pre>");$(".request_url pre",$(this.el)).text(B);$(".response_code",$(this.el)).html("<pre>"+F.status+"</pre>");$(".response_body",$(this.el)).html(H);$(".response_headers",$(this.el)).html("<pre>"+_.escape(JSON.stringify(F.headers,null," ")).replace(/\n/g,"<br>")+"</pre>");$(".response",$(this.el)).slideDown();$(".response_hider",$(this.el)).show();$(".response_throbber",$(this.el)).hide();G=$(".response_body",$(this.el))[0];A=this.options.swaggerOptions;if(A.highlightSizeThreshold&&F.data.length>A.highlightSizeThreshold){return G}else{return hljs.highlightBlock(G)}};y.prototype.toggleOperationContent=function(){var A;A=$("#"+Docs.escapeResourceName(this.model.parentId)+"_"+this.model.nickname+"_content");if(A.is(":visible")){return Docs.collapseOperation(A)}else{return Docs.expandOperation(A)}};return y})(Backbone.View);p=(function(z){v(y,z);function y(){d=y.__super__.constructor.apply(this,arguments);return d}y.prototype.initialize=function(){};y.prototype.render=function(){var B,A,C;C=this.template();$(this.el).html(C(this.model));if(swaggerUi.api.models.hasOwnProperty(this.model.responseModel)){B={sampleJSON:JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(),null,2),isParam:false,signature:swaggerUi.api.models[this.model.responseModel].getMockSignature()};A=new i({model:B,tagName:"div"});$(".model-signature",this.$el).append(A.render().el)}else{$(".model-signature",this.$el).html("")}return this};y.prototype.template=function(){return Handlebars.templates.status_code};return y})(Backbone.View);k=(function(z){v(y,z);function y(){b=y.__super__.constructor.apply(this,arguments);return b}y.prototype.initialize=function(){return Handlebars.registerHelper("isArray",function(B,A){if(B.type.toLowerCase()==="array"||B.allowMultiple){return A.fn(this)}else{return A.inverse(this)}})};y.prototype.render=function(){var A,B,E,C,F,D,I,J,H,G;G=this.model.type||this.model.dataType;if(typeof G==="undefined"){D=this.model.schema;if(D&&D["$ref"]){C=D["$ref"];if(C.indexOf("#/definitions/")===0){G=C.substring("#/definitions/".length)}else{G=C}}}this.model.type=G;this.model.paramType=this.model["in"]||this.model.paramType;if(this.model.paramType==="body"){this.model.isBody=true}if(G&&G.toLowerCase()==="file"){this.model.isFile=true}this.model["default"]=this.model["default"]||this.model.defaultValue;H=this.template();$(this.el).html(H(this.model));I={sampleJSON:this.model.sampleJSON,isParam:true,signature:this.model.signature};if(this.model.sampleJSON){J=new i({model:I,tagName:"div"});$(".model-signature",$(this.el)).append(J.render().el)}else{$(".model-signature",$(this.el)).html(this.model.signature)}B=false;if(this.model.isBody){B=true}A={isParam:B};A.consumes=this.model.consumes;if(B){E=new l({model:A});$(".parameter-content-type",$(this.el)).append(E.render().el)}else{F=new m({model:A});$(".response-content-type",$(this.el)).append(F.render().el)}return this};y.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 y})(Backbone.View);i=(function(z){v(y,z);function y(){a=y.__super__.constructor.apply(this,arguments);return a}y.prototype.events={"click a.description-link":"switchToDescription","click a.snippet-link":"switchToSnippet","mousedown .snippet":"snippetToTextArea"};y.prototype.initialize=function(){};y.prototype.render=function(){var A;A=this.template();$(this.el).html(A(this.model));this.switchToSnippet();this.isParam=this.model.isParam;if(this.isParam){$(".notice",$(this.el)).text("Click to set as parameter value")}return this};y.prototype.template=function(){return Handlebars.templates.signature};y.prototype.switchToDescription=function(A){if(A!=null){A.preventDefault()}$(".snippet",$(this.el)).hide();$(".description",$(this.el)).show();$(".description-link",$(this.el)).addClass("selected");return $(".snippet-link",$(this.el)).removeClass("selected")};y.prototype.switchToSnippet=function(A){if(A!=null){A.preventDefault()}$(".description",$(this.el)).hide();$(".snippet",$(this.el)).show();$(".snippet-link",$(this.el)).addClass("selected");return $(".description-link",$(this.el)).removeClass("selected")};y.prototype.snippetToTextArea=function(A){var B;if(this.isParam){if(A!=null){A.preventDefault()}B=$("textarea",$(this.el.parentNode.parentNode.parentNode));if($.trim(B.val())===""){return B.val(this.model.sampleJSON)}}};return y})(Backbone.View);j=(function(y){v(z,y);function z(){x=z.__super__.constructor.apply(this,arguments);return x}z.prototype.initialize=function(){};z.prototype.render=function(){var A;A=this.template();$(this.el).html(A(this.model));$("label[for=contentType]",$(this.el)).text("Response Content Type");return this};z.prototype.template=function(){return Handlebars.templates.content_type};return z})(Backbone.View);m=(function(y){v(z,y);function z(){w=z.__super__.constructor.apply(this,arguments);return w}z.prototype.initialize=function(){};z.prototype.render=function(){var A;A=this.template();$(this.el).html(A(this.model));$("label[for=responseContentType]",$(this.el)).text("Response Content Type");return this};z.prototype.template=function(){return Handlebars.templates.response_content_type};return z})(Backbone.View);l=(function(z){v(y,z);function y(){c=y.__super__.constructor.apply(this,arguments);return c}y.prototype.initialize=function(){};y.prototype.render=function(){var A;A=this.template();$(this.el).html(A(this.model));$("label[for=parameterContentType]",$(this.el)).text("Parameter content type:");return this};y.prototype.template=function(){return Handlebars.templates.parameter_content_type};return y})(Backbone.View)}).call(this); |
// swagger-client.js | ||
// version 2.1.0-alpha.1 | ||
// version 2.1.0-alpha.2 | ||
/** | ||
@@ -378,3 +378,4 @@ * Array Model | ||
this.host = response.host || ''; | ||
this.schemes = response.schemes || [ 'http' ]; | ||
this.schemes = response.schemes || []; | ||
this.scheme; | ||
this.basePath = response.basePath || ''; | ||
@@ -387,5 +388,15 @@ this.apis = {}; | ||
var location = this.parseUri(this.url); | ||
if(typeof this.schemes === 'undefined' || this.schemes.length === 0) { | ||
this.scheme = location.scheme; | ||
} | ||
else { | ||
this.scheme = this.schemes[0]; | ||
} | ||
if(typeof this.host === 'undefined' || this.host === '') { | ||
var location = this.parseUri(this.url); | ||
this.host = location.host; | ||
if (location.port) { | ||
this.host = this.host + ':' + location.port; | ||
} | ||
} | ||
@@ -471,2 +482,3 @@ | ||
host: parts[11], | ||
port: parts[12], | ||
path: parts[15] | ||
@@ -522,2 +534,3 @@ }; | ||
this.schemes = parent.schemes; | ||
this.scheme = parent.scheme || 'http'; | ||
this.basePath = parent.basePath; | ||
@@ -638,2 +651,4 @@ this.nickname = (operationId||errors.push('Operations must have a nickname.')); | ||
str = 'long'; | ||
else if(type === 'integer' && typeof format === 'undefined') | ||
str = 'long'; | ||
else if(type === 'string' && format === 'date-time') | ||
@@ -647,2 +662,4 @@ str = 'date-time'; | ||
str = 'double'; | ||
else if(type === 'number' && typeof format === 'undefined') | ||
str = 'double'; | ||
else if(type === 'boolean') | ||
@@ -837,2 +854,4 @@ str = 'boolean'; | ||
formParams[param.name] = args[param.name]; | ||
else if (param.in === 'body') | ||
args.body = args[param.name]; | ||
} | ||
@@ -855,4 +874,3 @@ } | ||
} | ||
var scheme = this.schemes[0]; | ||
var url = scheme + '://' + this.host + this.basePath + requestUrl + querystring; | ||
var url = this.scheme + '://' + this.host + this.basePath + requestUrl + querystring; | ||
@@ -1011,3 +1029,3 @@ var obj = { | ||
this.properties = []; | ||
var requiredFields = definition.enum || []; | ||
var requiredFields = definition.required || []; | ||
@@ -1073,3 +1091,3 @@ var key; | ||
var model = models[ref]; | ||
if (model && typeof modelsToIgnore === 'undefined') { | ||
if (model && typeof modelsToIgnore[model.name] === 'undefined') { | ||
returnVal = returnVal + ('<br>' + model.getMockSignature(modelsToIgnore)); | ||
@@ -1096,2 +1114,3 @@ } | ||
this.name = name; | ||
this.description = obj.description; | ||
this.obj = obj; | ||
@@ -1164,2 +1183,4 @@ this.optional = true; | ||
str += 'long'; | ||
else if(obj.type === 'integer' && typeof obj.format === 'undefined') | ||
str += 'long'; | ||
else if(obj.type === 'string' && obj.format === 'date-time') | ||
@@ -1173,2 +1194,4 @@ str += 'date-time'; | ||
str += 'double'; | ||
else if(obj.type === 'number' && typeof obj.format === 'undefined') | ||
str += 'double'; | ||
else if(obj.type === 'boolean') | ||
@@ -1192,8 +1215,13 @@ str += 'boolean'; | ||
var str = getStringSignature(this.obj); | ||
if(str !== '') | ||
str = this.name + ' : ' + str; | ||
if(str !== '') { | ||
str = '<span class="propName ' + this.required + '">' + this.name + '</span> (<span class="propType">' + str + '</span>'; | ||
if(!this.required) | ||
str += ', <span class="propOptKey">optional</span>'; | ||
str += ')'; | ||
} | ||
else | ||
str = this.name + ' : ' + JSON.stringify(this.obj); | ||
if(!this.required) | ||
str += ' (optional)'; | ||
str = this.name + ' (' + JSON.stringify(this.obj) + ')'; | ||
if(typeof this.description !== 'undefined') | ||
str += ': ' + this.description; | ||
return str; | ||
@@ -1208,2 +1236,4 @@ } | ||
str = 'long'; | ||
else if(type === 'integer' && typeof format === 'undefined') | ||
str = 'long'; | ||
else if(type === 'string' && format === 'date-time') | ||
@@ -1217,2 +1247,4 @@ str = 'date-time'; | ||
str = 'double'; | ||
else if(type === 'number' && typeof format === 'undefined') | ||
str = 'double'; | ||
else if(type === 'boolean') | ||
@@ -1219,0 +1251,0 @@ str = 'boolean'; |
{ | ||
"name": "swagger-ui", | ||
"version": "2.1.0-alpha.2", | ||
"version": "2.1.0-alpha.3", | ||
"description": "Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2167642
94
23313