This commit is contained in:
Tony Tam 2015-10-20 10:31:42 -07:00
parent 96380bbc83
commit a21f08118e
23 changed files with 283 additions and 262 deletions

View File

@ -217,7 +217,7 @@
<akka-version>2.3.9</akka-version>
<joda-version>1.2</joda-version>
<joda-time-version>2.2</joda-time-version>
<swagger-core-version>1.5.0</swagger-core-version>
<swagger-core-version>1.5.4</swagger-core-version>
<maven-plugin.version>1.0.0</maven-plugin.version>
<junit-version>4.8.1</junit-version>

View File

@ -11,18 +11,18 @@ object PetApi {
/**
*
* Expected answers:
* code 405 : (Validation exception)
* code 404 : (Pet not found)
* code 400 : (Invalid ID supplied)
* code 404 : (Pet not found)
* code 405 : (Validation exception)
*
* @param body Pet object that needs to be added to the store
*/
def updatePet(body: Option[Pet] = None): ApiRequest[Unit] =
ApiRequest[Unit](ApiMethods.PUT, "http://petstore.swagger.io/v2", "/pet", "application/json")
.withBody(body)
.withErrorResponse[Unit](405)
.withErrorResponse[Unit](404)
.withErrorResponse[Unit](400)
.withErrorResponse[Unit](404)
.withErrorResponse[Unit](405)
/**
*
@ -70,9 +70,9 @@ object PetApi {
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
*
* Expected answers:
* code 404 : (Pet not found)
* code 200 : Pet (successful operation)
* code 400 : (Invalid ID supplied)
* code 404 : (Pet not found)
*
* Available security schemes:
* api_key (apiKey)
@ -83,9 +83,9 @@ object PetApi {
ApiRequest[Pet](ApiMethods.GET, "http://petstore.swagger.io/v2", "/pet/{petId}", "application/json")
.withApiKey(apiKey, "api_key", HEADER)
.withPathParam("petId", petId)
.withErrorResponse[Unit](404)
.withSuccessResponse[Pet](200)
.withErrorResponse[Unit](400)
.withErrorResponse[Unit](404)
/**
*

View File

@ -39,33 +39,33 @@ object StoreApi {
* For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
*
* Expected answers:
* code 404 : (Order not found)
* code 200 : Order (successful operation)
* code 400 : (Invalid ID supplied)
* code 404 : (Order not found)
*
* @param orderId ID of pet that needs to be fetched
*/
def getOrderById(orderId: String): ApiRequest[Order] =
ApiRequest[Order](ApiMethods.GET, "http://petstore.swagger.io/v2", "/store/order/{orderId}", "application/json")
.withPathParam("orderId", orderId)
.withErrorResponse[Unit](404)
.withSuccessResponse[Order](200)
.withErrorResponse[Unit](400)
.withErrorResponse[Unit](404)
/**
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
*
* Expected answers:
* code 404 : (Order not found)
* code 400 : (Invalid ID supplied)
* code 404 : (Order not found)
*
* @param orderId ID of the order that needs to be deleted
*/
def deleteOrder(orderId: String): ApiRequest[Unit] =
ApiRequest[Unit](ApiMethods.DELETE, "http://petstore.swagger.io/v2", "/store/order/{orderId}", "application/json")
.withPathParam("orderId", orderId)
.withErrorResponse[Unit](404)
.withErrorResponse[Unit](400)
.withErrorResponse[Unit](404)

View File

@ -72,25 +72,25 @@ object UserApi {
/**
*
* Expected answers:
* code 404 : (User not found)
* code 200 : User (successful operation)
* code 400 : (Invalid username supplied)
* code 404 : (User not found)
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @param username The name that needs to be fetched. Use user1 for testing.
*/
def getUserByName(username: String): ApiRequest[User] =
ApiRequest[User](ApiMethods.GET, "http://petstore.swagger.io/v2", "/user/{username}", "application/json")
.withPathParam("username", username)
.withErrorResponse[Unit](404)
.withSuccessResponse[User](200)
.withErrorResponse[Unit](400)
.withErrorResponse[Unit](404)
/**
* This can only be done by the logged in user.
*
* Expected answers:
* code 404 : (User not found)
* code 400 : (Invalid user supplied)
* code 404 : (User not found)
*
* @param username name that need to be deleted
* @param body Updated user object
@ -99,23 +99,23 @@ object UserApi {
ApiRequest[Unit](ApiMethods.PUT, "http://petstore.swagger.io/v2", "/user/{username}", "application/json")
.withBody(body)
.withPathParam("username", username)
.withErrorResponse[Unit](404)
.withErrorResponse[Unit](400)
.withErrorResponse[Unit](404)
/**
* This can only be done by the logged in user.
*
* Expected answers:
* code 404 : (User not found)
* code 400 : (Invalid username supplied)
* code 404 : (User not found)
*
* @param username The name that needs to be deleted
*/
def deleteUser(username: String): ApiRequest[Unit] =
ApiRequest[Unit](ApiMethods.DELETE, "http://petstore.swagger.io/v2", "/user/{username}", "application/json")
.withPathParam("username", username)
.withErrorResponse[Unit](404)
.withErrorResponse[Unit](400)
.withErrorResponse[Unit](404)

View File

@ -145,7 +145,7 @@
</repository>
</repositories>
<properties>
<swagger-annotations-version>1.5.0</swagger-annotations-version>
<swagger-annotations-version>1.5.4</swagger-annotations-version>
<gson-version>2.3.1</gson-version>
<junit-version>4.8.1</junit-version>
<maven-plugin-version>1.0.0</maven-plugin-version>

View File

@ -316,7 +316,7 @@ public class UserApi {
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @param username The name that needs to be fetched. Use user1 for testing.
* @return User
*/
public User getUserByName (String username) throws ApiException {

View File

@ -18,9 +18,9 @@ public class Pet {
@SerializedName("name")
private String name = null;
@SerializedName("photoUrls")
private List<String> photoUrls = new ArrayList<String>() ;
private List<String> photoUrls = null;
@SerializedName("tags")
private List<Tag> tags = new ArrayList<Tag>() ;
private List<Tag> tags = null;
public enum StatusEnum {
available, pending, sold,
};

View File

@ -145,8 +145,9 @@ class PetApi(client: TransportClient, config: SwaggerConfig) extends ApiClient(c
}
def deletePet(apiKey: Option[String] = None,
petId: Long)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
def deletePet(petId: Long,
apiKey: Option[String] = None
)(implicit reader: ClientResponseReader[Unit]): Future[Unit] = {
// create path and map variables
val path = (addFmt("/pet/{petId}")
replaceAll ("\\{" + "petId" + "\\}",petId.toString))

View File

@ -387,8 +387,8 @@ sub update_pet_with_form {
#
# Deletes a pet
#
# @param string $api_key (optional)
# @param int $pet_id Pet id to delete (required)
# @param string $api_key (optional)
# @return void
#
sub delete_pet {

View File

@ -305,7 +305,7 @@ sub logout_user {
#
# Get user by user name
#
# @param string $username The name that needs to be fetched. Use user1 for testing. (required)
# @param string $username The name that needs to be fetched. Use user1 for testing. (required)
# @return User
#
sub get_user_by_name {

View File

@ -424,9 +424,6 @@ class PetApi
$httpBody = $formParams; // for HTTP post (form)
}
//TODO support oauth
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
if (isset($apiKey)) {
$headerParams['api_key'] = $apiKey;
@ -434,6 +431,9 @@ class PetApi
//TODO support oauth
// make the API Call
try
{

View File

@ -193,7 +193,7 @@ class ObjectSerializer
$deserialized = $values;
} elseif ($class === '\DateTime') {
$deserialized = new \DateTime($data);
} elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) {
} elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) {
settype($data, $class);
$deserialized = $data;
} elseif ($class === '\SplFileObject') {

View File

@ -9,8 +9,8 @@ from .models.order import Order
# import apis into sdk package
from .apis.user_api import UserApi
from .apis.store_api import StoreApi
from .apis.pet_api import PetApi
from .apis.store_api import StoreApi
# import ApiClient
from .api_client import ApiClient

View File

@ -2,5 +2,5 @@ from __future__ import absolute_import
# import apis into api package
from .user_api import UserApi
from .store_api import StoreApi
from .pet_api import PetApi
from .store_api import StoreApi

View File

@ -409,7 +409,7 @@ class PetApi(object):
select_header_content_type([])
# Authentication setting
auth_settings = ['petstore_auth', 'api_key']
auth_settings = ['api_key', 'petstore_auth']
response = self.api_client.call_api(resource_path, method,
path_params,

View File

@ -14,8 +14,8 @@ require 'petstore/models/order'
# APIs
require 'petstore/api/user_api'
require 'petstore/api/store_api'
require 'petstore/api/pet_api'
require 'petstore/api/store_api'
module Petstore
class << self

View File

@ -237,7 +237,7 @@ module Petstore
post_body = nil
auth_names = ['petstore_auth', 'api_key']
auth_names = ['api_key', 'petstore_auth']
result = @api_client.call_api(:GET, path,
:header_params => header_params,
:query_params => query_params,

View File

@ -248,7 +248,7 @@ module Petstore
# Get user by user name
#
# @param username The name that needs to be fetched. Use user1 for testing.
# @param username The name that needs to be fetched. Use user1 for testing.
# @param [Hash] opts the optional parameters
# @return [User]
def get_user_by_name(username, opts = {})

View File

@ -210,7 +210,7 @@
<joda-version>1.2</joda-version>
<joda-time-version>2.2</joda-time-version>
<jersey-version>1.19</jersey-version>
<swagger-core-version>1.5.0</swagger-core-version>
<swagger-core-version>1.5.4</swagger-core-version>
<jersey-async-version>1.0.5</jersey-async-version>
<maven-plugin.version>1.0.0</maven-plugin.version>
<jackson-version>2.4.2</jackson-version>

View File

@ -325,11 +325,11 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
/**
* Deletes a pet
*
* @param apiKey
* @param petId Pet id to delete
* @param apiKey
* @return void
*/
def deletePet (apiKey: String, petId: Long) = {
def deletePet (petId: Long, apiKey: String) = {
// create path and map variables
val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))

View File

@ -263,7 +263,7 @@ class UserApi(val defBasePath: String = "http://petstore.swagger.io/v2",
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @param username The name that needs to be fetched. Use user1 for testing.
* @return User
*/
def getUserByName (username: String) : Option[User] = {

View File

@ -5,5 +5,5 @@
/// <reference path="Order.ts" />
/// <reference path="UserApi.ts" />
/// <reference path="StoreApi.ts" />
/// <reference path="PetApi.ts" />
/// <reference path="StoreApi.ts" />

View File

@ -149,6 +149,7 @@ export class UserApi {
var headerParams: any = {};
var formParams: any = {};
var useFormData = false;
var deferred = promise.defer<{ response: http.ClientResponse; }>();
@ -194,6 +195,7 @@ export class UserApi {
var headerParams: any = {};
var formParams: any = {};
var useFormData = false;
var deferred = promise.defer<{ response: http.ClientResponse; }>();
@ -239,6 +241,7 @@ export class UserApi {
var headerParams: any = {};
var formParams: any = {};
var useFormData = false;
var deferred = promise.defer<{ response: http.ClientResponse; }>();
@ -284,6 +287,7 @@ export class UserApi {
var headerParams: any = {};
var formParams: any = {};
if (username !== undefined) {
queryParameters['username'] = username;
}
@ -336,6 +340,7 @@ export class UserApi {
var headerParams: any = {};
var formParams: any = {};
var useFormData = false;
var deferred = promise.defer<{ response: http.ClientResponse; }>();
@ -382,6 +387,7 @@ export class UserApi {
var headerParams: any = {};
var formParams: any = {};
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling getUserByName');
@ -433,6 +439,7 @@ export class UserApi {
var headerParams: any = {};
var formParams: any = {};
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling updateUser');
@ -485,6 +492,7 @@ export class UserApi {
var headerParams: any = {};
var formParams: any = {};
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling deleteUser');
@ -527,224 +535,6 @@ export class UserApi {
return deferred.promise;
}
}
export class StoreApi {
private basePath = 'http://petstore.swagger.io/v2';
public authentications = {
'default': <Authentication>new VoidAuth(),
'api_key': new ApiKeyAuth('header', 'api_key'),
'petstore_auth': new OAuth(),
}
constructor(url: string, basePath?: string);
constructor(private url: string, basePathOrUsername: string, password?: string, basePath?: string) {
if (password) {
if (basePath) {
this.basePath = basePath;
}
} else {
if (basePathOrUsername) {
this.basePath = basePathOrUsername
}
}
}
set apiKey(key: string) {
this.authentications.api_key.apiKey = key;
}
public getInventory () : Promise<{ response: http.ClientResponse; body: { [key: string]: number; }; }> {
var path = this.url + this.basePath + '/store/inventory';
var queryParameters: any = {};
var headerParams: any = {};
var formParams: any = {};
var useFormData = false;
var deferred = promise.defer<{ response: http.ClientResponse; body: { [key: string]: number; }; }>();
var requestOptions: request.Options = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: path,
json: true,
}
this.authentications.api_key.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
(<any>requestOptions).formData = formParams;
} else {
requestOptions.form = formParams;
}
}
request(requestOptions, (error, response, body) => {
if (error) {
deferred.reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
deferred.resolve({ response: response, body: body });
} else {
deferred.reject({ response: response, body: body });
}
}
});
return deferred.promise;
}
public placeOrder (body?: Order) : Promise<{ response: http.ClientResponse; body: Order; }> {
var path = this.url + this.basePath + '/store/order';
var queryParameters: any = {};
var headerParams: any = {};
var formParams: any = {};
var useFormData = false;
var deferred = promise.defer<{ response: http.ClientResponse; body: Order; }>();
var requestOptions: request.Options = {
method: 'POST',
qs: queryParameters,
headers: headerParams,
uri: path,
json: true,
body: body,
}
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
(<any>requestOptions).formData = formParams;
} else {
requestOptions.form = formParams;
}
}
request(requestOptions, (error, response, body) => {
if (error) {
deferred.reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
deferred.resolve({ response: response, body: body });
} else {
deferred.reject({ response: response, body: body });
}
}
});
return deferred.promise;
}
public getOrderById (orderId: string) : Promise<{ response: http.ClientResponse; body: Order; }> {
var path = this.url + this.basePath + '/store/order/{orderId}';
path = path.replace('{' + 'orderId' + '}', String(orderId));
var queryParameters: any = {};
var headerParams: any = {};
var formParams: any = {};
// verify required parameter 'orderId' is set
if (!orderId) {
throw new Error('Missing required parameter orderId when calling getOrderById');
}
var useFormData = false;
var deferred = promise.defer<{ response: http.ClientResponse; body: Order; }>();
var requestOptions: request.Options = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: path,
json: true,
}
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
(<any>requestOptions).formData = formParams;
} else {
requestOptions.form = formParams;
}
}
request(requestOptions, (error, response, body) => {
if (error) {
deferred.reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
deferred.resolve({ response: response, body: body });
} else {
deferred.reject({ response: response, body: body });
}
}
});
return deferred.promise;
}
public deleteOrder (orderId: string) : Promise<{ response: http.ClientResponse; }> {
var path = this.url + this.basePath + '/store/order/{orderId}';
path = path.replace('{' + 'orderId' + '}', String(orderId));
var queryParameters: any = {};
var headerParams: any = {};
var formParams: any = {};
// verify required parameter 'orderId' is set
if (!orderId) {
throw new Error('Missing required parameter orderId when calling deleteOrder');
}
var useFormData = false;
var deferred = promise.defer<{ response: http.ClientResponse; }>();
var requestOptions: request.Options = {
method: 'DELETE',
qs: queryParameters,
headers: headerParams,
uri: path,
json: true,
}
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
(<any>requestOptions).formData = formParams;
} else {
requestOptions.form = formParams;
}
}
request(requestOptions, (error, response, body) => {
if (error) {
deferred.reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
deferred.resolve({ response: response, body: body });
} else {
deferred.reject({ response: response, body: body });
}
}
});
return deferred.promise;
}
}
export class PetApi {
private basePath = 'http://petstore.swagger.io/v2';
public authentications = {
@ -777,6 +567,7 @@ export class PetApi {
var headerParams: any = {};
var formParams: any = {};
var useFormData = false;
var deferred = promise.defer<{ response: http.ClientResponse; }>();
@ -824,6 +615,7 @@ export class PetApi {
var headerParams: any = {};
var formParams: any = {};
var useFormData = false;
var deferred = promise.defer<{ response: http.ClientResponse; }>();
@ -871,6 +663,7 @@ export class PetApi {
var headerParams: any = {};
var formParams: any = {};
if (status !== undefined) {
queryParameters['status'] = status;
}
@ -921,6 +714,7 @@ export class PetApi {
var headerParams: any = {};
var formParams: any = {};
if (tags !== undefined) {
queryParameters['tags'] = tags;
}
@ -973,6 +767,7 @@ export class PetApi {
var headerParams: any = {};
var formParams: any = {};
// verify required parameter 'petId' is set
if (!petId) {
throw new Error('Missing required parameter petId when calling getPetById');
@ -990,10 +785,10 @@ export class PetApi {
json: true,
}
this.authentications.petstore_auth.applyToRequest(requestOptions);
this.authentications.api_key.applyToRequest(requestOptions);
this.authentications.petstore_auth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
@ -1028,6 +823,7 @@ export class PetApi {
var headerParams: any = {};
var formParams: any = {};
// verify required parameter 'petId' is set
if (!petId) {
throw new Error('Missing required parameter petId when calling updatePetWithForm');
@ -1089,12 +885,13 @@ export class PetApi {
var headerParams: any = {};
var formParams: any = {};
// verify required parameter 'petId' is set
if (!petId) {
throw new Error('Missing required parameter petId when calling deletePet');
}
headerParams['apiKey'] = apiKey;
headerParams['api_key'] = apiKey;
var useFormData = false;
@ -1144,6 +941,7 @@ export class PetApi {
var headerParams: any = {};
var formParams: any = {};
// verify required parameter 'petId' is set
if (!petId) {
throw new Error('Missing required parameter petId when calling uploadFile');
@ -1197,3 +995,225 @@ export class PetApi {
return deferred.promise;
}
}
export class StoreApi {
private basePath = 'http://petstore.swagger.io/v2';
public authentications = {
'default': <Authentication>new VoidAuth(),
'api_key': new ApiKeyAuth('header', 'api_key'),
'petstore_auth': new OAuth(),
}
constructor(url: string, basePath?: string);
constructor(private url: string, basePathOrUsername: string, password?: string, basePath?: string) {
if (password) {
if (basePath) {
this.basePath = basePath;
}
} else {
if (basePathOrUsername) {
this.basePath = basePathOrUsername
}
}
}
set apiKey(key: string) {
this.authentications.api_key.apiKey = key;
}
public getInventory () : Promise<{ response: http.ClientResponse; body: { [key: string]: number; }; }> {
var path = this.url + this.basePath + '/store/inventory';
var queryParameters: any = {};
var headerParams: any = {};
var formParams: any = {};
var useFormData = false;
var deferred = promise.defer<{ response: http.ClientResponse; body: { [key: string]: number; }; }>();
var requestOptions: request.Options = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: path,
json: true,
}
this.authentications.api_key.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
(<any>requestOptions).formData = formParams;
} else {
requestOptions.form = formParams;
}
}
request(requestOptions, (error, response, body) => {
if (error) {
deferred.reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
deferred.resolve({ response: response, body: body });
} else {
deferred.reject({ response: response, body: body });
}
}
});
return deferred.promise;
}
public placeOrder (body?: Order) : Promise<{ response: http.ClientResponse; body: Order; }> {
var path = this.url + this.basePath + '/store/order';
var queryParameters: any = {};
var headerParams: any = {};
var formParams: any = {};
var useFormData = false;
var deferred = promise.defer<{ response: http.ClientResponse; body: Order; }>();
var requestOptions: request.Options = {
method: 'POST',
qs: queryParameters,
headers: headerParams,
uri: path,
json: true,
body: body,
}
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
(<any>requestOptions).formData = formParams;
} else {
requestOptions.form = formParams;
}
}
request(requestOptions, (error, response, body) => {
if (error) {
deferred.reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
deferred.resolve({ response: response, body: body });
} else {
deferred.reject({ response: response, body: body });
}
}
});
return deferred.promise;
}
public getOrderById (orderId: string) : Promise<{ response: http.ClientResponse; body: Order; }> {
var path = this.url + this.basePath + '/store/order/{orderId}';
path = path.replace('{' + 'orderId' + '}', String(orderId));
var queryParameters: any = {};
var headerParams: any = {};
var formParams: any = {};
// verify required parameter 'orderId' is set
if (!orderId) {
throw new Error('Missing required parameter orderId when calling getOrderById');
}
var useFormData = false;
var deferred = promise.defer<{ response: http.ClientResponse; body: Order; }>();
var requestOptions: request.Options = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: path,
json: true,
}
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
(<any>requestOptions).formData = formParams;
} else {
requestOptions.form = formParams;
}
}
request(requestOptions, (error, response, body) => {
if (error) {
deferred.reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
deferred.resolve({ response: response, body: body });
} else {
deferred.reject({ response: response, body: body });
}
}
});
return deferred.promise;
}
public deleteOrder (orderId: string) : Promise<{ response: http.ClientResponse; }> {
var path = this.url + this.basePath + '/store/order/{orderId}';
path = path.replace('{' + 'orderId' + '}', String(orderId));
var queryParameters: any = {};
var headerParams: any = {};
var formParams: any = {};
// verify required parameter 'orderId' is set
if (!orderId) {
throw new Error('Missing required parameter orderId when calling deleteOrder');
}
var useFormData = false;
var deferred = promise.defer<{ response: http.ClientResponse; }>();
var requestOptions: request.Options = {
method: 'DELETE',
qs: queryParameters,
headers: headerParams,
uri: path,
json: true,
}
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
(<any>requestOptions).formData = formParams;
} else {
requestOptions.form = formParams;
}
}
request(requestOptions, (error, response, body) => {
if (error) {
deferred.reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
deferred.resolve({ response: response, body: body });
} else {
deferred.reject({ response: response, body: body });
}
}
});
return deferred.promise;
}
}