swagger-node-express
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -1,1 +0,1 @@ | ||
module.exports = require("./lib/swagger.js"); | ||
module.exports = require('./lib'); |
@@ -17,11 +17,14 @@ /** | ||
'use strict'; | ||
exports.query = exports.q = function(name, description, type, required, allowableValuesEnum, defaultValue) { | ||
return { | ||
"name" : name, | ||
"description" : description, | ||
"type" : type, | ||
"required" : required, | ||
"enum" : allowableValuesEnum, | ||
"defaultValue" : defaultValue, | ||
"paramType" : "query" | ||
'name' : name, | ||
'description' : description, | ||
'type' : type, | ||
'required' : required, | ||
'enum' : allowableValuesEnum, | ||
'defaultValue' : defaultValue, | ||
'paramType' : 'query' | ||
}; | ||
@@ -32,20 +35,20 @@ }; | ||
return { | ||
"name" : name, | ||
"description" : description, | ||
"type" : type, | ||
"required" : true, | ||
"enum" : allowableValuesEnum, | ||
"paramType" : "path", | ||
"defaultValue" : defaultValue | ||
'name' : name, | ||
'description' : description, | ||
'type' : type, | ||
'required' : true, | ||
'enum' : allowableValuesEnum, | ||
'paramType' : 'path', | ||
'defaultValue' : defaultValue | ||
}; | ||
}; | ||
exports.body = function(name, description, type, defaultValue) { | ||
exports.body = function(name, description, type, defaultValue, required) { | ||
return { | ||
"name" : name, | ||
"description" : description, | ||
"type" : type, | ||
"required" : true, | ||
"paramType" : "body", | ||
"defaultValue" : defaultValue | ||
'name' : name, | ||
'description' : description, | ||
'type' : type, | ||
'required' : required || false, | ||
'paramType' : 'body', | ||
'defaultValue' : defaultValue | ||
}; | ||
@@ -56,9 +59,9 @@ }; | ||
return { | ||
"name" : name, | ||
"description" : description, | ||
"type" : "string", | ||
"required" : (typeof required !== 'undefined') ? required : true, | ||
"enum" : allowableValuesEnum, | ||
"paramType" : "form", | ||
"defaultValue" : defaultValue | ||
'name' : name, | ||
'description' : description, | ||
'type' : 'string', | ||
'required' : (typeof required !== 'undefined') ? required : true, | ||
'enum' : allowableValuesEnum, | ||
'paramType' : 'form', | ||
'defaultValue' : defaultValue | ||
}; | ||
@@ -69,9 +72,9 @@ }; | ||
return { | ||
"name" : name, | ||
"description" : description, | ||
"type" : type, | ||
"required" : required, | ||
"allowMultiple" : false, | ||
"paramType" : "header" | ||
'name' : name, | ||
'description' : description, | ||
'type' : type, | ||
'required' : required, | ||
'allowMultiple' : false, | ||
'paramType' : 'header' | ||
}; | ||
}; |
@@ -12,3 +12,3 @@ 'use strict'; | ||
} | ||
if (typeof (obj[i]) != "object") { | ||
if (typeof (obj[i]) !== 'object') { | ||
cloned[i] = obj[i]; | ||
@@ -15,0 +15,0 @@ } |
@@ -16,43 +16,60 @@ /** | ||
*/ | ||
'use strict'; | ||
var _ = require('lodash'); | ||
var allowedMethods = ['get', 'post', 'put', 'patch', 'delete']; | ||
var allowedDataTypes = ['string', 'integer', 'boolean', 'array']; | ||
var params = require(__dirname + '/paramTypes.js'); | ||
var toJsonType = require('./toJsonType'); | ||
var shallowClone = require('./shallowClone'); | ||
var resourceHelpers = require('./resourceHelpers'); | ||
var wrap = resourceHelpers.wrap; | ||
var appendToApi = resourceHelpers.appendToApi; | ||
var params = require('./paramTypes'); | ||
function Swagger() { | ||
// TODO-3.0.0 REMOVE | ||
var ignoreAppHandlerInConstructor = true; | ||
// TODO-3.0.0 REMOVE | ||
// For backwards compatability, we just export a new instance of Swagger | ||
module.exports = exports = new Swagger(); | ||
function Swagger(appHandler) { | ||
if (!(this instanceof Swagger)){ | ||
return new Swagger(); | ||
return new Swagger(appHandler); | ||
} | ||
this.formatString = ".{format}"; | ||
this.resourcePath = "/api-docs" + this.formatString; | ||
this.jsonSuffix = ".json"; | ||
this.basePath = "/"; | ||
this.formatString = '.{format}'; | ||
this.resourcePath = '/api-docs' + this.formatString; | ||
this.jsonSuffix = '.json'; | ||
this.basePath = '/'; | ||
this.apiInfo = null; | ||
this.authorizations = null; | ||
this.swaggerVersion = "1.2"; | ||
this.apiVersion = "1.0"; | ||
this.swaggerVersion = '1.2'; | ||
this.apiVersion = '1.0'; | ||
this.allModels = {}; | ||
this.validators = []; | ||
this.appHandler = null; | ||
this.appHandler = appHandler || null; | ||
this.resources = {}; | ||
this.paramTypes = params; | ||
// For backwards compatability | ||
this.getModels = this.allModels; | ||
// TODO-3.0.0 REMOVE | ||
ignoreAppHandlerInConstructor = false; | ||
} | ||
//TODO-3.0.0 REMOVE | ||
/** | ||
* returns a new instance of swagger | ||
*/ | ||
Swagger.prototype.createNew = function(){ | ||
return new Swagger(); | ||
Swagger.prototype.createNew = function(appHandler){ | ||
return new Swagger(appHandler); | ||
}; | ||
Swagger.prototype.configureSwaggerPaths = function(format, path, suffix) { | ||
if(path.indexOf("/") != 0) path = "/" + path; | ||
if(path.indexOf('/') !== 0) path = '/' + path; | ||
this.formatString = format; | ||
@@ -87,4 +104,4 @@ this.resourcePath = path; | ||
Swagger.prototype.setHeaders = function(res) { | ||
res.header("Access-Control-Allow-Headers", "Content-Type, api_key"); | ||
res.header("Content-Type", "application/json; charset=utf-8"); | ||
res.header('Access-Control-Allow-Headers', 'Content-Type, api_key'); | ||
res.header('Content-Type', 'application/json; charset=utf-8'); | ||
}; | ||
@@ -108,6 +125,6 @@ | ||
// api-docs.json/pet => pet.{format} | ||
var r = self.resources[p] || self.resources[p.replace(self.formatString, "")]; | ||
var r = self.resources[p] || self.resources[p.replace(self.formatString, '')]; | ||
if (!r) { | ||
console.error("unable to find listing"); | ||
return stopWithError(res, { | ||
console.error('unable to find listing'); | ||
return self.stopWithError(res, { | ||
'message': 'internal error', | ||
@@ -137,3 +154,3 @@ 'code': 500 | ||
Swagger.prototype.baseApiFromPath = function(path) { | ||
var p = this.resourcePath.replace(this.formatString, this.jsonSuffix) + "/" + path.replace(this.formatString, ""); | ||
var p = this.resourcePath.replace(this.formatString, this.jsonSuffix) + '/' + path.replace(this.formatString, ''); | ||
return p; | ||
@@ -145,6 +162,6 @@ }; | ||
_.forOwn(properties, function (property) { | ||
var type = property["type"]; | ||
var type = property.type; | ||
if(type) { | ||
switch (type) { | ||
case "array": | ||
case 'array': | ||
if (property.items) { | ||
@@ -154,7 +171,8 @@ var ref = property.items.$ref; | ||
requiredModels.push(ref); | ||
self.addPropertiesToRequiredModels(self.allModels[ref].properties, requiredModels); | ||
} | ||
} | ||
break; | ||
case "string": | ||
case "integer": | ||
case 'string': | ||
case 'integer': | ||
break; | ||
@@ -169,4 +187,5 @@ default: | ||
else { | ||
if (property["$ref"]){ | ||
requiredModels.push(property["$ref"]); | ||
if (property.$ref){ | ||
requiredModels.push(property.$ref); | ||
self.addPropertiesToRequiredModels(self.allModels[property.$ref].properties, requiredModels); | ||
} | ||
@@ -188,3 +207,3 @@ } | ||
if (!r || !r.apis) { | ||
return stopWithError(res, { | ||
return self.stopWithError(res, { | ||
'message': 'internal error', | ||
@@ -201,5 +220,5 @@ 'code': 500 | ||
var op = api.operations[opKey]; | ||
var path = api.path.replace(self.formatString, "").replace(/{.*\}/, "*"); | ||
var path = api.path.replace(self.formatString, '').replace(/{.*\}/, '*'); | ||
if (!self.canAccessResource(req, path, op.method)) { | ||
excludedPaths.push(op.method + ":" + api.path); | ||
excludedPaths.push(op.method + ':' + api.path); | ||
} | ||
@@ -213,6 +232,6 @@ } | ||
// clone arrays for | ||
if(r["produces"]) output.produces = r["produces"].slice(0); | ||
if(r["consumes"]) output.consumes = r["consumes"].slice(0); | ||
if(r["authorizations"]) output.authorizations = r["authorizations"].slice(0); | ||
if(r["protocols"]) output.protocols = r["protocols"].slice(0); | ||
if(r.produces) output.produces = r.produces.slice(0); | ||
if(r.consumes) output.consumes = r.consumes.slice(0); | ||
if(r.authorizations) output.authorizations = r.authorizations.slice(0); | ||
if(r.protocols) output.protocols = r.protocols.slice(0); | ||
@@ -230,3 +249,3 @@ // models required in the api listing | ||
_.forOwn(api.operations, function (operation) { | ||
if (excludedPaths.indexOf(operation.method + ":" + api.path) == -1) { | ||
if (excludedPaths.indexOf(operation.method + ':' + api.path) === -1) { | ||
var co = JSON.parse(JSON.stringify(operation)); | ||
@@ -288,4 +307,4 @@ delete co.path; | ||
_.forOwn(operation.parameters, function (param) { | ||
if (param.paramType == "body" && param.type) { | ||
var model = param.type.replace(/^List\[/, "").replace(/\]/, ""); | ||
if (param.paramType === 'body' && param.type) { | ||
var model = param.type.replace(/^List\[/, '').replace(/\]/, ''); | ||
models.push(model); | ||
@@ -301,13 +320,12 @@ } | ||
var responseModel = operation.type; | ||
if(responseModel === "array" && operation.items) { | ||
if(responseModel === 'array' && operation.items) { | ||
var items = operation.items; | ||
if(items["$ref"]) { | ||
models.push(items["$ref"]); | ||
if(items.$ref) { | ||
models.push(items.$ref); | ||
} else if (items.type && allowedDataTypes.indexOf(items.type) === -1) { | ||
models.push(items.type); | ||
} | ||
else if (items.type && allowedDataTypes.indexOf(items.type) == -1) { | ||
models.push(items["type"]); | ||
} | ||
} | ||
// if not void or a json-schema type, add the model | ||
else if (responseModel != "void" && allowedDataTypes.indexOf(responseModel) == -1) { | ||
else if (responseModel !== 'void' && allowedDataTypes.indexOf(responseModel) === -1) { | ||
models.push(responseModel); | ||
@@ -341,18 +359,18 @@ } | ||
var r = { | ||
"apiVersion": self.apiVersion, | ||
"swaggerVersion": self.swaggerVersion, | ||
"apis": [] | ||
'apiVersion': self.apiVersion, | ||
'swaggerVersion': self.swaggerVersion, | ||
'apis': [] | ||
}; | ||
if(self.authorizations != null) | ||
r["authorizations"] = self.authorizations; | ||
if(self.authorizations) | ||
r.authorizations = self.authorizations; | ||
if(self.apiInfo != null) | ||
r["info"] = self.apiInfo; | ||
if(self.apiInfo) | ||
r.info = self.apiInfo; | ||
_.forOwn(self.resources, function (value, key) { | ||
var p = "/" + key.replace(self.formatString, ""); | ||
var p = '/' + key.replace(self.formatString, ''); | ||
r.apis.push({ | ||
"path": p, | ||
"description": value.description | ||
'path': p, | ||
'description': value.description | ||
}); | ||
@@ -375,3 +393,3 @@ }); | ||
_.forOwn(root.apis, function (api) { | ||
if (api && api.path == spec.path && api.method == spec.method) { | ||
if (api && api.path === spec.path && api.method === spec.method) { | ||
// add operation & return | ||
@@ -385,3 +403,3 @@ appendToApi(root, api, spec); | ||
var api = { | ||
"path": spec.path | ||
'path': spec.path | ||
}; | ||
@@ -391,10 +409,10 @@ if (!self.resources[apiRootPath]) { | ||
// | ||
var resourcePath = "/" + apiRootPath.replace(self.formatString, ""); | ||
var resourcePath = '/' + apiRootPath.replace(self.formatString, ''); | ||
root = { | ||
"apiVersion": self.apiVersion, | ||
"swaggerVersion": self.swaggerVersion, | ||
"basePath": self.basePath, | ||
"resourcePath": resourcePath, | ||
"apis": [], | ||
"models": [] | ||
'apiVersion': self.apiVersion, | ||
'swaggerVersion': self.swaggerVersion, | ||
'basePath': self.basePath, | ||
'resourcePath': resourcePath, | ||
'apis': [], | ||
'models': [] | ||
}; | ||
@@ -409,3 +427,3 @@ } | ||
// convert .{format} to .json, make path params happy | ||
var fullPath = spec.path.replace(self.formatString, self.jsonSuffix).replace(/\/{/g, "/:").replace(/\}/g, ""); | ||
var fullPath = spec.path.replace(self.formatString, self.jsonSuffix).replace(/\/{/g, '/:').replace(/\}/g, ''); | ||
var currentMethod = spec.method.toLowerCase(); | ||
@@ -417,7 +435,7 @@ if (allowedMethods.indexOf(currentMethod) > -1) { | ||
// todo: needs to do smarter matching against the defined paths | ||
var path = req.url.split('?')[0].replace(self.jsonSuffix, "").replace(/{.*\}/, "*"); | ||
var path = req.url.split('?')[0].replace(self.jsonSuffix, '').replace(/{.*\}/, '*'); | ||
if (!self.canAccessResource(req, path, req.method)) { | ||
res.send(JSON.stringify({ | ||
"message": "forbidden", | ||
"code": 403 | ||
'message': 'forbidden', | ||
'code': 403 | ||
}), 403); | ||
@@ -436,3 +454,7 @@ } else { | ||
// TODO-3.0.0 REMOVE | ||
Swagger.prototype.setAppHandler = function(app) { | ||
if (!ignoreAppHandlerInConstructor) { | ||
console.warn('setAppHandler is deprecated! Pass it to the constructor instead.'); | ||
} | ||
this.appHandler = app; | ||
@@ -526,83 +548,2 @@ }; | ||
function wrap(callback, req, resp) { | ||
callback(req, resp); | ||
} | ||
// appends a spec to an existing operation | ||
function appendToApi(rootResource, api, spec) { | ||
var validationErrors = []; | ||
if (!spec.nickname || spec.nickname.indexOf(" ") >= 0) { | ||
// nicknames don't allow spaces | ||
validationErrors.push({ | ||
"path": api.path, | ||
"error": "invalid nickname '" + spec.nickname + "'" | ||
}); | ||
} | ||
// validate params | ||
_.forOwn(spec.parameters, function (parameter) { | ||
switch (parameter.paramType) { | ||
case "path": | ||
if (api.path.indexOf("{" + parameter.name + "}") < 0) { | ||
validationErrors.push({ | ||
"path": api.path, | ||
"name": parameter.name, | ||
"error": "invalid path" | ||
}); | ||
} | ||
break; | ||
case "query": | ||
break; | ||
case "body": | ||
break; | ||
case "form": | ||
break; | ||
case "header": | ||
break; | ||
default: | ||
validationErrors.push({ | ||
"path": api.path, | ||
"name": parameter.name, | ||
"error": "invalid param type " + parameter.paramType | ||
}); | ||
break; | ||
} | ||
}); | ||
if (validationErrors.length > 0) { | ||
console.error(validationErrors); | ||
return; | ||
} | ||
if (!api.operations) { | ||
api.operations = []; | ||
} | ||
// TODO: replace if existing HTTP operation in same api path | ||
var op = { | ||
"parameters": spec.parameters, | ||
"method": spec.method, | ||
"notes": spec.notes, | ||
"responseMessages": spec.responseMessages, | ||
"nickname": spec.nickname, | ||
"summary": spec.summary, | ||
"consumes" : spec.consumes, | ||
"produces" : spec.produces | ||
}; | ||
// Add custom fields. | ||
op = _.extend({}, spec, op); | ||
if (!spec.type) { | ||
op.type = "void"; | ||
} | ||
api.operations.push(op); | ||
if (!rootResource.models) { | ||
rootResource.models = {}; | ||
} | ||
} | ||
Swagger.prototype.addValidator = function(v) { | ||
@@ -612,22 +553,12 @@ this.validators.push(v); | ||
// Create Error JSON by code and text | ||
function error(code, description) { | ||
return { | ||
"code": code, | ||
"message": description | ||
}; | ||
} | ||
// Stop express ressource with error code | ||
stopWithError = function(res, error) { | ||
Swagger.prototype.stopWithError = function(res, error) { | ||
this.setHeaders(res); | ||
if (error && error.message && error.code) | ||
res.send(JSON.stringify(error), error.code); | ||
else | ||
res.send(JSON.stringify({ | ||
'message': 'internal error', | ||
'code': 500 | ||
}), 500); | ||
console.log(JSON.stringify(error)); | ||
res.send(JSON.stringify({ | ||
'message': 'internal error', | ||
'code': 500 | ||
}), 500); | ||
}; | ||
@@ -648,9 +579,9 @@ | ||
return { | ||
"code": 404, | ||
"message": field + ' not found' | ||
'code': 404, | ||
'message': field + ' not found' | ||
}; | ||
} else { | ||
res.send({ | ||
"code": 404, | ||
"message": field + ' not found' | ||
'code': 404, | ||
'message': field + ' not found' | ||
}, 404); | ||
@@ -662,9 +593,9 @@ } | ||
return { | ||
"code": 400, | ||
"message": 'invalid ' + field | ||
'code': 400, | ||
'message': 'invalid ' + field | ||
}; | ||
} else { | ||
res.send({ | ||
"code": 400, | ||
"message": 'invalid ' + field | ||
'code': 400, | ||
'message': 'invalid ' + field | ||
}, 404); | ||
@@ -676,9 +607,9 @@ } | ||
return { | ||
"code": 403, | ||
"message": 'forbidden' | ||
'code': 403, | ||
'message': 'forbidden' | ||
}; | ||
} else { | ||
res.send({ | ||
"code": 403, | ||
"message": 'forbidden' | ||
'code': 403, | ||
'message': 'forbidden' | ||
}, 403); | ||
@@ -693,31 +624,18 @@ } | ||
if(obj["description"]) { | ||
resource["description"] = obj["description"]; | ||
if(obj.description) { | ||
resource.description = obj.description; | ||
} | ||
if(obj["consumes"]) { | ||
resource["consumes"] = obj["consumes"]; | ||
if(obj.consumes) { | ||
resource.consumes = obj.consumes; | ||
} | ||
if(obj["produces"]) { | ||
resource["produces"] = obj["produces"]; | ||
if(obj.produces) { | ||
resource.produces = obj.produces; | ||
} | ||
if(obj["protocols"]) { | ||
resource["protocols"] = obj["protocols"]; | ||
if(obj.protocols) { | ||
resource.protocols = obj.protocols; | ||
} | ||
if(obj["authorizations"]) { | ||
resource["authorizations"] = obj["authorizations"]; | ||
if(obj.authorizations) { | ||
resource.authorizations = obj.authorizations; | ||
} | ||
} | ||
}; | ||
// For backwards compatability, we just export a new instance of Swagger | ||
module.exports = exports = Swagger(); | ||
exports.params = params; | ||
exports.queryParam = exports.params.query; | ||
exports.pathParam = exports.params.path; | ||
exports.bodyParam = exports.params.body; | ||
exports.formParam = exports.params.form; | ||
exports.headerParam = exports.params.header; | ||
exports.error = error; | ||
exports.stopWithError = stopWithError; | ||
exports.stop = stopWithError; |
{ | ||
"name": "swagger-node-express", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"author": { | ||
"name": "Tony Tam", | ||
"email": "fehguy@gmail.com", | ||
"url": "http://developer.wordnik.com" | ||
"url": "http://swagger.io" | ||
}, | ||
@@ -18,3 +18,3 @@ "contributors": [ | ||
"type": "git", | ||
"url": "https://github.com/wordnik/swagger-node-express" | ||
"url": "https://github.com/swagger-api/swagger-node-express" | ||
}, | ||
@@ -41,9 +41,11 @@ "keywords": [ | ||
"once": "~1.3.0", | ||
"request": "~2.36.0" | ||
"request": "~2.36.0", | ||
"jshint": "~2.3.0" | ||
}, | ||
"license": "apache 2.0", | ||
"scripts": { | ||
"pretest": "jshint lib", | ||
"test": "mocha -r should './test/**/*.js'", | ||
"start": "node sample-application/app.js" | ||
} | ||
} | ||
} |
# Swagger for Express and Node.js | ||
[![Build Status](https://travis-ci.org/wordnik/swagger-node-express.png)](https://travis-ci.org/wordnik/swagger-node-express) | ||
[![Build Status](https://travis-ci.org/swagger-api/swagger-node-express.png)](https://travis-ci.org/swagger-api/swagger-node-express) | ||
This is a [Swagger](https://github.com/wordnik/swagger-spec) module for the [Express](http://expressjs.com) web application framework for Node.js. | ||
This is a [Swagger](https://github.com/swagger-api/swagger-spec) module for the [Express](http://expressjs.com) web application framework for Node.js. | ||
Try a sample! The source for a [functional sample](https://github.com/wordnik/swagger-node-express/blob/master/SAMPLE.md) is available on github. | ||
Try a sample! The source for a [functional sample](https://github.com/swagger-api/swagger-node-express/blob/master/SAMPLE.md) is available on github. | ||
## What's Swagger? | ||
The goal of Swagger™ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swager removes the guesswork in calling the service. | ||
The goal of Swagger™ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swagger removes the guesswork in calling the service. | ||
Check out [Swagger-Spec](https://github.com/wordnik/swagger-spec) for additional information about the Swagger project, including additional libraries with support for other languages and more. | ||
Check out [Swagger-Spec](https://github.com/swagger-api/swagger-spec) for additional information about the Swagger project, including additional libraries with support for other languages and more. | ||
@@ -75,3 +75,3 @@ | ||
You now add models to the swagger context. Models are described in a JSON format, per the [swagger model specification](https://github.com/wordnik/swagger-core/wiki/Datatypes). Most folks keep them in a separate file (see [here](https://github.com/wordnik/swagger-node-express/blob/master/Apps/petstore/models.js) for an example), or you can add them as such: | ||
You now add models to the swagger context. Models are described in a JSON format, per the [swagger model specification](https://github.com/swagger-api/swagger-core/wiki/Datatypes). Most folks keep them in a separate file (see [here](https://github.com/swagger-api/swagger-node-express/blob/master/sample-application/models.js) for an example), or you can add them as such: | ||
@@ -132,3 +132,3 @@ ```js | ||
Now you can open up a [swagger-ui](https://github.com/wordnik/swagger-ui) and browse your API, generate a client with [swagger-codegen](https://github.com/wordnik/swagger-codegen), and be happy. | ||
Now you can open up a [swagger-ui](https://github.com/swagger-api/swagger-ui) and browse your API, generate a client with [swagger-codegen](https://github.com/swagger-api/swagger-codegen), and be happy. | ||
@@ -135,0 +135,0 @@ |
@@ -13,3 +13,3 @@ This is the Wordnik Swagger code for the express framework. For more on Swagger, please visit http://swagger.wordnik.com. For more on express, please visit https://github.com/visionmedia/express | ||
```js | ||
node Apps/petstore/main.js | ||
node sample-application/app.js | ||
``` | ||
@@ -16,0 +16,0 @@ |
@@ -1,541 +0,603 @@ | ||
// Generated by CoffeeScript 1.6.3 | ||
(function() { | ||
var ApiKeyAuthorization, PasswordAuthorization, SwaggerApi, SwaggerAuthorizations, SwaggerHttp, SwaggerModel, SwaggerModelProperty, SwaggerOperation, SwaggerRequest, SwaggerResource, | ||
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; | ||
// swagger.js | ||
// version 2.0.41 | ||
SwaggerApi = (function() { | ||
SwaggerApi.prototype.url = "http://api.wordnik.com/v4/resources.json"; | ||
(function () { | ||
SwaggerApi.prototype.debug = false; | ||
var __bind = function (fn, me) { | ||
return function () { | ||
return fn.apply(me, arguments); | ||
}; | ||
}; | ||
SwaggerApi.prototype.basePath = null; | ||
var log = function () { | ||
log.history = log.history || []; | ||
log.history.push(arguments); | ||
if (this.console) { | ||
console.log(Array.prototype.slice.call(arguments)[0]); | ||
} | ||
}; | ||
SwaggerApi.prototype.authorizations = null; | ||
// if you want to apply conditional formatting of parameter values | ||
var parameterMacro = function (value) { | ||
return value; | ||
} | ||
SwaggerApi.prototype.authorizationScheme = null; | ||
// if you want to apply conditional formatting of model property values | ||
var modelPropertyMacro = function (value) { | ||
return value; | ||
} | ||
SwaggerApi.prototype.info = null; | ||
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; | ||
} | ||
} | ||
function SwaggerApi(url, options) { | ||
if (options == null) { | ||
options = {}; | ||
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; | ||
}; | ||
} | ||
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; | ||
return function (o) { | ||
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); | ||
} | ||
if (url) { | ||
if (url.url) { | ||
options = url; | ||
} else { | ||
this.url = url; | ||
if (hasDontEnumBug) { | ||
for (var i = 0; i < DontEnumsLength; i++) { | ||
if (hasOwnProperty.call(o, DontEnums[i])) | ||
result.push(DontEnums[i]); | ||
} | ||
} else { | ||
} | ||
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; | ||
} | ||
if (options.url != null) { | ||
this.url = options.url; | ||
} | ||
if (options.success != null) { | ||
this.success = options.success; | ||
} | ||
this.failure = options.failure != null ? options.failure : function() {}; | ||
this.progress = options.progress != null ? options.progress : function() {}; | ||
if (options.success != null) { | ||
this.build(); | ||
} | ||
else | ||
this.url = url; | ||
else | ||
options = url; | ||
if (options.url != null) | ||
this.url = options.url; | ||
if (options.success != null) | ||
this.success = options.success; | ||
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; | ||
} | ||
} | ||
SwaggerApi.prototype.build = function() { | ||
var e, obj, | ||
_this = this; | ||
this.progress('fetching resource list: ' + this.url); | ||
obj = { | ||
url: this.url, | ||
method: "get", | ||
headers: {}, | ||
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(rawResponse) { | ||
var response; | ||
response = JSON.parse(rawResponse.content.data); | ||
_this.swaggerVersion = response.swaggerVersion; | ||
if (_this.swaggerVersion === "1.2") { | ||
return _this.buildFromSpec(response); | ||
} else { | ||
return _this.buildFrom1_1Spec(response); | ||
} | ||
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\",*/*" | ||
}, | ||
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); | ||
} | ||
} | ||
}; | ||
e = {}; | ||
if (typeof window !== 'undefined') { | ||
e = window; | ||
} else { | ||
e = 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) { | ||
var api, isApi, newName, operation, res, resource, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2; | ||
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; | ||
} | ||
isApi = false; | ||
_ref = response.apis; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
api = _ref[_i]; | ||
if (api.operations) { | ||
_ref1 = api.operations; | ||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | ||
operation = _ref1[_j]; | ||
isApi = true; | ||
} | ||
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; | ||
} | ||
} | ||
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) { | ||
newName = response.resourcePath.replace(/\//g, ''); | ||
this.resourcePath = response.resourcePath; | ||
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 { | ||
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); | ||
} else { | ||
_ref2 = response.apis; | ||
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { | ||
resource = _ref2[_k]; | ||
res = new SwaggerResource(resource, this); | ||
this.apis[res.name] = res; | ||
this.apisArray.push(res); | ||
} | ||
} | ||
if (this.success) { | ||
this.success(); | ||
} | ||
return this; | ||
}; | ||
} | ||
this.isValid = true; | ||
if (this.success) { | ||
this.success(); | ||
} | ||
return this; | ||
}; | ||
SwaggerApi.prototype.buildFrom1_1Spec = function(response) { | ||
var api, isApi, newName, operation, res, resource, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2; | ||
console.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; | ||
} | ||
isApi = false; | ||
_ref = response.apis; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
api = _ref[_i]; | ||
if (api.operations) { | ||
_ref1 = api.operations; | ||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | ||
operation = _ref1[_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) { | ||
newName = response.resourcePath.replace(/\//g, ''); | ||
this.resourcePath = response.resourcePath; | ||
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]; | ||
var res = new SwaggerResource(resource, this); | ||
this.apis[res.name] = res; | ||
this.apisArray.push(res); | ||
} else { | ||
_ref2 = response.apis; | ||
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { | ||
resource = _ref2[_k]; | ||
res = new SwaggerResource(resource, this); | ||
this.apis[res.name] = res; | ||
this.apisArray.push(res); | ||
} | ||
} | ||
if (this.success) { | ||
this.success(); | ||
} | ||
return this; | ||
}; | ||
} | ||
this.isValid = true; | ||
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.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]); | ||
} | ||
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]); | ||
} | ||
} | ||
_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]; | ||
console.log(resource_name); | ||
_ref1 = resource.operations; | ||
for (operation_name in _ref1) { | ||
operation = _ref1[operation_name]; | ||
console.log(" " + operation.nickname); | ||
_ref2 = operation.parameters; | ||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) { | ||
parameter = _ref2[_i]; | ||
console.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; | ||
}; | ||
return SwaggerApi; | ||
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 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); | ||
SwaggerResource = (function() { | ||
SwaggerResource.prototype.api = null; | ||
SwaggerResource.prototype.produces = null; | ||
SwaggerResource.prototype.consumes = null; | ||
function SwaggerResource(resourceObj, api) { | ||
var consumes, e, obj, parts, produces, | ||
_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; | ||
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 = {}; | ||
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); | ||
obj = { | ||
url: this.url, | ||
method: "get", | ||
headers: {}, | ||
on: { | ||
error: function(response) { | ||
return _this.api.fail("Unable to read api '" + _this.name + "' from path " + _this.url + " (server returned " + response.statusText + ")"); | ||
}, | ||
response: function(rawResponse) { | ||
var response; | ||
response = JSON.parse(rawResponse.content.data); | ||
return _this.addApiDeclaration(response); | ||
} | ||
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\",*/*" | ||
}, | ||
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 + ")"); | ||
} | ||
}; | ||
e = {}; | ||
if (typeof window !== 'undefined') { | ||
e = window; | ||
} else { | ||
e = 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 parts, pos, url; | ||
url = this.api.basePath; | ||
pos = url.lastIndexOf(relativeBasePath); | ||
if (pos === -1) { | ||
parts = url.split("/"); | ||
url = parts[0] + "//" + parts[2]; | ||
if (relativeBasePath.indexOf("/") === 0) { | ||
return url + relativeBasePath; | ||
} else { | ||
return url + "/" + relativeBasePath; | ||
} | ||
} else if (relativeBasePath === "/") { | ||
return url.substring(0, pos); | ||
} else { | ||
return url.substring(0, pos) + relativeBasePath; | ||
} | ||
}; | ||
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.addApiDeclaration = function(response) { | ||
var endpoint, _i, _len, _ref; | ||
if (response.produces != null) { | ||
this.produces = response.produces; | ||
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; | ||
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); | ||
} | ||
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) { | ||
_ref = response.apis; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
endpoint = _ref[_i]; | ||
this.addOperations(endpoint.path, endpoint.operations, response.consumes, response.produces, response); | ||
} | ||
} | ||
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) { | ||
var model, modelName, swaggerModel, _i, _len, _ref, _results; | ||
if (models != null) { | ||
for (modelName in models) { | ||
if (this.models[modelName] == null) { | ||
swaggerModel = new SwaggerModel(modelName, models[modelName]); | ||
this.modelsArray.push(swaggerModel); | ||
this.models[modelName] = swaggerModel; | ||
} | ||
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]; | ||
} | ||
_ref = this.modelsArray; | ||
_results = []; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
model = _ref[_i]; | ||
_results.push(model.setReferencedModels(this.models)); | ||
} | ||
return _results; | ||
} | ||
}; | ||
var output = []; | ||
for (var i = 0; i < this.modelsArray.length; i++) { | ||
var model = this.modelsArray[i]; | ||
output.push(model.setReferencedModels(this.models)); | ||
} | ||
return output; | ||
} | ||
}; | ||
SwaggerResource.prototype.addOperations = function(resource_path, ops, consumes, produces) { | ||
var authorizations, method, o, op, r, ref, responseMessages, type, _i, _j, _len, _len1, _results; | ||
if (ops) { | ||
_results = []; | ||
for (_i = 0, _len = ops.length; _i < _len; _i++) { | ||
o = ops[_i]; | ||
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]; | ||
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; | ||
authorizations = o.authorizations; | ||
if (o.consumes != null) { | ||
consumes = o.consumes; | ||
} else { | ||
consumes = this.consumes; | ||
var type = (o.type || o.responseClass); | ||
if (type === "array") { | ||
ref = null; | ||
if (o.items) | ||
ref = o.items["type"] || o.items["$ref"]; | ||
type = "array[" + ref + "]"; | ||
} | ||
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; | ||
} | ||
if (o.produces != null) { | ||
produces = o.produces; | ||
} else { | ||
produces = this.produces; | ||
} | ||
type = o.type || o.responseClass; | ||
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 (_j = 0, _len1 = responseMessages.length; _j < _len1; _j++) { | ||
r = responseMessages[_j]; | ||
r.message = r.reason; | ||
r.reason = null; | ||
} | ||
} | ||
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, authorizations); | ||
this.operations[op.nickname] = op; | ||
_results.push(this.operationsArray.push(op)); | ||
} | ||
return _results; | ||
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; | ||
} | ||
}; | ||
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 msg, operation, operation_name, parameter, _i, _len, _ref, _ref1, _results; | ||
_ref = this.operations; | ||
_results = []; | ||
for (operation_name in _ref) { | ||
operation = _ref[operation_name]; | ||
msg = " " + operation.nickname; | ||
_ref1 = operation.parameters; | ||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { | ||
parameter = _ref1[_i]; | ||
msg.concat(" " + parameter.name + (parameter.required ? ' (required)' : '') + " - " + parameter.description); | ||
} | ||
_results.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 _results; | ||
}; | ||
output.push(msg); | ||
} | ||
return output; | ||
}; | ||
return SwaggerResource; | ||
})(); | ||
SwaggerModel = (function() { | ||
function SwaggerModel(modelName, obj) { | ||
var prop, propertyName, value; | ||
this.name = obj.id != null ? obj.id : modelName; | ||
this.properties = []; | ||
for (propertyName in obj.properties) { | ||
if (obj.required != null) { | ||
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; | ||
} | ||
} | ||
prop = new SwaggerModelProperty(propertyName, obj.properties[propertyName]); | ||
this.properties.push(prop); | ||
} | ||
var prop = new SwaggerModelProperty(propertyName, obj.properties[propertyName]); | ||
this.properties.push(prop); | ||
} | ||
} | ||
SwaggerModel.prototype.setReferencedModels = function(allModels) { | ||
var prop, type, _i, _len, _ref, _results; | ||
_ref = this.properties; | ||
_results = []; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
prop = _ref[_i]; | ||
type = prop.type || prop.dataType; | ||
if (allModels[type] != null) { | ||
_results.push(prop.refModel = allModels[type]); | ||
} else if ((prop.refDataType != null) && (allModels[prop.refDataType] != null)) { | ||
_results.push(prop.refModel = allModels[prop.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 classClose, classOpen, prop, propertiesStr, returnVal, strong, strongClose, stronger, _i, _j, _len, _len1, _ref, _ref1; | ||
propertiesStr = []; | ||
_ref = this.properties; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
prop = _ref[_i]; | ||
propertiesStr.push(prop.toString()); | ||
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()); | ||
} | ||
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++) { | ||
var prop = this.properties[i]; | ||
if ((prop.refModel != null) && modelsToIgnore.indexOf(prop.refModel.name) === -1) { | ||
returnVal = returnVal + ('<br>' + prop.refModel.getMockSignature(modelsToIgnore)); | ||
} | ||
strong = '<span class="strong">'; | ||
stronger = '<span class="stronger">'; | ||
strongClose = '</span>'; | ||
classOpen = strong + this.name + ' {' + strongClose; | ||
classClose = strong + '}' + strongClose; | ||
returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose; | ||
if (!modelsToIgnore) { | ||
modelsToIgnore = []; | ||
} | ||
modelsToIgnore.push(this); | ||
_ref1 = this.properties; | ||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | ||
prop = _ref1[_j]; | ||
if ((prop.refModel != null) && (modelsToIgnore.indexOf(prop.refModel)) === -1) { | ||
returnVal = returnVal + ('<br>' + prop.refModel.getMockSignature(modelsToIgnore)); | ||
} | ||
} | ||
return returnVal; | ||
}; | ||
} | ||
return returnVal; | ||
}; | ||
SwaggerModel.prototype.createJSONSample = function(modelsToIgnore) { | ||
var prop, result, _i, _len, _ref; | ||
result = {}; | ||
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); | ||
_ref = this.properties; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
prop = _ref[_i]; | ||
for (var i = 0; i < this.properties.length; i++) { | ||
var prop = this.properties[i]; | ||
result[prop.name] = prop.getSampleValue(modelsToIgnore); | ||
@@ -545,167 +607,184 @@ } | ||
return result; | ||
}; | ||
} | ||
}; | ||
return SwaggerModel; | ||
})(); | ||
SwaggerModelProperty = (function() { | ||
function SwaggerModelProperty(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; | ||
} | ||
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; | ||
} | ||
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.items.$ref != null) { | ||
this.refDataType = obj.items.$ref; | ||
} | ||
if (obj["enum"] != null) { | ||
this.valueType = "string"; | ||
this.values = obj["enum"]; | ||
if (this.values != null) { | ||
this.valueString = "'" + 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 '") + "'"; | ||
} | ||
} | ||
} | ||
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.refDataType; | ||
} else { | ||
result = this.dataType; | ||
} | ||
} | ||
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) { | ||
return [result]; | ||
result = this.toSampleValue(this.refDataType); | ||
} else { | ||
return result; | ||
result = this.toSampleValue(this.dataType); | ||
} | ||
}; | ||
} | ||
if (this.isCollection) { | ||
return [result]; | ||
} else { | ||
return result; | ||
} | ||
}; | ||
SwaggerModelProperty.prototype.toString = function() { | ||
var req, str; | ||
req = this.required ? 'propReq' : 'propOpt'; | ||
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 ((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; | ||
} | ||
return result; | ||
}; | ||
return SwaggerModelProperty; | ||
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 SwaggerOperation = function (nickname, path, method, parameters, summary, notes, type, responseMessages, resource, consumes, produces, authorizations) { | ||
var _this = this; | ||
SwaggerOperation = (function() { | ||
function SwaggerOperation(nickname, path, method, parameters, summary, notes, type, responseMessages, resource, consumes, produces, authorizations) { | ||
var parameter, v, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3, | ||
_this = this; | ||
this.nickname = nickname; | ||
this.path = path; | ||
this.method = method; | ||
this.parameters = parameters != null ? parameters : []; | ||
this.summary = summary; | ||
this.notes = notes; | ||
this.type = type; | ||
this.responseMessages = responseMessages; | ||
this.resource = resource; | ||
this.consumes = consumes; | ||
this.produces = produces; | ||
this.authorizations = authorizations; | ||
this["do"] = __bind(this["do"], this); | ||
if (this.nickname == null) { | ||
this.resource.api.fail("SwaggerOperations must have a nickname."); | ||
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); | ||
if (errors.length > 0) { | ||
console.error('SwaggerOperation errors', errors, arguments); | ||
this.resource.api.fail(errors); | ||
} | ||
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) + ']'; | ||
} | ||
if (this.path == null) { | ||
this.resource.api.fail("SwaggerOperation " + nickname + " is missing path."); | ||
param.type = type; | ||
if (type.toLowerCase() === 'boolean') { | ||
param.allowableValues = {}; | ||
param.allowableValues.values = ["true", "false"]; | ||
} | ||
if (this.method == null) { | ||
this.resource.api.fail("SwaggerOperation " + nickname + " is missing method."); | ||
} | ||
this.path = this.path.replace('{format}', 'json'); | ||
this.method = this.method.toLowerCase(); | ||
this.isGetMethod = this.method === "get"; | ||
this.resourceName = this.resource.name; | ||
if (((_ref = this.type) != null ? _ref.toLowerCase() : void 0) === 'void') { | ||
this.type = void 0; | ||
} | ||
if (this.type != null) { | ||
this.responseClassSignature = this.getSignature(this.type, this.resource.models); | ||
this.responseSampleJSON = this.getSampleJSON(this.type, this.resource.models); | ||
} | ||
this.responseMessages = this.responseMessages || []; | ||
_ref1 = this.parameters; | ||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { | ||
parameter = _ref1[_i]; | ||
parameter.name = parameter.name || parameter.type || parameter.dataType; | ||
type = parameter.type || parameter.dataType; | ||
if (type.toLowerCase() === 'boolean') { | ||
parameter.allowableValues = {}; | ||
parameter.allowableValues.values = ["true", "false"]; | ||
} | ||
parameter.signature = this.getSignature(type, this.resource.models); | ||
parameter.sampleJSON = this.getSampleJSON(type, this.resource.models); | ||
if (parameter["enum"] != null) { | ||
parameter.isList = true; | ||
parameter.allowableValues = {}; | ||
parameter.allowableValues.descriptiveValues = []; | ||
_ref2 = parameter["enum"]; | ||
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { | ||
v = _ref2[_j]; | ||
if ((parameter.defaultValue != null) && parameter.defaultValue === v) { | ||
parameter.allowableValues.descriptiveValues.push({ | ||
value: v, | ||
isDefault: true | ||
}); | ||
} else { | ||
parameter.allowableValues.descriptiveValues.push({ | ||
value: 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) { | ||
param.isList = true; | ||
param.allowableValues = {}; | ||
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 | ||
}); | ||
} | ||
} | ||
if (parameter.allowableValues != null) { | ||
if (parameter.allowableValues.valueType === "RANGE") { | ||
parameter.isRange = true; | ||
} else { | ||
parameter.isList = true; | ||
} | ||
if (parameter.allowableValues.values != null) { | ||
parameter.allowableValues.descriptiveValues = []; | ||
_ref3 = parameter.allowableValues.values; | ||
for (_k = 0, _len2 = _ref3.length; _k < _len2; _k++) { | ||
v = _ref3[_k]; | ||
if ((parameter.defaultValue != null) && parameter.defaultValue === v) { | ||
parameter.allowableValues.descriptiveValues.push({ | ||
value: v, | ||
isDefault: true | ||
} | ||
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 { | ||
parameter.allowableValues.descriptiveValues.push({ | ||
value: v, | ||
} | ||
else { | ||
param.allowableValues.descriptiveValues.push({ | ||
value: String(v), | ||
isDefault: false | ||
@@ -718,550 +797,884 @@ }); | ||
} | ||
this.resource[this.nickname] = function(args, callback, error) { | ||
return _this["do"](args, callback, error); | ||
}; | ||
this.resource[this.nickname].help = function() { | ||
return _this.help(); | ||
}; | ||
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.indexOf('[') >= 0) { | ||
return type.substring(type.indexOf('[') + 1, type.indexOf(']')); | ||
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 { | ||
return void 0; | ||
return models[type].getMockSignature(); | ||
} | ||
}; | ||
} | ||
}; | ||
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(); | ||
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); | ||
} | ||
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 { | ||
return models[type].getMockSignature(); | ||
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]; | ||
} | ||
}; | ||
else if (param.paramType === 'form' || param.paramType.toLowerCase() === 'file') | ||
possibleParams.push(param); | ||
} | ||
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; | ||
return JSON.stringify(val, null, 2); | ||
if (args.body != null) { | ||
params.body = args.body; | ||
delete args.body; | ||
} | ||
if (possibleParams) { | ||
var key; | ||
for (key in possibleParams) { | ||
var value = possibleParams[key]; | ||
if (args[value.name]) { | ||
params[value.name] = args[value.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 = {}; | ||
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.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)); | ||
} | ||
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 console.log(xhr, textStatus, error); | ||
}; | ||
} | ||
if (callback == null) { | ||
callback = function(data) { | ||
var content; | ||
content = null; | ||
if (data.content != null) { | ||
content = data.content.data; | ||
} else { | ||
content = "no data"; | ||
} | ||
return console.log("default callback: " + content); | ||
}; | ||
} | ||
params = {}; | ||
params.headers = []; | ||
if (args.headers != null) { | ||
params.headers = args.headers; | ||
delete args.headers; | ||
} | ||
_ref = this.parameters; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
param = _ref[_i]; | ||
if (param.paramType === "header") { | ||
if (args[param.name]) { | ||
params.headers[param.name] = args[param.name]; | ||
} | ||
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."; | ||
} | ||
if (args.body != null) { | ||
params.body = args.body; | ||
delete args.body; | ||
} | ||
possibleParams = (function() { | ||
var _j, _len1, _ref1, _results; | ||
_ref1 = this.parameters; | ||
_results = []; | ||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | ||
param = _ref1[_j]; | ||
if (param.paramType === "form" || param.paramType.toLowerCase() === "file") { | ||
_results.push(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; | ||
} | ||
} | ||
return _results; | ||
}).call(this); | ||
if (possibleParams) { | ||
for (key in possibleParams) { | ||
value = possibleParams[key]; | ||
if (args[value.name]) { | ||
params[value.name] = args[value.name]; | ||
else { | ||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]); | ||
} | ||
} | ||
} | ||
req = new SwaggerRequest(this.method, this.urlify(args), params, opts, callback, error, this); | ||
if (opts.mock != null) { | ||
return req; | ||
} else { | ||
return true; | ||
} | ||
}; | ||
} | ||
if ((queryParams != null) && queryParams.length > 0) | ||
url += '?' + queryParams; | ||
return url; | ||
}; | ||
SwaggerOperation.prototype.pathJson = function() { | ||
return this.path.replace("{format}", "json"); | ||
}; | ||
SwaggerOperation.prototype.supportHeaderParams = function () { | ||
return this.resource.api.supportHeaderParams; | ||
}; | ||
SwaggerOperation.prototype.pathXml = function() { | ||
return this.path.replace("{format}", "xml"); | ||
SwaggerOperation.prototype.supportedSubmitMethods = function () { | ||
return this.resource.api.supportedSubmitMethods; | ||
}; | ||
SwaggerOperation.prototype.getQueryParams = function (args) { | ||
return this.getMatchingParams(['query'], 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.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.urlify = function(args) { | ||
var param, queryParams, reg, url, _i, _j, _len, _len1, _ref, _ref1; | ||
url = this.resource.basePath + this.pathJson(); | ||
_ref = this.parameters; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
param = _ref[_i]; | ||
if (param.paramType === 'path') { | ||
if (args[param.name]) { | ||
reg = new RegExp('\{' + param.name + '[^\}]*\}', 'gi'); | ||
url = url.replace(reg, encodeURIComponent(args[param.name])); | ||
delete args[param.name]; | ||
} else { | ||
throw "" + param.name + " is a required path param."; | ||
_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); | ||
} | ||
} | ||
} | ||
queryParams = ""; | ||
_ref1 = this.parameters; | ||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | ||
param = _ref1[_j]; | ||
if (param.paramType === 'query') { | ||
if (args[param.name]) { | ||
if (queryParams !== "") { | ||
queryParams += "&"; | ||
} | ||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]); | ||
} | ||
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'; | ||
} | ||
if ((queryParams != null) && queryParams.length > 0) { | ||
url += "?" + queryParams; | ||
} | ||
return url; | ||
}; | ||
for (_i = 0, _len = lines.length; _i < _len; _i++) { | ||
ln = lines[_i]; | ||
_fn(ln); | ||
} | ||
return formatted; | ||
}; | ||
SwaggerOperation.prototype.supportHeaderParams = function() { | ||
return this.resource.api.supportHeaderParams; | ||
}; | ||
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 || {}); | ||
SwaggerOperation.prototype.supportedSubmitMethods = function() { | ||
return this.resource.api.supportedSubmitMethods; | ||
}; | ||
if (errors.length > 0) { | ||
throw errors; | ||
} | ||
SwaggerOperation.prototype.getQueryParams = function(args) { | ||
return this.getMatchingParams(['query'], args); | ||
}; | ||
this.type = this.type.toUpperCase(); | ||
SwaggerOperation.prototype.getHeaderParams = function(args) { | ||
return this.getMatchingParams(['header'], args); | ||
}; | ||
// set request, response content type headers | ||
var headers = this.setHeaders(params, this.operation); | ||
var body = params.body; | ||
SwaggerOperation.prototype.getMatchingParams = function(paramTypes, args) { | ||
var matchingParams, name, param, value, _i, _len, _ref, _ref1; | ||
matchingParams = {}; | ||
_ref = this.parameters; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
param = _ref[_i]; | ||
if (args && args[param.name]) { | ||
matchingParams[param.name] = args[param.name]; | ||
} | ||
// 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; | ||
} | ||
_ref1 = this.resource.api.headers; | ||
for (name in _ref1) { | ||
value = _ref1[name]; | ||
matchingParams[name] = value; | ||
} | ||
return matchingParams; | ||
}; | ||
SwaggerOperation.prototype.help = function() { | ||
var msg, parameter, _i, _len, _ref; | ||
msg = ""; | ||
_ref = this.parameters; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
parameter = _ref[_i]; | ||
if (msg !== "") { | ||
msg += "\n"; | ||
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); | ||
} | ||
} | ||
msg += "* " + parameter.name + (parameter.required ? ' (required)' : '') + " - " + parameter.description; | ||
body = encoded; | ||
} | ||
return msg; | ||
}; | ||
return SwaggerOperation; | ||
})(); | ||
SwaggerRequest = (function() { | ||
function SwaggerRequest(type, url, params, opts, successCallback, errorCallback, operation, execution) { | ||
var body, e, fields, headers, key, myHeaders, name, obj, param, parent, possibleParams, requestContentType, responseContentType, urlEncoded, value, values, | ||
_this = this; | ||
this.type = type; | ||
this.url = url; | ||
this.params = params; | ||
this.opts = opts; | ||
this.successCallback = successCallback; | ||
this.errorCallback = errorCallback; | ||
this.operation = operation; | ||
this.execution = execution; | ||
if (this.type == null) { | ||
throw "SwaggerRequest type is required (get/post/put/delete)."; | ||
} | ||
if (this.url == null) { | ||
throw "SwaggerRequest url is required."; | ||
} | ||
if (this.successCallback == null) { | ||
throw "SwaggerRequest successCallback is required."; | ||
} | ||
if (this.errorCallback == null) { | ||
throw "SwaggerRequest error callback is required."; | ||
} | ||
if (this.operation == null) { | ||
throw "SwaggerRequest operation is required."; | ||
} | ||
this.type = this.type.toUpperCase(); | ||
headers = params.headers; | ||
myHeaders = {}; | ||
body = params.body; | ||
parent = params["parent"]; | ||
requestContentType = "application/json"; | ||
if (body && (this.type === "POST" || this.type === "PUT" || this.type === "PATCH")) { | ||
if (this.opts.requestContentType) { | ||
requestContentType = this.opts.requestContentType; | ||
} | ||
} else { | ||
if (((function() { | ||
var _i, _len, _ref, _results; | ||
_ref = this.operation.parameters; | ||
_results = []; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
param = _ref[_i]; | ||
if (param.paramType === "form") { | ||
_results.push(param); | ||
} | ||
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"; | ||
} | ||
return _results; | ||
}).call(this)).length > 0) { | ||
type = param.type || param.dataType; | ||
if (((function() { | ||
var _i, _len, _ref, _results; | ||
_ref = this.operation.parameters; | ||
_results = []; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
param = _ref[_i]; | ||
if (type.toLowerCase() === "file") { | ||
_results.push(param); | ||
} | ||
} | ||
return _results; | ||
}).call(this)).length > 0) { | ||
requestContentType = "multipart/form-data"; | ||
} else { | ||
requestContentType = "application/x-www-form-urlencoded"; | ||
} | ||
} else if (this.type !== "DELETE") { | ||
requestContentType = null; | ||
} | ||
data += "--" + boundary + "--\n"; | ||
headers["Content-Type"] = "multipart/form-data; boundary=" + boundary; | ||
body = data; | ||
} | ||
if (requestContentType && this.operation.consumes) { | ||
if (this.operation.consumes.indexOf(requestContentType) === -1) { | ||
console.log("server doesn't consume " + requestContentType + ", try " + JSON.stringify(this.operation.consumes)); | ||
if (this.requestContentType === null) { | ||
requestContentType = this.operation.consumes[0]; | ||
} | ||
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); | ||
} | ||
} | ||
}; | ||
var e; | ||
if (typeof window !== 'undefined') { | ||
e = window; | ||
} else { | ||
e = exports; | ||
} | ||
responseContentType = null; | ||
if (this.type === "POST" || this.type === "GET" || this.type === "PATCH") { | ||
if (this.opts.responseContentType) { | ||
responseContentType = this.opts.responseContentType; | ||
var status = e.authorizations.apply(obj, this.operation.authorizations); | ||
if (opts.mock == null) { | ||
if (status !== false) { | ||
new SwaggerHttp().execute(obj); | ||
} else { | ||
responseContentType = "application/json"; | ||
obj.canceled = true; | ||
} | ||
} else { | ||
responseContentType = null; | ||
return obj; | ||
} | ||
if (responseContentType && this.operation.produces) { | ||
if (this.operation.produces.indexOf(responseContentType) === -1) { | ||
console.log("server can't produce " + responseContentType); | ||
} | ||
} | ||
return obj; | ||
}; | ||
SwaggerRequest.prototype.setHeaders = function (params, operation) { | ||
// default type | ||
var accepts = "application/json"; | ||
var consumes = "application/json"; | ||
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; | ||
} | ||
if (requestContentType && requestContentType.indexOf("application/x-www-form-urlencoded") === 0) { | ||
fields = {}; | ||
possibleParams = (function() { | ||
var _i, _len, _ref, _results; | ||
_ref = this.operation.parameters; | ||
_results = []; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
param = _ref[_i]; | ||
if (param.paramType === "form") { | ||
_results.push(param); | ||
} | ||
} | ||
return _results; | ||
}).call(this); | ||
values = {}; | ||
for (key in possibleParams) { | ||
value = possibleParams[key]; | ||
if (this.params[value.name]) { | ||
values[value.name] = this.params[value.name]; | ||
} | ||
} | ||
urlEncoded = ""; | ||
for (key in values) { | ||
value = values[key]; | ||
if (urlEncoded !== "") { | ||
urlEncoded += "&"; | ||
} | ||
urlEncoded += encodeURIComponent(key) + '=' + encodeURIComponent(value); | ||
} | ||
body = urlEncoded; | ||
} | ||
// 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"; | ||
} | ||
for (name in headers) { | ||
myHeaders[name] = headers[name]; | ||
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 (requestContentType) { | ||
myHeaders["Content-Type"] = requestContentType; | ||
} | ||
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 (responseContentType) { | ||
myHeaders["Accept"] = responseContentType; | ||
} | ||
if ((consumes && body !== "") || (consumes === "application/x-www-form-urlencoded")) | ||
headers["Content-Type"] = consumes; | ||
if (accepts) | ||
headers["Accept"] = accepts; | ||
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] + "\""); | ||
} | ||
if (!((headers != null) && (headers.mock != null))) { | ||
obj = { | ||
url: this.url, | ||
method: this.type, | ||
headers: myHeaders, | ||
body: body, | ||
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); | ||
} | ||
} | ||
}; | ||
e = {}; | ||
if (typeof window !== 'undefined') { | ||
e = window; | ||
} else { | ||
e = exports; | ||
} | ||
return "curl " + (results.join(" ")) + " " + this.url; | ||
}; | ||
/** | ||
* 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(); | ||
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; | ||
} | ||
e.authorizations.apply(obj); | ||
if (opts.mock == null) { | ||
new SwaggerHttp().execute(obj); | ||
} else { | ||
console.log(obj); | ||
return obj; | ||
} | ||
} | ||
} | ||
return detectedIE; | ||
}; | ||
SwaggerRequest.prototype.asCurl = function() { | ||
var header_args, k, v; | ||
header_args = (function() { | ||
var _ref, _results; | ||
_ref = this.headers; | ||
_results = []; | ||
for (k in _ref) { | ||
v = _ref[k]; | ||
_results.push("--header \"" + k + ": " + v + "\""); | ||
/* | ||
* 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; | ||
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])); | ||
} | ||
} | ||
return _results; | ||
}).call(this); | ||
return "curl " + (header_args.join(" ")) + " " + this.url; | ||
return results; | ||
} | ||
}; | ||
return SwaggerRequest; | ||
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(), | ||
value = toSplit.substring(separator + 1).trim(); | ||
headers[name] = value; | ||
} | ||
SwaggerHttp = (function() { | ||
SwaggerHttp.prototype.Shred = null; | ||
var out = { | ||
url: request.url, | ||
method: request.method, | ||
status: response.status, | ||
data: response.responseText, | ||
headers: headers | ||
}; | ||
SwaggerHttp.prototype.shred = null; | ||
var contentType = (headers["content-type"] || headers["Content-Type"] || null) | ||
SwaggerHttp.prototype.content = null; | ||
function SwaggerHttp() { | ||
var identity, toString, | ||
_this = this; | ||
if (typeof window !== 'undefined') { | ||
this.Shred = require("./shred"); | ||
} else { | ||
this.Shred = require("shred"); | ||
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 = {} | ||
} | ||
} | ||
this.shred = new this.Shred(); | ||
identity = function(x) { | ||
return x; | ||
}; | ||
toString = function(x) { | ||
return x.toString(); | ||
}; | ||
if (typeof window !== 'undefined') { | ||
this.content = require("./shred/content"); | ||
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 | ||
}); | ||
} | ||
} | ||
SwaggerHttp.prototype.execute = function(obj) { | ||
return this.shred.request(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); | ||
}; | ||
return SwaggerHttp; | ||
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; | ||
SwaggerAuthorizations = (function() { | ||
SwaggerAuthorizations.prototype.authz = null; | ||
var identity, toString; | ||
function SwaggerAuthorizations() { | ||
this.authz = {}; | ||
if (typeof window !== 'undefined') { | ||
this.Shred = require("./shred"); | ||
this.content = require("./shred/content"); | ||
} | ||
else | ||
this.Shred = require("shred"); | ||
this.shred = new this.Shred(); | ||
} | ||
SwaggerAuthorizations.prototype.add = function(name, auth) { | ||
this.authz[name] = auth; | ||
return auth; | ||
}; | ||
ShredHttpClient.prototype.initShred = function () { | ||
this.isInitialized = true; | ||
this.registerProcessors(this.shred); | ||
} | ||
SwaggerAuthorizations.prototype.apply = function(obj) { | ||
var key, value, _ref, _results; | ||
_ref = this.authz; | ||
_results = []; | ||
for (key in _ref) { | ||
value = _ref[key]; | ||
_results.push(value.apply(obj)); | ||
} | ||
return _results; | ||
ShredHttpClient.prototype.registerProcessors = function (shred) { | ||
var identity = function (x) { | ||
return x; | ||
}; | ||
var toString = function (x) { | ||
return x.toString(); | ||
}; | ||
return SwaggerAuthorizations; | ||
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(); | ||
ApiKeyAuthorization = (function() { | ||
ApiKeyAuthorization.prototype.type = null; | ||
var cb = obj.on, res; | ||
ApiKeyAuthorization.prototype.name = null; | ||
var transform = function (response) { | ||
var out = { | ||
headers: response._headers, | ||
url: response.request.url, | ||
method: response.request.method, | ||
status: response.status, | ||
data: response.content.data | ||
}; | ||
ApiKeyAuthorization.prototype.value = null; | ||
var contentType = (response._headers["content-type"] || response._headers["Content-Type"] || null) | ||
function ApiKeyAuthorization(name, value, type) { | ||
this.name = name; | ||
this.value = value; | ||
this.type = type; | ||
} | ||
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; | ||
}; | ||
ApiKeyAuthorization.prototype.apply = function(obj) { | ||
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; | ||
// 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 | ||
}; | ||
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; | ||
} | ||
return true; | ||
} else if (this.type === "header") { | ||
return obj.headers[this.name] = this.value; | ||
} | ||
return out; | ||
}; | ||
return ApiKeyAuthorization; | ||
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); | ||
}; | ||
})(); | ||
/** | ||
* SwaggerAuthorizations applys the correct authorization to an operation being executed | ||
*/ | ||
var SwaggerAuthorizations = function () { | ||
this.authz = {}; | ||
}; | ||
PasswordAuthorization = (function() { | ||
PasswordAuthorization.prototype.name = null; | ||
SwaggerAuthorizations.prototype.add = function (name, auth) { | ||
this.authz[name] = auth; | ||
return auth; | ||
}; | ||
PasswordAuthorization.prototype.username = null; | ||
SwaggerAuthorizations.prototype.remove = function (name) { | ||
return delete this.authz[name]; | ||
}; | ||
PasswordAuthorization.prototype.password = null; | ||
SwaggerAuthorizations.prototype.apply = function (obj, authorizations) { | ||
var status = null; | ||
var key, value, result; | ||
function PasswordAuthorization(name, username, password) { | ||
this.name = name; | ||
this.username = username; | ||
this.password = password; | ||
// 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) { | ||
if (key == name) { | ||
value = this.authz[key]; | ||
result = value.apply(obj, authorizations); | ||
if (result === true) | ||
status = true; | ||
} | ||
} | ||
} | ||
} | ||
PasswordAuthorization.prototype.apply = function(obj) { | ||
return obj.headers["Authorization"] = "Basic " + btoa(this.username + ":" + this.password); | ||
}; | ||
return status; | ||
}; | ||
return PasswordAuthorization; | ||
/** | ||
* 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.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; | ||
} | ||
}; | ||
this.SwaggerApi = SwaggerApi; | ||
var CookieAuthorization = function (cookie) { | ||
this.cookie = cookie; | ||
} | ||
this.SwaggerResource = SwaggerResource; | ||
CookieAuthorization.prototype.apply = function (obj, authorizations) { | ||
obj.cookieJar = obj.cookieJar || CookieJar(); | ||
obj.cookieJar.setCookie(this.cookie); | ||
return true; | ||
} | ||
this.SwaggerOperation = SwaggerOperation; | ||
/** | ||
* 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"); | ||
}; | ||
this.SwaggerRequest = SwaggerRequest; | ||
PasswordAuthorization.prototype.apply = function (obj, authorizations) { | ||
var base64encoder = this._btoa; | ||
obj.headers["Authorization"] = "Basic " + base64encoder(this.username + ":" + this.password); | ||
return true; | ||
}; | ||
this.SwaggerModelProperty = SwaggerModelProperty; | ||
var e = (typeof window !== 'undefined' ? window : exports); | ||
this.ApiKeyAuthorization = ApiKeyAuthorization; | ||
var sampleModels = {}; | ||
var cookies = {}; | ||
this.PasswordAuthorization = PasswordAuthorization; | ||
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; | ||
this.authorizations = new SwaggerAuthorizations(); | ||
}).call(this); | ||
})(); |
@@ -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()}function log(){if(window.console){console.log.apply(console,arguments)}}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(g,m,f,l,k){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);k=k||{};var i="",c,h="function",j=this.escapeExpression,p=this;function e(v,u){var r="",t,s;r+='\n <div class="info_title">'+j(((t=((t=v.info),t==null||t===false?t:t.title)),typeof t===h?t.apply(v):t))+'</div>\n <div class="info_description">';s=((t=((t=v.info),t==null||t===false?t:t.description)),typeof t===h?t.apply(v):t);if(s||s===0){r+=s}r+="</div>\n ";s=f["if"].call(v,((t=v.info),t==null||t===false?t:t.termsOfServiceUrl),{hash:{},inverse:p.noop,fn:p.program(2,d,u),data:u});if(s||s===0){r+=s}r+="\n ";s=f["if"].call(v,((t=v.info),t==null||t===false?t:t.contact),{hash:{},inverse:p.noop,fn:p.program(4,q,u),data:u});if(s||s===0){r+=s}r+="\n ";s=f["if"].call(v,((t=v.info),t==null||t===false?t:t.license),{hash:{},inverse:p.noop,fn:p.program(6,o,u),data:u});if(s||s===0){r+=s}r+="\n ";return r}function d(u,t){var r="",s;r+='<div class="info_tos"><a href="'+j(((s=((s=u.info),s==null||s===false?s:s.termsOfServiceUrl)),typeof s===h?s.apply(u):s))+'">Terms of service</a></div>';return r}function q(u,t){var r="",s;r+="<div class='info_contact'><a href=\"mailto:"+j(((s=((s=u.info),s==null||s===false?s:s.contact)),typeof s===h?s.apply(u):s))+'">Contact the developer</a></div>';return r}function o(u,t){var r="",s;r+="<div class='info_license'><a href='"+j(((s=((s=u.info),s==null||s===false?s:s.licenseUrl)),typeof s===h?s.apply(u):s))+"'>"+j(((s=((s=u.info),s==null||s===false?s:s.license)),typeof s===h?s.apply(u):s))+"</a></div>";return r}function n(u,t){var r="",s;r+='\n , <span style="font-variant: small-caps">api version</span>: ';if(s=f.apiVersion){s=s.call(u,{hash:{},data:t})}else{s=u.apiVersion;s=typeof s===h?s.apply(u):s}r+=j(s)+"\n ";return r}i+="<div class='info' id='api_info'>\n ";c=f["if"].call(m,m.info,{hash:{},inverse:p.noop,fn:p.program(1,e,k),data:k});if(c||c===0){i+=c}i+="\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=f.basePath){c=c.call(m,{hash:{},data:k})}else{c=m.basePath;c=typeof c===h?c.apply(m):c}i+=j(c)+"\n ";c=f["if"].call(m,m.apiVersion,{hash:{},inverse:p.noop,fn:p.program(8,n,k),data:k});if(c||c===0){i+=c}i+="]</h4>\n </div>\n</div>\n";return i})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.operation=b(function(h,n,g,m,l){this.compilerInfo=[4,">= 1.0.0"];g=this.merge(g,h.helpers);l=l||{};var j="",d,i="function",k=this.escapeExpression,r=this;function f(v,u){var s="",t;s+="\n <h4>Implementation Notes</h4>\n <p>";if(t=g.notes){t=t.call(v,{hash:{},data:u})}else{t=v.notes;t=typeof t===i?t.apply(v):t}if(t||t===0){s+=t}s+="</p>\n ";return s}function c(t,s){return'\n <h4>Response Class</h4>\n <p><span class="model-signature" /></p>\n <br/>\n <div class="response-content-type" />\n '}function q(t,s){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 p(t,s){return"\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Error Status Codes</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n "}function o(t,s){return"\n "}function e(t,s){return"\n <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <img alt='Throbber' class='response_throbber' src='images/throbber.gif' style='display:none' />\n </div>\n "}j+="\n <ul class='operations' >\n <li class='";if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+" operation' id='";if(d=g.resourceName){d=d.call(n,{hash:{},data:l})}else{d=n.resourceName;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.nickname){d=d.call(n,{hash:{},data:l})}else{d=n.nickname;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.number){d=d.call(n,{hash:{},data:l})}else{d=n.number;d=typeof d===i?d.apply(n):d}j+=k(d)+"'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/";if(d=g.resourceName){d=d.call(n,{hash:{},data:l})}else{d=n.resourceName;d=typeof d===i?d.apply(n):d}j+=k(d)+"/";if(d=g.nickname){d=d.call(n,{hash:{},data:l})}else{d=n.nickname;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.number){d=d.call(n,{hash:{},data:l})}else{d=n.number;d=typeof d===i?d.apply(n):d}j+=k(d)+'\' class="toggleOperation">';if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+"</a>\n </span>\n <span class='path'>\n <a href='#!/";if(d=g.resourceName){d=d.call(n,{hash:{},data:l})}else{d=n.resourceName;d=typeof d===i?d.apply(n):d}j+=k(d)+"/";if(d=g.nickname){d=d.call(n,{hash:{},data:l})}else{d=n.nickname;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.number){d=d.call(n,{hash:{},data:l})}else{d=n.number;d=typeof d===i?d.apply(n):d}j+=k(d)+'\' class="toggleOperation">';if(d=g.path){d=d.call(n,{hash:{},data:l})}else{d=n.path;d=typeof d===i?d.apply(n):d}j+=k(d)+"</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/";if(d=g.resourceName){d=d.call(n,{hash:{},data:l})}else{d=n.resourceName;d=typeof d===i?d.apply(n):d}j+=k(d)+"/";if(d=g.nickname){d=d.call(n,{hash:{},data:l})}else{d=n.nickname;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.number){d=d.call(n,{hash:{},data:l})}else{d=n.number;d=typeof d===i?d.apply(n):d}j+=k(d)+'\' class="toggleOperation">';if(d=g.summary){d=d.call(n,{hash:{},data:l})}else{d=n.summary;d=typeof d===i?d.apply(n):d}if(d||d===0){j+=d}j+="</a>\n </li>\n </ul>\n </div>\n <div class='content' id='";if(d=g.resourceName){d=d.call(n,{hash:{},data:l})}else{d=n.resourceName;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.nickname){d=d.call(n,{hash:{},data:l})}else{d=n.nickname;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.method){d=d.call(n,{hash:{},data:l})}else{d=n.method;d=typeof d===i?d.apply(n):d}j+=k(d)+"_";if(d=g.number){d=d.call(n,{hash:{},data:l})}else{d=n.number;d=typeof d===i?d.apply(n):d}j+=k(d)+"_content' style='display:none'>\n ";d=g["if"].call(n,n.notes,{hash:{},inverse:r.noop,fn:r.program(1,f,l),data:l});if(d||d===0){j+=d}j+="\n ";d=g["if"].call(n,n.type,{hash:{},inverse:r.noop,fn:r.program(3,c,l),data:l});if(d||d===0){j+=d}j+="\n <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n ";d=g["if"].call(n,n.parameters,{hash:{},inverse:r.noop,fn:r.program(5,q,l),data:l});if(d||d===0){j+=d}j+="\n ";d=g["if"].call(n,n.responseMessages,{hash:{},inverse:r.noop,fn:r.program(7,p,l),data:l});if(d||d===0){j+=d}j+="\n ";d=g["if"].call(n,n.isReadOnly,{hash:{},inverse:r.program(11,e,l),fn:r.program(9,o,l),data:l});if(d||d===0){j+=d}j+="\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 j})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.param=b(function(f,q,o,j,s){this.compilerInfo=[4,">= 1.0.0"];o=this.merge(o,f.helpers);s=s||{};var p="",g,d="function",c=this.escapeExpression,n=this;function m(x,w){var u="",v;u+="\n ";v=o["if"].call(x,x.isFile,{hash:{},inverse:n.program(4,k,w),fn:n.program(2,l,w),data:w});if(v||v===0){u+=v}u+="\n ";return u}function l(x,w){var u="",v;u+='\n <input type="file" name=\'';if(v=o.name){v=v.call(x,{hash:{},data:w})}else{v=x.name;v=typeof v===d?v.apply(x):v}u+=c(v)+'\'/>\n <div class="parameter-content-type" />\n ';return u}function k(x,w){var u="",v;u+="\n ";v=o["if"].call(x,x.defaultValue,{hash:{},inverse:n.program(7,h,w),fn:n.program(5,i,w),data:w});if(v||v===0){u+=v}u+="\n ";return u}function i(x,w){var u="",v;u+="\n <textarea class='body-textarea' name='";if(v=o.name){v=v.call(x,{hash:{},data:w})}else{v=x.name;v=typeof v===d?v.apply(x):v}u+=c(v)+"'>";if(v=o.defaultValue){v=v.call(x,{hash:{},data:w})}else{v=x.defaultValue;v=typeof v===d?v.apply(x):v}u+=c(v)+"</textarea>\n ";return u}function h(x,w){var u="",v;u+="\n <textarea class='body-textarea' name='";if(v=o.name){v=v.call(x,{hash:{},data:w})}else{v=x.name;v=typeof v===d?v.apply(x):v}u+=c(v)+'\'></textarea>\n <br />\n <div class="parameter-content-type" />\n ';return u}function e(x,w){var u="",v;u+="\n ";v=o["if"].call(x,x.defaultValue,{hash:{},inverse:n.program(12,r,w),fn:n.program(10,t,w),data:w});if(v||v===0){u+=v}u+="\n ";return u}function t(x,w){var u="",v;u+="\n <input class='parameter' minlength='0' name='";if(v=o.name){v=v.call(x,{hash:{},data:w})}else{v=x.name;v=typeof v===d?v.apply(x):v}u+=c(v)+"' placeholder='' type='text' value='";if(v=o.defaultValue){v=v.call(x,{hash:{},data:w})}else{v=x.defaultValue;v=typeof v===d?v.apply(x):v}u+=c(v)+"'/>\n ";return u}function r(x,w){var u="",v;u+="\n <input class='parameter' minlength='0' name='";if(v=o.name){v=v.call(x,{hash:{},data:w})}else{v=x.name;v=typeof v===d?v.apply(x):v}u+=c(v)+"' placeholder='' type='text' value=''/>\n ";return u}p+="<td class='code'>";if(g=o.name){g=g.call(q,{hash:{},data:s})}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,s),fn:n.program(1,m,s),data:s});if(g||g===0){p+=g}p+="\n\n</td>\n<td>";if(g=o.description){g=g.call(q,{hash:{},data:s})}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:s})}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(g,r,p,l,w){this.compilerInfo=[4,">= 1.0.0"];p=this.merge(p,g.helpers);w=w||{};var q="",i,e,o=this,d="function",c=this.escapeExpression;function n(y,x){return" multiple='multiple'"}function m(y,x){return"\n "}function k(A,z){var x="",y;x+="\n ";y=p["if"].call(A,A.defaultValue,{hash:{},inverse:o.program(8,h,z),fn:o.program(6,j,z),data:z});if(y||y===0){x+=y}x+="\n ";return x}function j(y,x){return"\n "}function h(A,z){var x="",y;x+="\n ";y=p["if"].call(A,A.allowMultiple,{hash:{},inverse:o.program(11,v,z),fn:o.program(9,f,z),data:z});if(y||y===0){x+=y}x+="\n ";return x}function f(y,x){return"\n "}function v(y,x){return"\n <option selected=\"\" value=''></option>\n "}function u(A,z){var x="",y;x+="\n ";y=p["if"].call(A,A.isDefault,{hash:{},inverse:o.program(16,s,z),fn:o.program(14,t,z),data:z});if(y||y===0){x+=y}x+="\n ";return x}function t(A,z){var x="",y;x+='\n <option selected="" value=\'';if(y=p.value){y=y.call(A,{hash:{},data:z})}else{y=A.value;y=typeof y===d?y.apply(A):y}x+=c(y)+"'>";if(y=p.value){y=y.call(A,{hash:{},data:z})}else{y=A.value;y=typeof y===d?y.apply(A):y}x+=c(y)+" (default)</option>\n ";return x}function s(A,z){var x="",y;x+="\n <option value='";if(y=p.value){y=y.call(A,{hash:{},data:z})}else{y=A.value;y=typeof y===d?y.apply(A):y}x+=c(y)+"'>";if(y=p.value){y=y.call(A,{hash:{},data:z})}else{y=A.value;y=typeof y===d?y.apply(A):y}x+=c(y)+"</option>\n ";return x}q+="<td class='code'>";if(i=p.name){i=i.call(r,{hash:{},data:w})}else{i=r.name;i=typeof i===d?i.apply(r):i}q+=c(i)+"</td>\n<td>\n <select ";i=p["if"].call(r,r.allowMultiple,{hash:{},inverse:o.noop,fn:o.program(1,n,w),data:w});if(i||i===0){q+=i}q+=" class='parameter' name='";if(i=p.name){i=i.call(r,{hash:{},data:w})}else{i=r.name;i=typeof i===d?i.apply(r):i}q+=c(i)+"'>\n ";i=p["if"].call(r,r.required,{hash:{},inverse:o.program(5,k,w),fn:o.program(3,m,w),data:w});if(i||i===0){q+=i}q+="\n ";e=p.each.call(r,((i=r.allowableValues),i==null||i===false?i:i.descriptiveValues),{hash:{},inverse:o.noop,fn:o.program(13,u,w),data:w});if(e||e===0){q+=e}q+="\n </select>\n</td>\n<td>";if(e=p.description){e=e.call(r,{hash:{},data:w})}else{e=r.description;e=typeof e===d?e.apply(r):e}if(e||e===0){q+=e}q+="</td>\n<td>";if(e=p.paramType){e=e.call(r,{hash:{},data:w})}else{e=r.paramType;e=typeof e===d?e.apply(r):e}if(e||e===0){q+=e}q+='</td>\n<td><span class="model-signature"></span></td>';return q})})();(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(f,l,e,k,j){this.compilerInfo=[4,">= 1.0.0"];e=this.merge(e,f.helpers);j=j||{};var h="",c,o,g="function",i=this.escapeExpression,n=this,m=e.blockHelperMissing;function d(q,p){return" : "}h+="<div class='heading'>\n <h2>\n <a href='#!/";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"' onclick=\"Docs.toggleEndpointListForResource('";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"');\">";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"</a> ";o={hash:{},inverse:n.noop,fn:n.program(1,d,j),data:j};if(c=e.description){c=c.call(l,o)}else{c=l.description;c=typeof c===g?c.apply(l):c}if(!e.description){c=m.call(l,c,o)}if(c||c===0){h+=c}if(c=e.description){c=c.call(l,{hash:{},data:j})}else{c=l.description;c=typeof c===g?c.apply(l):c}if(c||c===0){h+=c}h+="\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"' id='endpointListTogger_";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"'\n onclick=\"Docs.toggleEndpointListForResource('";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"');\">Show/Hide</a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.collapseOperationsForResource('";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"'); return false;\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.expandOperationsForResource('";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"'); return false;\">\n Expand Operations\n </a>\n </li>\n <li>\n <a href='";if(c=e.url){c=c.call(l,{hash:{},data:j})}else{c=l.url;c=typeof c===g?c.apply(l):c}h+=i(c)+"'>Raw</a>\n </li>\n </ul>\n</div>\n<ul class='endpoints' id='";if(c=e.name){c=c.call(l,{hash:{},data:j})}else{c=l.name;c=typeof c===g?c.apply(l):c}h+=i(c)+"_endpoint_list' style='display:none'>\n\n</ul>\n";return h})})();(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";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){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 SwaggerApi(this.options);this.api.build();return this.api};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)}).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(B,A){var C;console.log("base is "+B);C=B.split("/");B=C[0]+"//"+C[2];if(A.indexOf("/")===0){return B+A}else{return B+"/"+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){v(z,y);function z(){g=z.__super__.constructor.apply(this,arguments);return g}z.prototype.initialize=function(){};z.prototype.render=function(){var C,B,A,D;$(this.el).html(Handlebars.templates.main(this.model));D=this.model.apisArray;for(B=0,A=D.length;B<A;B++){C=D[B];this.addResource(C)}return this};z.prototype.addResource=function(B){var A;A=new n({model:B,tagName:"li",id:"resource_"+B.name,className:"resource"});return $("#resources").append(A.render().el)};z.prototype.clear=function(){return $(this.el).html("")};return z})(Backbone.View);n=(function(z){v(y,z);function y(){f=y.__super__.constructor.apply(this,arguments);return f}y.prototype.initialize=function(){};y.prototype.render=function(){var B,C,A,D;console.log(this.model.description);$(this.el).html(Handlebars.templates.resource(this.model));this.number=0;D=this.model.operationsArray;for(C=0,A=D.length;C<A;C++){B=D[C];this.addOperation(B)}return this};y.prototype.addOperation=function(A){var B;A.number=this.number;B=new o({model:A,tagName:"li",className:"endpoint"});$(".endpoints",$(this.el)).append(B.render().el);return this.number++};return y})(Backbone.View);o=(function(z){v(y,z);function y(){e=y.__super__.constructor.apply(this,arguments);return e}y.prototype.events={"submit .sandbox":"submitOperation","click .submit":"submitOperation","click .response_hider":"hideResponse","click .toggleOperation":"toggleOperationContent"};y.prototype.initialize=function(){};y.prototype.render=function(){var A,P,G,M,K,Q,L,N,J,I,H,O,E,C,F,D,B;P=true;if(!P){this.model.isReadOnly=true}$(this.el).html(Handlebars.templates.operation(this.model));if(this.model.responseClassSignature&&this.model.responseClassSignature!=="string"){Q={sampleJSON:this.model.responseSampleJSON,isParam:false,signature:this.model.responseClassSignature};K=new i({model:Q,tagName:"div"});$(".model-signature",$(this.el)).append(K.render().el)}else{$(".model-signature",$(this.el)).html(this.model.type)}A={isParam:false};A.consumes=this.model.consumes;A.produces=this.model.produces;F=this.model.parameters;for(J=0,O=F.length;J<O;J++){G=F[J];N=G.type||G.dataType;if(N.toLowerCase()==="file"){if(!A.consumes){console.log("set content type ");A.consumes="multipart/form-data"}}}M=new m({model:A});$(".response-content-type",$(this.el)).append(M.render().el);D=this.model.parameters;for(I=0,E=D.length;I<E;I++){G=D[I];this.addParameter(G,A.consumes)}B=this.model.responseMessages;for(H=0,C=B.length;H<C;H++){L=B[H];this.addStatusCode(L)}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(N){var P,G,D,I,A,J,M,L,K,O,F,C,H,E,B;if(N!=null){N.preventDefault()}G=$(".sandbox",$(this.el));P=true;G.find("input.required").each(function(){var Q=this;$(this).removeClass("error");if(jQuery.trim($(this).val())===""){$(this).addClass("error");$(this).wiggle({callback:function(){return $(Q).focus()}});return P=false}});if(P){D={};A={parent:this};H=G.find("input");for(M=0,O=H.length;M<O;M++){I=H[M];if((I.value!=null)&&jQuery.trim(I.value).length>0){D[I.name]=I.value}}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();return this.model["do"](D,A,this.showCompleteStatus,this.showErrorStatus,this)}};y.prototype.success=function(A,B){return B.showCompleteStatus(A)};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.join(",")}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(D){var C,B,G,F,E,A;B=D.content.data;F=D.getHeaders();G=F["Content-Type"];if(B===void 0){C=$("<code />").text("no content");E=$('<pre class="json" />').append(C)}else{if(G.indexOf("application/json")===0||G.indexOf("application/hal+json")===0){C=$("<code />").text(JSON.stringify(JSON.parse(B),null,2));E=$('<pre class="json" />').append(C)}else{if(G.indexOf("application/xml")===0){C=$("<code />").text(this.formatXml(B));E=$('<pre class="xml" />').append(C)}else{if(G.indexOf("text/html")===0){C=$("<code />").html(B);E=$('<pre class="xml" />').append(C)}else{C=$("<code />").text(B);E=$('<pre class="json" />').append(C)}}}}A=E;$(".request_url").html("<pre>"+D.request.url+"</pre>");$(".response_code",$(this.el)).html("<pre>"+D.status+"</pre>");$(".response_body",$(this.el)).html(A);$(".response_headers",$(this.el)).html("<pre>"+JSON.stringify(D.getHeaders())+"</pre>");$(".response",$(this.el)).slideDown();$(".response_hider",$(this.el)).show();$(".response_throbber",$(this.el)).hide();return hljs.highlightBlock($(".response_body",$(this.el))[0])};y.prototype.toggleOperationContent=function(){var A;A=$("#"+Docs.escapeResourceName(this.model.resourceName)+"_"+this.model.nickname+"_"+this.model.method+"_"+this.model.number+"_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 A;A=this.template();$(this.el).html(A(this.model));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(){};y.prototype.render=function(){var G,A,C,F,B,H,E,D;D=this.model.type||this.model.dataType;if(this.model.paramType==="body"){this.model.isBody=true}if(D.toLowerCase()==="file"){this.model.isFile=true}E=this.template();$(this.el).html(E(this.model));B={sampleJSON:this.model.sampleJSON,isParam:true,signature:this.model.signature};if(this.model.sampleJSON){H=new i({model:B,tagName:"div"});$(".model-signature",$(this.el)).append(H.render().el)}else{$(".model-signature",$(this.el)).html(this.model.signature)}A=false;if(this.model.isBody){A=true}G={isParam:A};G.consumes=this.model.consumes;if(A){C=new l({model:G});$(".parameter-content-type",$(this.el)).append(C.render().el)}else{F=new m({model:G});$(".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.switchToDescription();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.apikey_button_view=b(function(e,k,d,j,i){this.compilerInfo=[4,">= 1.0.0"];d=this.merge(d,e.helpers);i=i||{};var g="",c,f="function",h=this.escapeExpression;g+="<div class='auth_button' id='apikey_button'><img class='auth_icon' alt='apply api key' src='images/apikey.jpeg'></div>\n<div class='auth_container' id='apikey_container'>\n <div class='key_input_container'>\n <div class='auth_label'>";if(c=d.keyName){c=c.call(k,{hash:{},data:i})}else{c=k.keyName;c=typeof c===f?c.apply(k):c}g+=h(c)+'</div>\n <input placeholder="api_key" class="auth_input" id="input_apiKey_entry" name="apiKey" type="text"/>\n <div class=\'auth_submit\'><a class=\'auth_submit_button\' id="apply_api_key" href="#">apply</a></div>\n </div>\n</div>\n\n';return g})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.basic_auth_button_view=b(function(f,g,d,c,e){this.compilerInfo=[4,">= 1.0.0"];d=this.merge(d,f.helpers);e=e||{};return'<div class=\'auth_button\' id=\'basic_auth_button\'><img class=\'auth_icon\' src=\'images/password.jpeg\'></div>\n<div class=\'auth_container\' id=\'basic_auth_container\'>\n <div class=\'key_input_container\'>\n <div class="auth_label">Username</div>\n <input placeholder="username" class="auth_input" id="input_username" name="username" type="text"/>\n <div class="auth_label">Password</div>\n <input placeholder="password" class="auth_input" id="input_password" name="password" type="password"/>\n <div class=\'auth_submit\'><a class=\'auth_submit_button\' id="apply_basic_auth" href="#">apply</a></div>\n </div>\n</div>\n\n'})})();(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a.content_type=b(function(g,l,f,k,j){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);j=j||{};var i="",c,h="function",m=this;function e(r,q){var o="",p;o+="\n ";p=f.each.call(r,r.produces,{hash:{},inverse:m.noop,fn:m.program(2,d,q),data:q});if(p||p===0){o+=p}o+="\n";return o}function d(r,q){var o="",p;o+='\n <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'></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 t,k,l,u,x,q,n,m,p,o,j,r,v,s,i,d,b,B,h,g,f,e,c,a,A,z,w={}.hasOwnProperty,y=function(F,D){for(var C in D){if(w.call(D,C)){F[C]=D[C]}}function E(){this.constructor=F}E.prototype=D.prototype;F.prototype=new E();F.__super__=D.prototype;return F};v=(function(D){y(C,D);function C(){s=C.__super__.constructor.apply(this,arguments);return s}C.prototype.dom_id="swagger_ui";C.prototype.options=null;C.prototype.api=null;C.prototype.headerView=null;C.prototype.mainView=null;C.prototype.initialize=function(E){var F=this;if(E==null){E={}}if(E.dom_id!=null){this.dom_id=E.dom_id;delete E.dom_id}if($("#"+this.dom_id)==null){$("body").append('<div id="'+this.dom_id+'"></div>')}this.options=E;this.options.success=function(){return F.render()};this.options.progress=function(G){return F.showMessage(G)};this.options.failure=function(G){if(F.api&&F.api.isValid===false){log("not a valid 2.0 spec, loading legacy client");F.api=new SwaggerApi(F.options);return F.api.build()}else{return F.onLoadFailure(G)}};this.headerView=new u({el:$("#header")});return this.headerView.on("update-swagger-ui",function(G){return F.updateSwaggerUi(G)})};C.prototype.setOption=function(E,F){return this.options[E]=F};C.prototype.getOption=function(E){return this.options[E]};C.prototype.updateSwaggerUi=function(E){this.options.url=E.url;return this.load()};C.prototype.load=function(){var F,E;if((E=this.mainView)!=null){E.clear()}F=this.options.url;if(F.indexOf("http")!==0){F=this.buildUrl(window.location.href.toString(),F)}this.options.url=F;this.headerView.update(F);this.api=new SwaggerClient(this.options);return this.api.build()};C.prototype.render=function(){var E=this;this.showMessage("Finished Loading Resource Information. Rendering Swagger UI...");this.mainView=new x({model:this.api,el:$("#"+this.dom_id),swaggerOptions:this.options}).render();this.showMessage();switch(this.options.docExpansion){case"full":Docs.expandOperationsForResource("");break;case"list":Docs.collapseOperationsForResource("")}if(this.options.onComplete){this.options.onComplete(this.api,this)}return setTimeout(function(){return Docs.shebang()},400)};C.prototype.buildUrl=function(G,E){var F,H;log("base is "+G);if(E.indexOf("/")===0){H=G.split("/");G=H[0]+"//"+H[2];return G+E}else{F=G.length;if(G.indexOf("?")>-1){F=Math.min(F,G.indexOf("?"))}if(G.indexOf("#")>-1){F=Math.min(F,G.indexOf("#"))}G=G.substring(0,F);if(G.indexOf("/",G.length-1)!==-1){return G+E}return G+"/"+E}};C.prototype.showMessage=function(E){if(E==null){E=""}$("#message-bar").removeClass("message-fail");$("#message-bar").addClass("message-success");return $("#message-bar").html(E)};C.prototype.onLoadFailure=function(E){var F;if(E==null){E=""}$("#message-bar").removeClass("message-success");$("#message-bar").addClass("message-fail");F=$("#message-bar").html(E);if(this.options.onFailure!=null){this.options.onFailure(E)}return F};return C})(Backbone.Router);window.SwaggerUi=v;u=(function(D){y(C,D);function C(){i=C.__super__.constructor.apply(this,arguments);return i}C.prototype.events={"click #show-pet-store-icon":"showPetStore","click #show-wordnik-dev-icon":"showWordnikDev","click #explore":"showCustom","keyup #input_baseUrl":"showCustomOnKeyup","keyup #input_apiKey":"showCustomOnKeyup"};C.prototype.initialize=function(){};C.prototype.showPetStore=function(E){return this.trigger("update-swagger-ui",{url:"http://petstore.swagger.wordnik.com/api/api-docs"})};C.prototype.showWordnikDev=function(E){return this.trigger("update-swagger-ui",{url:"http://api.wordnik.com/v4/resources.json"})};C.prototype.showCustomOnKeyup=function(E){if(E.keyCode===13){return this.showCustom()}};C.prototype.showCustom=function(E){if(E!=null){E.preventDefault()}return this.trigger("update-swagger-ui",{url:$("#input_baseUrl").val(),apiKey:$("#input_apiKey").val()})};C.prototype.update=function(F,G,E){if(E==null){E=false}$("#input_baseUrl").val(F);if(E){return this.trigger("update-swagger-ui",{url:F})}};return C})(Backbone.View);x=(function(C){var D;y(E,C);function E(){h=E.__super__.constructor.apply(this,arguments);return h}D={alpha:function(G,F){return G.path.localeCompare(F.path)},method:function(G,F){return G.method.localeCompare(F.method)}};E.prototype.initialize=function(J){var I,H,G,F,K,L;if(J==null){J={}}this.model.auths=[];L=this.model.securityDefinitions;for(H in L){K=L[H];I={name:H,type:K.type,value:K};this.model.auths.push(I)}if(this.model.info&&this.model.info.license&&typeof this.model.info.license==="string"){G=this.model.info.license;F=this.model.info.licenseUrl;this.model.info.license={};this.model.info.license.name=G;this.model.info.license.url=F}if(!this.model.info){this.model.info={}}if(!this.model.info.version){this.model.info.version=this.model.apiVersion}if(this.model.swaggerVersion==="2.0"){if("validatorUrl" in J.swaggerOptions){return this.model.validatorUrl=J.swaggerOptions.validatorUrl}else{if(this.model.url.match(/https?:\/\/localhost/)){return this.model.validatorUrl=this.model.url}else{return this.model.validatorUrl="http://online.swagger.io/validator"}}}};E.prototype.render=function(){var K,N,F,H,G,L,I,M,O,J;if(this.model.securityDefinitions){for(G in this.model.securityDefinitions){K=this.model.securityDefinitions[G];if(K.type==="apiKey"&&$("#apikey_button").length===0){N=new t({model:K}).render().el;$(".auth_main_container").append(N)}if(K.type==="basicAuth"&&$("#basic_auth_button").length===0){N=new k({model:K}).render().el;$(".auth_main_container").append(N)}}}$(this.el).html(Handlebars.templates.main(this.model));I={};F=0;J=this.model.apisArray;for(M=0,O=J.length;M<O;M++){L=J[M];H=L.name;while(typeof I[H]!=="undefined"){H=H+"_"+F;F+=1}L.id=H;I[H]=L;this.addResource(L,this.model.auths)}return this};E.prototype.addResource=function(H,G){var F;H.id=H.id.replace(/\s/g,"_");F=new p({model:H,tagName:"li",id:"resource_"+H.id,className:"resource",auths:G,swaggerOptions:this.options.swaggerOptions});return $("#resources").append(F.render().el)};E.prototype.clear=function(){return $(this.el).html("")};return E})(Backbone.View);p=(function(D){y(C,D);function C(){g=C.__super__.constructor.apply(this,arguments);return g}C.prototype.initialize=function(E){if(E==null){E={}}this.auths=E.auths;if(""===this.model.description){return this.model.description=null}};C.prototype.render=function(){var F,K,H,G,I,E,J;$(this.el).html(Handlebars.templates.resource(this.model));H={};if(this.model.description){this.model.summary=this.model.description}J=this.model.operationsArray;for(I=0,E=J.length;I<E;I++){G=J[I];F=0;K=G.nickname;while(typeof H[K]!=="undefined"){K=K+"_"+F;F+=1}H[K]=G;G.nickname=K;G.parentId=this.model.id;this.addOperation(G)}$(".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};C.prototype.addOperation=function(E){var F;E.number=this.number;F=new q({model:E,tagName:"li",className:"endpoint",swaggerOptions:this.options.swaggerOptions,auths:this.auths});$(".endpoints",$(this.el)).append(F.render().el);return this.number++};C.prototype.callDocs=function(F,E){E.preventDefault();return Docs[F](E.currentTarget.getAttribute("data-id"))};return C})(Backbone.View);q=(function(D){y(C,D);function C(){f=C.__super__.constructor.apply(this,arguments);return f}C.prototype.invocationUrl=null;C.prototype.events={"submit .sandbox":"submitOperation","click .submit":"submitOperation","click .response_hider":"hideResponse","click .toggleOperation":"toggleOperationContent","mouseenter .api-ic":"mouseEnter","mouseout .api-ic":"mouseExit"};C.prototype.initialize=function(E){if(E==null){E={}}this.auths=E.auths;return this};C.prototype.mouseEnter=function(J){var H,I,M,F,E,N,K,G,O,L;H=$(J.currentTarget.parentNode).find("#api_information_panel");O=J.pageX;L=J.pageY;N=$(window).scrollLeft();K=$(window).scrollTop();F=N+$(window).width();E=K+$(window).height();G=H.width();I=H.height();if(O+G>F){O=F-G}if(O<N){O=N}if(L+I>E){L=E-I}if(L<K){L=K}M={};M.top=L;M.left=O;H.css(M);return $(J.currentTarget.parentNode).find("#api_information_panel").show()};C.prototype.mouseExit=function(E){return $(E.currentTarget.parentNode).find("#api_information_panel").hide()};C.prototype.render=function(){var al,R,aj,F,W,V,af,S,ab,H,Z,G,U,X,ad,ak,E,ao,Y,aa,ai,ah,ag,ae,T,N,L,J,I,ac,an,am,Q,P,O,M,K;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;log(this.model.authorizations);if(this.model.authorizations){if(Array.isArray(this.model.authorizations)){Q=this.model.authorizations;for(ai=0,T=Q.length;ai<T;ai++){aj=Q[ai];for(S in aj){R=aj[S];for(al in this.auths){R=this.auths[al];if(R.type==="oauth2"){this.model.oauth={};this.model.oauth.scopes=[];P=R.value.scopes;for(af in P){Y=P[af];ab={scope:af,description:Y};this.model.oauth.scopes.push(ab)}}}}}}else{O=this.model.authorizations;for(af in O){Y=O[af];if(af==="oauth2"){if(this.model.oauth===null){this.model.oauth={}}if(this.model.oauth.scopes===void 0){this.model.oauth.scopes=[]}for(ah=0,N=Y.length;ah<N;ah++){ab=Y[ah];this.model.oauth.scopes.push(ab)}}}}}if(typeof this.model.responses!=="undefined"){this.model.responseMessages=[];M=this.model.responses;for(F in M){aa=M[F];X=null;ad=this.model.responses[F].schema;if(ad&&ad["$ref"]){X=ad["$ref"];if(X.indexOf("#/definitions/")===0){X=X.substring("#/definitions/".length)}}this.model.responseMessages.push({code:F,message:aa.description,responseModel:X})}}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"){ak={sampleJSON:this.model.responseSampleJSON,isParam:false,signature:this.model.responseClassSignature};U=new j({model:ak,tagName:"div"});$(".model-signature",$(this.el)).append(U.render().el)}else{this.model.responseClassSignature="string";$(".model-signature",$(this.el)).html(this.model.type)}W={isParam:false};W.consumes=this.model.consumes;W.produces=this.model.produces;K=this.model.parameters;for(ag=0,L=K.length;ag<L;ag++){H=K[ag];ao=H.type||H.dataType;if(typeof ao==="undefined"){X=H.schema;if(X&&X["$ref"]){Z=X["$ref"];if(Z.indexOf("#/definitions/")===0){ao=Z.substring("#/definitions/".length)}else{ao=Z}}}if(ao&&ao.toLowerCase()==="file"){if(!W.consumes){W.consumes="multipart/form-data"}}H.type=ao}G=new o({model:W});$(".response-content-type",$(this.el)).append(G.render().el);an=this.model.parameters;for(ae=0,J=an.length;ae<J;ae++){H=an[ae];this.addParameter(H,W.consumes)}am=this.model.responseMessages;for(ac=0,I=am.length;ac<I;ac++){E=am[ac];this.addStatusCode(E)}return this};C.prototype.addParameter=function(G,E){var F;G.consumes=E;F=new m({model:G,tagName:"tr",readOnly:this.model.isReadOnly});return $(".operation-params",$(this.el)).append(F.render().el)};C.prototype.addStatusCode=function(F){var E;E=new r({model:F,tagName:"tr"});return $(".operation-status",$(this.el)).append(E.render().el)};C.prototype.submitOperation=function(S){var U,K,R,H,M,E,N,Q,P,O,T,J,G,L,I,F;if(S!=null){S.preventDefault()}K=$(".sandbox",$(this.el));U=true;K.find("input.required").each(function(){var V=this;$(this).removeClass("error");if(jQuery.trim($(this).val())===""){$(this).addClass("error");$(this).wiggle({callback:function(){return $(V).focus()}});return U=false}});if(U){H={};E={parent:this};R=false;L=K.find("input");for(Q=0,T=L.length;Q<T;Q++){M=L[Q];if((M.value!=null)&&jQuery.trim(M.value).length>0){H[M.name]=M.value}if(M.type==="file"){R=true}}I=K.find("textarea");for(P=0,J=I.length;P<J;P++){M=I[P];if((M.value!=null)&&jQuery.trim(M.value).length>0){H[M.name]=M.value}}F=K.find("select");for(O=0,G=F.length;O<G;O++){M=F[O];N=this.getSelectedValue(M);if((N!=null)&&jQuery.trim(N).length>0){H[M.name]=N}}E.responseContentType=$("div select[name=responseContentType]",$(this.el)).val();E.requestContentType=$("div select[name=parameterContentType]",$(this.el)).val();$(".response_throbber",$(this.el)).show();if(R){return this.handleFileUpload(H,K)}else{return this.model["do"](H,E,this.showCompleteStatus,this.showErrorStatus,this)}}};C.prototype.success=function(E,F){return F.showCompleteStatus(E)};C.prototype.handleFileUpload=function(V,M){var Q,L,G,R,P,O,T,N,K,J,H,U,Y,X,W,I,F,E,Z,S=this;I=M.serializeArray();for(N=0,U=I.length;N<U;N++){R=I[N];if((R.value!=null)&&jQuery.trim(R.value).length>0){V[R.name]=R.value}}Q=new FormData();T=0;F=this.model.parameters;for(K=0,Y=F.length;K<Y;K++){O=F[K];if(O.paramType==="form"){if(O.type.toLowerCase()!=="file"&&V[O.name]!==void 0){Q.append(O.name,V[O.name])}}}G={};E=this.model.parameters;for(J=0,X=E.length;J<X;J++){O=E[J];if(O.paramType==="header"){G[O.name]=V[O.name]}}Z=M.find('input[type~="file"]');for(H=0,W=Z.length;H<W;H++){L=Z[H];if(typeof L.files[0]!=="undefined"){Q.append($(L).attr("name"),L.files[0]);T+=1}}this.invocationUrl=this.model.supportHeaderParams()?(G=this.model.getHeaderParams(V),this.model.urlify(V,false)):this.model.urlify(V,true);$(".request_url",$(this.el)).html("<pre></pre>");$(".request_url pre",$(this.el)).text(this.invocationUrl);P={type:this.model.method,url:this.invocationUrl,headers:G,data:Q,dataType:"json",contentType:false,processData:false,error:function(ab,ac,aa){return S.showErrorStatus(S.wrap(ab),S)},success:function(aa){return S.showResponse(aa,S)},complete:function(aa){return S.showCompleteStatus(S.wrap(aa),S)}};if(window.authorizations){window.authorizations.apply(P)}if(T===0){P.data.append("fake","true")}jQuery.ajax(P);return false};C.prototype.wrap=function(I){var G,J,L,F,K,H,E;L={};J=I.getAllResponseHeaders().split("\r");for(H=0,E=J.length;H<E;H++){F=J[H];G=F.split(":");if(G[0]!==void 0&&G[1]!==void 0){L[G[0].trim()]=G[1].trim()}}K={};K.content={};K.content.data=I.responseText;K.headers=L;K.request={};K.request.url=this.invocationUrl;K.status=I.status;return K};C.prototype.getSelectedValue=function(E){var H,G,J,F,I;if(!E.multiple){return E.value}else{G=[];I=E.options;for(J=0,F=I.length;J<F;J++){H=I[J];if(H.selected){G.push(H.value)}}if(G.length>0){return G}else{return null}}};C.prototype.hideResponse=function(E){if(E!=null){E.preventDefault()}$(".response",$(this.el)).slideUp();return $(".response_hider",$(this.el)).fadeOut()};C.prototype.showResponse=function(E){var F;F=JSON.stringify(E,null,"\t").replace(/\n/g,"<br>");return $(".response_body",$(this.el)).html(escape(F))};C.prototype.showErrorStatus=function(F,E){return E.showStatus(F)};C.prototype.showCompleteStatus=function(F,E){return E.showStatus(F)};C.prototype.formatXml=function(L){var H,K,F,M,R,N,G,E,P,Q,J,I,O;E=/(>)(<)(\/*)/g;Q=/[ ]*(.*)[ ]+\n/g;H=/(<.+>)(.+\n)/g;L=L.replace(E,"$1\n$2$3").replace(Q,"$1\n").replace(H,"$1\n$2");G=0;K="";R=L.split("\n");F=0;M="other";P={"single->single":0,"single->closing":-1,"single->opening":0,"single->other":0,"closing->single":0,"closing->closing":-1,"closing->opening":0,"closing->other":0,"opening->single":1,"opening->closing":0,"opening->opening":1,"opening->other":1,"other->single":0,"other->closing":-1,"other->opening":0,"other->other":0};J=function(X){var T,S,V,Z,W,U,Y;U={single:Boolean(X.match(/<.+\/>/)),closing:Boolean(X.match(/<\/.+>/)),opening:Boolean(X.match(/<[^!?].*>/))};W=((function(){var aa;aa=[];for(V in U){Y=U[V];if(Y){aa.push(V)}}return aa})())[0];W=W===void 0?"other":W;T=M+"->"+W;M=W;Z="";F+=P[T];Z=((function(){var ab,ac,aa;aa=[];for(S=ab=0,ac=F;0<=ac?ab<ac:ab>ac;S=0<=ac?++ab:--ab){aa.push(" ")}return aa})()).join("");if(T==="opening->closing"){return K=K.substr(0,K.length-1)+X+"\n"}else{return K+=Z+X+"\n"}};for(I=0,O=R.length;I<O;I++){N=R[I];J(N)}return K};C.prototype.showStatus=function(J){var G,N,P,M,H,Q,E,I,L,K,F;if(J.content===void 0){N=J.data;F=J.url}else{N=J.content.data;F=J.request.url}H=J.headers;P=H&&H["Content-Type"]?H["Content-Type"].split(";")[0].trim():null;if(!N){G=$("<code />").text("no content");I=$('<pre class="json" />').append(G)}else{if(P==="application/json"||/\+json$/.test(P)){Q=null;try{Q=JSON.stringify(JSON.parse(N),null," ")}catch(O){M=O;Q="can't parse JSON. Raw result:\n\n"+N}G=$("<code />").text(Q);I=$('<pre class="json" />').append(G)}else{if(P==="application/xml"||/\+xml$/.test(P)){G=$("<code />").text(this.formatXml(N));I=$('<pre class="xml" />').append(G)}else{if(P==="text/html"){G=$("<code />").html(_.escape(N));I=$('<pre class="xml" />').append(G)}else{if(/^image\//.test(P)){I=$("<img>").attr("src",F)}else{G=$("<code />").text(N);I=$('<pre class="json" />').append(G)}}}}}L=I;$(".request_url",$(this.el)).html("<pre></pre>");$(".request_url pre",$(this.el)).text(F);$(".response_code",$(this.el)).html("<pre>"+J.status+"</pre>");$(".response_body",$(this.el)).html(L);$(".response_headers",$(this.el)).html("<pre>"+_.escape(JSON.stringify(J.headers,null," ")).replace(/\n/g,"<br>")+"</pre>");$(".response",$(this.el)).slideDown();$(".response_hider",$(this.el)).show();$(".response_throbber",$(this.el)).hide();K=$(".response_body",$(this.el))[0];E=this.options.swaggerOptions;if(E.highlightSizeThreshold&&J.data.length>E.highlightSizeThreshold){return K}else{return hljs.highlightBlock(K)}};C.prototype.toggleOperationContent=function(){var E;E=$("#"+Docs.escapeResourceName(this.model.parentId)+"_"+this.model.nickname+"_content");if(E.is(":visible")){return Docs.collapseOperation(E)}else{return Docs.expandOperation(E)}};return C})(Backbone.View);r=(function(D){y(C,D);function C(){e=C.__super__.constructor.apply(this,arguments);return e}C.prototype.initialize=function(){};C.prototype.render=function(){var F,E,G;G=this.template();$(this.el).html(G(this.model));if(swaggerUi.api.models.hasOwnProperty(this.model.responseModel)){F={sampleJSON:JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(),null,2),isParam:false,signature:swaggerUi.api.models[this.model.responseModel].getMockSignature()};E=new j({model:F,tagName:"div"});$(".model-signature",this.$el).append(E.render().el)}else{$(".model-signature",this.$el).html("")}return this};C.prototype.template=function(){return Handlebars.templates.status_code};return C})(Backbone.View);m=(function(D){y(C,D);function C(){c=C.__super__.constructor.apply(this,arguments);return c}C.prototype.initialize=function(){return Handlebars.registerHelper("isArray",function(F,E){if(F.type.toLowerCase()==="array"||F.allowMultiple){return E.fn(this)}else{return E.inverse(this)}})};C.prototype.render=function(){var E,F,I,G,J,H,M,N,L,K;K=this.model.type||this.model.dataType;if(typeof K==="undefined"){H=this.model.schema;if(H&&H["$ref"]){G=H["$ref"];if(G.indexOf("#/definitions/")===0){K=G.substring("#/definitions/".length)}else{K=G}}}this.model.type=K;this.model.paramType=this.model["in"]||this.model.paramType;if(this.model.paramType==="body"){this.model.isBody=true}if(K&&K.toLowerCase()==="file"){this.model.isFile=true}this.model["default"]=this.model["default"]||this.model.defaultValue;L=this.template();$(this.el).html(L(this.model));M={sampleJSON:this.model.sampleJSON,isParam:true,signature:this.model.signature};if(this.model.sampleJSON){N=new j({model:M,tagName:"div"});$(".model-signature",$(this.el)).append(N.render().el)}else{$(".model-signature",$(this.el)).html(this.model.signature)}F=false;if(this.model.isBody){F=true}E={isParam:F};E.consumes=this.model.consumes;if(F){I=new n({model:E});$(".parameter-content-type",$(this.el)).append(I.render().el)}else{J=new o({model:E});$(".response-content-type",$(this.el)).append(J.render().el)}return this};C.prototype.template=function(){if(this.model.isList){return Handlebars.templates.param_list}else{if(this.options.readOnly){if(this.model.required){return Handlebars.templates.param_readonly_required}else{return Handlebars.templates.param_readonly}}else{if(this.model.required){return Handlebars.templates.param_required}else{return Handlebars.templates.param}}}};return C})(Backbone.View);j=(function(D){y(C,D);function C(){a=C.__super__.constructor.apply(this,arguments);return a}C.prototype.events={"click a.description-link":"switchToDescription","click a.snippet-link":"switchToSnippet","mousedown .snippet":"snippetToTextArea"};C.prototype.initialize=function(){};C.prototype.render=function(){var E;E=this.template();$(this.el).html(E(this.model));this.switchToSnippet();this.isParam=this.model.isParam;if(this.isParam){$(".notice",$(this.el)).text("Click to set as parameter value")}return this};C.prototype.template=function(){return Handlebars.templates.signature};C.prototype.switchToDescription=function(E){if(E!=null){E.preventDefault()}$(".snippet",$(this.el)).hide();$(".description",$(this.el)).show();$(".description-link",$(this.el)).addClass("selected");return $(".snippet-link",$(this.el)).removeClass("selected")};C.prototype.switchToSnippet=function(E){if(E!=null){E.preventDefault()}$(".description",$(this.el)).hide();$(".snippet",$(this.el)).show();$(".snippet-link",$(this.el)).addClass("selected");return $(".description-link",$(this.el)).removeClass("selected")};C.prototype.snippetToTextArea=function(E){var F;if(this.isParam){if(E!=null){E.preventDefault()}F=$("textarea",$(this.el.parentNode.parentNode.parentNode));if($.trim(F.val())===""){return F.val(this.model.sampleJSON)}}};return C})(Backbone.View);l=(function(C){y(D,C);function D(){A=D.__super__.constructor.apply(this,arguments);return A}D.prototype.initialize=function(){};D.prototype.render=function(){var E;E=this.template();$(this.el).html(E(this.model));$("label[for=contentType]",$(this.el)).text("Response Content Type");return this};D.prototype.template=function(){return Handlebars.templates.content_type};return D})(Backbone.View);o=(function(C){y(D,C);function D(){z=D.__super__.constructor.apply(this,arguments);return z}D.prototype.initialize=function(){};D.prototype.render=function(){var E;E=this.template();$(this.el).html(E(this.model));$("label[for=responseContentType]",$(this.el)).text("Response Content Type");return this};D.prototype.template=function(){return Handlebars.templates.response_content_type};return D})(Backbone.View);n=(function(D){y(C,D);function C(){d=C.__super__.constructor.apply(this,arguments);return d}C.prototype.initialize=function(){};C.prototype.render=function(){var E;E=this.template();$(this.el).html(E(this.model));$("label[for=parameterContentType]",$(this.el)).text("Parameter content type:");return this};C.prototype.template=function(){return Handlebars.templates.parameter_content_type};return C})(Backbone.View);t=(function(D){y(C,D);function C(){b=C.__super__.constructor.apply(this,arguments);return b}C.prototype.initialize=function(){};C.prototype.render=function(){var E;E=this.template();$(this.el).html(E(this.model));return this};C.prototype.events={"click #apikey_button":"toggleApiKeyContainer","click #apply_api_key":"applyApiKey"};C.prototype.applyApiKey=function(){var E;window.authorizations.add(this.model.name,new ApiKeyAuthorization(this.model.name,$("#input_apiKey_entry").val(),this.model["in"]));window.swaggerUi.load();return E=$("#apikey_container").show()};C.prototype.toggleApiKeyContainer=function(){var E;if($("#apikey_container").length>0){E=$("#apikey_container").first();if(E.is(":visible")){return E.hide()}else{$(".auth_container").hide();return E.show()}}};C.prototype.template=function(){return Handlebars.templates.apikey_button_view};return C})(Backbone.View);k=(function(D){y(C,D);function C(){B=C.__super__.constructor.apply(this,arguments);return B}C.prototype.initialize=function(){};C.prototype.render=function(){var E;E=this.template();$(this.el).html(E(this.model));return this};C.prototype.events={"click #basic_auth_button":"togglePasswordContainer","click #apply_basic_auth":"applyPassword"};C.prototype.applyPassword=function(){var F,E,G;console.log("applying password");G=$(".input_username").val();E=$(".input_password").val();window.authorizations.add(this.model.type,new PasswordAuthorization("basic",G,E));window.swaggerUi.load();return F=$("#basic_auth_container").hide()};C.prototype.togglePasswordContainer=function(){var E;if($("#basic_auth_container").length>0){E=$("#basic_auth_container").show();if(E.is(":visible")){return E.slideUp()}else{$(".auth_container").hide();return E.show()}}};C.prototype.template=function(){return Handlebars.templates.basic_auth_button_view};return C})(Backbone.View)}).call(this); |
@@ -79,6 +79,5 @@ 'use strict'; | ||
//I couldnt get this one to work. | ||
/*describe('/pet/findByTags', function(){ | ||
describe('/pet/findByTags', function(){ | ||
it('should return pets', function(done){ | ||
request(endpoint + '/pet/findByTags?tags=1', {json:true}, function(err, res, body){ | ||
request(endpoint + '/pet/findByTags?tags=tag1', {json:true}, function(err, res, body){ | ||
res.statusCode.should.equal(200); | ||
@@ -88,4 +87,4 @@ done(err); | ||
}); | ||
});*/ | ||
}); | ||
}); |
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 too big to display
Sorry, the diff of this file is too big to display
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
814929
51
12910
11
8