mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 03:18:53 +00:00
85 lines
2.8 KiB
JavaScript
85 lines
2.8 KiB
JavaScript
/**
|
|
* @fileoverview AUTOMATICALLY GENERATED service for API.Client.FakeApi.
|
|
* Do not edit this file by hand or your changes will be lost next time it is
|
|
* generated.
|
|
*
|
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end
|
|
* Version: 1.0.0 ' \" =end
|
|
* Generated at: 2016-06-29T22:04:03.401+08:00
|
|
* Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen
|
|
*/
|
|
/**
|
|
* @license Apache 2.0 ' \" =end
|
|
* http://www.apache.org/licenses/LICENSE-2.0.html ' \" =end
|
|
*/
|
|
|
|
goog.provide('API.Client.FakeApi');
|
|
|
|
|
|
/**
|
|
* @constructor
|
|
* @param {!angular.$http} $http
|
|
* @param {!Object} $httpParamSerializer
|
|
* @param {!angular.$injector} $injector
|
|
* @struct
|
|
*/
|
|
API.Client.FakeApi = function($http, $httpParamSerializer, $injector) {
|
|
/** @private {!string} */
|
|
this.basePath_ = $injector.has('FakeApiBasePath') ?
|
|
/** @type {!string} */ ($injector.get('FakeApiBasePath')) :
|
|
'https://petstore.swagger.io ' \" =end/v2 ' \" =end';
|
|
|
|
/** @private {!Object<string, string>} */
|
|
this.defaultHeaders_ = $injector.has('FakeApiDefaultHeaders') ?
|
|
/** @type {!Object<string, string>} */ (
|
|
$injector.get('FakeApiDefaultHeaders')) :
|
|
{};
|
|
|
|
/** @private {!angular.$http} */
|
|
this.http_ = $http;
|
|
|
|
/** @package {!Object} */
|
|
this.httpParamSerializer = $injector.get('$httpParamSerializer');
|
|
}
|
|
API.Client.FakeApi.$inject = ['$http', '$httpParamSerializer', '$injector'];
|
|
|
|
/**
|
|
* To test code injection ' \" =end
|
|
*
|
|
* @param {!string=} opt_testCodeInjectEnd To test code injection ' \" =end
|
|
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
|
|
* @return {!angular.$q.Promise}
|
|
*/
|
|
API.Client.FakeApi.prototype.testCodeInjectEnd = function(opt_testCodeInjectEnd, opt_extraHttpRequestParams) {
|
|
/** @const {string} */
|
|
var path = this.basePath_ + '/fake';
|
|
|
|
/** @type {!Object} */
|
|
var queryParameters = {};
|
|
|
|
/** @type {!Object} */
|
|
var headerParams = angular.extend({}, this.defaultHeaders_);
|
|
/** @type {!Object} */
|
|
var formParams = {};
|
|
|
|
headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
|
|
formParams['test code inject */ ' " =end'] = opt_testCodeInjectEnd;
|
|
|
|
/** @type {!Object} */
|
|
var httpRequestParams = {
|
|
method: 'PUT',
|
|
url: path,
|
|
json: false,
|
|
data: this.httpParamSerializer(formParams),
|
|
params: queryParameters,
|
|
headers: headerParams
|
|
};
|
|
|
|
if (opt_extraHttpRequestParams) {
|
|
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
|
|
}
|
|
|
|
return (/** @type {?} */ (this.http_))(httpRequestParams);
|
|
}
|