@@ -1,8 +1,9 @@ | |||
// swagger-client.js | |||
// version 2.1.0-alpha.5 | |||
/** | |||
* Array Model | |||
**/ | |||
* swagger-client - swagger.js is a javascript client for use with swaggering APIs. | |||
* @version v2.1.0-alpha.5 | |||
* @link http://swagger.io | |||
* @license apache 2.0 | |||
*/ | |||
var ArrayModel = function(definition) { | |||
this.name = "name"; | |||
this.definition = definition || {}; | |||
@@ -57,6 +58,7 @@ ArrayModel.prototype.getMockSignature = function(modelsToIgnore) { | |||
} | |||
}; | |||
/** | |||
* SwaggerAuthorizations applys the correct authorization to an operation being executed | |||
*/ | |||
@@ -157,7 +159,8 @@ PasswordAuthorization.prototype.apply = function(obj, authorizations) { | |||
var base64encoder = this._btoa; | |||
obj.headers["Authorization"] = "Basic " + base64encoder(this.username + ":" + this.password); | |||
return true; | |||
};var __bind = function(fn, me){ | |||
}; | |||
var __bind = function(fn, me){ | |||
return function(){ | |||
return fn.apply(me, arguments); | |||
}; | |||
@@ -238,6 +241,7 @@ Object.keys = Object.keys || (function () { | |||
return result; | |||
}; | |||
})(); | |||
/** | |||
* PrimitiveModel | |||
**/ | |||
@@ -289,7 +293,8 @@ PrimitiveModel.prototype.getMockSignature = function(modelsToIgnore) { | |||
} | |||
} | |||
return returnVal; | |||
};var SwaggerClient = function(url, options) { | |||
}; | |||
var SwaggerClient = function(url, options) { | |||
this.isBuilt = false; | |||
this.url = null; | |||
this.debug = false; | |||
@@ -316,6 +321,7 @@ PrimitiveModel.prototype.getMockSignature = function(modelsToIgnore) { | |||
if (typeof options.useJQuery === 'boolean') | |||
this.useJQuery = options.useJQuery; | |||
this.supportedSubmitMethods = options.supportedSubmitMethods || []; | |||
this.failure = options.failure != null ? options.failure : function() {}; | |||
this.progress = options.progress != null ? options.progress : function() {}; | |||
this.spec = options.spec; | |||
@@ -763,7 +769,7 @@ Operation.prototype.supportHeaderParams = function () { | |||
}; | |||
Operation.prototype.supportedSubmitMethods = function () { | |||
return this.resource.api.supportedSubmitMethods; | |||
return this.parent.supportedSubmitMethods; | |||
}; | |||
Operation.prototype.getHeaderParams = function (args) { | |||
@@ -1111,11 +1117,8 @@ Operation.prototype.encodeQueryCollection = function(type, name, value) { | |||
return encoded; | |||
} | |||
/** | |||
* TODO this encoding needs to be changed | |||
**/ | |||
Operation.prototype.encodeQueryParam = function(arg) { | |||
return escape(arg); | |||
return encodeURIComponent(arg); | |||
} | |||
/** | |||
@@ -1378,6 +1381,7 @@ e.PasswordAuthorization = PasswordAuthorization; | |||
e.CookieAuthorization = CookieAuthorization; | |||
e.SwaggerClient = SwaggerClient; | |||
e.Operation = Operation; | |||
/** | |||
* SwaggerHttp is a wrapper for executing requests | |||
*/ | |||
@@ -1389,6 +1393,10 @@ SwaggerHttp.prototype.execute = function(obj) { | |||
else | |||
this.useJQuery = this.isIE8(); | |||
if(obj && typeof obj.body === 'object') { | |||
obj.body = JSON.stringify(obj.body); | |||
} | |||
if(this.useJQuery) | |||
return new JQueryHttpClient().execute(obj); | |||
else | |||
@@ -1563,7 +1571,8 @@ ShredHttpClient.prototype.execute = function(obj) { | |||
data: response.content.data | |||
}; | |||
var contentType = (response._headers["content-type"]||response._headers["Content-Type"]||null) | |||
var headers = response._headers.normalized || response._headers; | |||
var contentType = (headers["content-type"]||headers["Content-Type"]||null) | |||
if(contentType != null) { | |||
if(contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) { | |||
@@ -271,7 +271,7 @@ function program1(depth0,data) { | |||
stack2 = ((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.description)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1); | |||
if(stack2 || stack2 === 0) { buffer += stack2; } | |||
buffer += "</div>\n "; | |||
stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.termsOfServiceUrl), {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data}); | |||
stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.termsOfService), {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data}); | |||
if(stack2 || stack2 === 0) { buffer += stack2; } | |||
buffer += "\n "; | |||
stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.contact), {hash:{},inverse:self.noop,fn:self.program(4, program4, data),data:data}); | |||
@@ -286,7 +286,7 @@ function program2(depth0,data) { | |||
var buffer = "", stack1; | |||
buffer += "<div class=\"info_tos\"><a href=\"" | |||
+ escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.termsOfServiceUrl)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) | |||
+ escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.termsOfService)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) | |||
+ "\">Terms of service</a></div>"; | |||
return buffer; | |||
} | |||
@@ -1785,7 +1785,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; | |||
OperationView.prototype.render = function() { | |||
var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, o, param, ref, responseContentTypeView, responseSignatureView, schema, schemaObj, signatureModel, statusCode, type, v, value, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref10, _ref11, _ref5, _ref6, _ref7, _ref8, _ref9; | |||
isMethodSubmissionSupported = true; | |||
isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0; | |||
if (!isMethodSubmissionSupported) { | |||
this.model.isReadOnly = true; | |||
} | |||
@@ -1,8 +1,9 @@ | |||
// swagger-client.js | |||
// version 2.1.0-alpha.5 | |||
/** | |||
* Array Model | |||
**/ | |||
* swagger-client - swagger.js is a javascript client for use with swaggering APIs. | |||
* @version v2.1.0-alpha.5 | |||
* @link http://swagger.io | |||
* @license apache 2.0 | |||
*/ | |||
var ArrayModel = function(definition) { | |||
this.name = "name"; | |||
this.definition = definition || {}; | |||
@@ -57,6 +58,7 @@ ArrayModel.prototype.getMockSignature = function(modelsToIgnore) { | |||
} | |||
}; | |||
/** | |||
* SwaggerAuthorizations applys the correct authorization to an operation being executed | |||
*/ | |||
@@ -157,7 +159,8 @@ PasswordAuthorization.prototype.apply = function(obj, authorizations) { | |||
var base64encoder = this._btoa; | |||
obj.headers["Authorization"] = "Basic " + base64encoder(this.username + ":" + this.password); | |||
return true; | |||
};var __bind = function(fn, me){ | |||
}; | |||
var __bind = function(fn, me){ | |||
return function(){ | |||
return fn.apply(me, arguments); | |||
}; | |||
@@ -238,6 +241,7 @@ Object.keys = Object.keys || (function () { | |||
return result; | |||
}; | |||
})(); | |||
/** | |||
* PrimitiveModel | |||
**/ | |||
@@ -289,7 +293,8 @@ PrimitiveModel.prototype.getMockSignature = function(modelsToIgnore) { | |||
} | |||
} | |||
return returnVal; | |||
};var SwaggerClient = function(url, options) { | |||
}; | |||
var SwaggerClient = function(url, options) { | |||
this.isBuilt = false; | |||
this.url = null; | |||
this.debug = false; | |||
@@ -316,6 +321,7 @@ PrimitiveModel.prototype.getMockSignature = function(modelsToIgnore) { | |||
if (typeof options.useJQuery === 'boolean') | |||
this.useJQuery = options.useJQuery; | |||
this.supportedSubmitMethods = options.supportedSubmitMethods || []; | |||
this.failure = options.failure != null ? options.failure : function() {}; | |||
this.progress = options.progress != null ? options.progress : function() {}; | |||
this.spec = options.spec; | |||
@@ -763,7 +769,7 @@ Operation.prototype.supportHeaderParams = function () { | |||
}; | |||
Operation.prototype.supportedSubmitMethods = function () { | |||
return this.resource.api.supportedSubmitMethods; | |||
return this.parent.supportedSubmitMethods; | |||
}; | |||
Operation.prototype.getHeaderParams = function (args) { | |||
@@ -1111,11 +1117,8 @@ Operation.prototype.encodeQueryCollection = function(type, name, value) { | |||
return encoded; | |||
} | |||
/** | |||
* TODO this encoding needs to be changed | |||
**/ | |||
Operation.prototype.encodeQueryParam = function(arg) { | |||
return escape(arg); | |||
return encodeURIComponent(arg); | |||
} | |||
/** | |||
@@ -1378,6 +1381,7 @@ e.PasswordAuthorization = PasswordAuthorization; | |||
e.CookieAuthorization = CookieAuthorization; | |||
e.SwaggerClient = SwaggerClient; | |||
e.Operation = Operation; | |||
/** | |||
* SwaggerHttp is a wrapper for executing requests | |||
*/ | |||
@@ -1389,6 +1393,10 @@ SwaggerHttp.prototype.execute = function(obj) { | |||
else | |||
this.useJQuery = this.isIE8(); | |||
if(obj && typeof obj.body === 'object') { | |||
obj.body = JSON.stringify(obj.body); | |||
} | |||
if(this.useJQuery) | |||
return new JQueryHttpClient().execute(obj); | |||
else | |||
@@ -1563,7 +1571,8 @@ ShredHttpClient.prototype.execute = function(obj) { | |||
data: response.content.data | |||
}; | |||
var contentType = (response._headers["content-type"]||response._headers["Content-Type"]||null) | |||
var headers = response._headers.normalized || response._headers; | |||
var contentType = (headers["content-type"]||headers["Content-Type"]||null) | |||
if(contentType != null) { | |||
if(contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) { | |||