From 7e63226ed47080e9c5803169d22b2ab94e5e7d72 Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 3 Mar 2016 20:19:37 +0800 Subject: [PATCH] update wording for test file, minor tweats to petstore test --- .../main/resources/csharp/api_test.mustache | 7 + .../main/resources/csharp/model_test.mustache | 7 + .../src/main/resources/perl/api_test.mustache | 4 +- .../main/resources/perl/object_test.mustache | 3 + .../src/main/resources/php/api_test.mustache | 2 +- .../main/resources/php/model_test.mustache | 2 +- .../Lib/SwaggerClient.Test/CategoryTests.cs | 7 + .../Lib/SwaggerClient.Test/OrderTests.cs | 7 + .../Lib/SwaggerClient.Test/PetApiTests.cs | 20 ++ .../Lib/SwaggerClient.Test/PetTests.cs | 7 + .../Lib/SwaggerClient.Test/StoreApiTests.cs | 19 ++ .../Lib/SwaggerClient.Test/TagTests.cs | 7 + .../Lib/SwaggerClient.Test/UserApiTests.cs | 7 + .../Lib/SwaggerClient.Test/UserTests.cs | 7 + .../src/main/csharp/IO/Swagger/Api/PetApi.cs | 230 ++++++++++++++++++ .../main/csharp/IO/Swagger/Api/StoreApi.cs | 199 +++++++++++++++ .../IO/Swagger/Model/InlineResponse200.cs | 157 ++++++++++++ .../SwaggerClientTest.csproj | 1 + .../SwaggerClientTest.userprefs | 5 +- samples/client/petstore/perl/README.md | 2 +- .../perl/lib/WWW/SwaggerClient/PetApi.pm | 79 +++++- .../perl/lib/WWW/SwaggerClient/Role.pm | 4 +- .../perl/lib/WWW/SwaggerClient/StoreApi.pm | 127 ++++++++++ samples/client/petstore/perl/t/PetApiTest.t | 8 + samples/client/petstore/perl/t/StoreApiTest.t | 15 ++ samples/client/petstore/perl/tests/04_role.t | 2 +- .../php/SwaggerClient-php/lib/Api/PetApi.php | 107 ++++++++ .../SwaggerClient-php/lib/Api/StoreApi.php | 88 +++++++ .../lib/Tests/CategoryTest.php | 2 +- .../SwaggerClient-php/lib/Tests/OrderTest.php | 2 +- .../lib/Tests/PetApiTest.php | 12 +- .../SwaggerClient-php/lib/Tests/PetTest.php | 2 +- .../lib/Tests/StoreApiTest.php | 12 +- .../SwaggerClient-php/lib/Tests/TagTest.php | 2 +- .../lib/Tests/UserApiTest.php | 2 +- .../SwaggerClient-php/lib/Tests/UserTest.php | 2 +- 36 files changed, 1146 insertions(+), 20 deletions(-) create mode 100644 samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs diff --git a/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache b/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache index 2e638711b0f..d44ebca31b5 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache @@ -14,6 +14,13 @@ using {{packageName}}.Api; namespace {{packageName}}.Test { + /// + /// Class for testing {{classname}} + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the API endpoint. + /// [TestFixture] public class {{classname}}Tests { diff --git a/modules/swagger-codegen/src/main/resources/csharp/model_test.mustache b/modules/swagger-codegen/src/main/resources/csharp/model_test.mustache index 5b70f3ebf80..c2e8d948050 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/model_test.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/model_test.mustache @@ -13,6 +13,13 @@ using System.Reflection; {{#model}} namespace {{packageName}}.Test { + /// + /// Class for testing {{classname}} + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// [TestFixture] public class {{classname}}Tests { diff --git a/modules/swagger-codegen/src/main/resources/perl/api_test.mustache b/modules/swagger-codegen/src/main/resources/perl/api_test.mustache index 2bab3f8aa86..98d1e9cce99 100644 --- a/modules/swagger-codegen/src/main/resources/perl/api_test.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/api_test.mustache @@ -14,8 +14,8 @@ # limitations under the License. # # -# NOTE: This class is auto generated by the swagger code generator program. -# Do not edit the class manually. +# NOTE: This class is auto generated by Swagger Codegen +# Please update the test case below to test the API endpoints. # use Test::More tests => 1; #TODO update number of test cases use Test::Exception; diff --git a/modules/swagger-codegen/src/main/resources/perl/object_test.mustache b/modules/swagger-codegen/src/main/resources/perl/object_test.mustache index acefaf569d6..dd76f9ac2d7 100644 --- a/modules/swagger-codegen/src/main/resources/perl/object_test.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/object_test.mustache @@ -1,3 +1,6 @@ +# NOTE: This class is auto generated by the Swagger Codegen +# Please update the test case below to test the model. + use Test::More tests => 2; use Test::Exception; diff --git a/modules/swagger-codegen/src/main/resources/php/api_test.mustache b/modules/swagger-codegen/src/main/resources/php/api_test.mustache index ee26ec31ff2..fc07d338301 100644 --- a/modules/swagger-codegen/src/main/resources/php/api_test.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api_test.mustache @@ -28,7 +28,7 @@ /** * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. + * Please update the test case below to test the endpoint. */ namespace {{apiPackage}}; diff --git a/modules/swagger-codegen/src/main/resources/php/model_test.mustache b/modules/swagger-codegen/src/main/resources/php/model_test.mustache index 086db341a32..0d615eca102 100644 --- a/modules/swagger-codegen/src/main/resources/php/model_test.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model_test.mustache @@ -30,7 +30,7 @@ /** * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. + * Please update the test case below to test the model. */ namespace {{modelPackage}}; diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/CategoryTests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/CategoryTests.cs index 6384ee4179b..e0216f3fb0f 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/CategoryTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/CategoryTests.cs @@ -11,6 +11,13 @@ using System.Reflection; namespace IO.Swagger.Test { + /// + /// Class for testing Category + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// [TestFixture] public class CategoryTests { diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/OrderTests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/OrderTests.cs index 7d0bc854cef..b9540112766 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/OrderTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/OrderTests.cs @@ -11,6 +11,13 @@ using System.Reflection; namespace IO.Swagger.Test { + /// + /// Class for testing Order + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// [TestFixture] public class OrderTests { diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetApiTests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetApiTests.cs index 7e3566eb04b..77100e04b61 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetApiTests.cs @@ -13,6 +13,13 @@ using IO.Swagger.Model; namespace IO.Swagger.Test { + /// + /// Class for testing PetApi + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the API endpoint. + /// [TestFixture] public class PetApiTests { @@ -155,6 +162,19 @@ namespace IO.Swagger.Test } + /// + /// Test GetPetByIdInObject + /// + [Test] + public void GetPetByIdInObjectTest() + { + // TODO: add unit test for the method 'GetPetByIdInObject' + long? petId = null; // TODO: replace null with proper value + + var response = instance.GetPetByIdInObject(petId); + Assert.IsInstanceOf (response, "response is InlineResponse200"); + } + /// /// Test PetPetIdtestingByteArraytrueGet /// diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetTests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetTests.cs index 6b203dbd125..ebbf7476264 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetTests.cs @@ -11,6 +11,13 @@ using System.Reflection; namespace IO.Swagger.Test { + /// + /// Class for testing Pet + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// [TestFixture] public class PetTests { diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/StoreApiTests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/StoreApiTests.cs index b0eb6293380..0b9acfec5e9 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/StoreApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/StoreApiTests.cs @@ -13,6 +13,13 @@ using IO.Swagger.Model; namespace IO.Swagger.Test { + /// + /// Class for testing StoreApi + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the API endpoint. + /// [TestFixture] public class StoreApiTests { @@ -71,6 +78,18 @@ namespace IO.Swagger.Test Assert.IsInstanceOf> (response, "response is Dictionary"); } + /// + /// Test GetInventoryInObject + /// + [Test] + public void GetInventoryInObjectTest() + { + // TODO: add unit test for the method 'GetInventoryInObject' + + var response = instance.GetInventoryInObject(); + Assert.IsInstanceOf (response, "response is Object"); + } + /// /// Test PlaceOrder /// diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/TagTests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/TagTests.cs index ad772584cc5..36ca5b5c0c9 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/TagTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/TagTests.cs @@ -11,6 +11,13 @@ using System.Reflection; namespace IO.Swagger.Test { + /// + /// Class for testing Tag + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// [TestFixture] public class TagTests { diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/UserApiTests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/UserApiTests.cs index 0d543c384aa..8764a7773e7 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/UserApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/UserApiTests.cs @@ -13,6 +13,13 @@ using IO.Swagger.Model; namespace IO.Swagger.Test { + /// + /// Class for testing UserApi + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the API endpoint. + /// [TestFixture] public class UserApiTests { diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/UserTests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/UserTests.cs index 4610313b734..645a4a9c69c 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/UserTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/UserTests.cs @@ -11,6 +11,13 @@ using System.Reflection; namespace IO.Swagger.Test { + /// + /// Class for testing User + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// [TestFixture] public class UserTests { diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs index a141c57f79f..8471bd2141b 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs @@ -203,6 +203,28 @@ namespace IO.Swagger.Api /// ApiResponse of Object(void) ApiResponse UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, Stream file = null); + /// + /// Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + /// + /// + /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// InlineResponse200 + InlineResponse200 GetPetByIdInObject (long? petId); + + /// + /// Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + /// + /// + /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// ApiResponse of InlineResponse200 + ApiResponse GetPetByIdInObjectWithHttpInfo (long? petId); + /// /// Fake endpoint to test byte array return by 'Find pet by ID' /// @@ -437,6 +459,28 @@ namespace IO.Swagger.Api /// Task of ApiResponse System.Threading.Tasks.Task> UploadFileAsyncWithHttpInfo (long? petId, string additionalMetadata = null, Stream file = null); + /// + /// Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + /// + /// + /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Task of InlineResponse200 + System.Threading.Tasks.Task GetPetByIdInObjectAsync (long? petId); + + /// + /// Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + /// + /// + /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Task of ApiResponse (InlineResponse200) + System.Threading.Tasks.Task> GetPetByIdInObjectAsyncWithHttpInfo (long? petId); + /// /// Fake endpoint to test byte array return by 'Find pet by ID' /// @@ -1978,6 +2022,192 @@ namespace IO.Swagger.Api null); } + /// + /// Fake endpoint to test inline arbitrary object return by 'Find pet by ID' Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// InlineResponse200 + public InlineResponse200 GetPetByIdInObject (long? petId) + { + ApiResponse localVarResponse = GetPetByIdInObjectWithHttpInfo(petId); + return localVarResponse.Data; + } + + /// + /// Fake endpoint to test inline arbitrary object return by 'Find pet by ID' Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// ApiResponse of InlineResponse200 + public ApiResponse< InlineResponse200 > GetPetByIdInObjectWithHttpInfo (long? petId) + { + + // verify the required parameter 'petId' is set + if (petId == null) + throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->GetPetByIdInObject"); + + + var localVarPath = "/pet/{petId}?response=inline_arbitrary_object"; + + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json", "application/xml" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add("format", "json"); + if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter + + + + + + + // authentication (api_key) required + + if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); + } + // authentication (petstore_auth) required + + // oauth required + if (!String.IsNullOrEmpty(Configuration.AccessToken)) + { + localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (localVarStatusCode >= 400) + throw new ApiException (localVarStatusCode, "Error calling GetPetByIdInObject: " + localVarResponse.Content, localVarResponse.Content); + else if (localVarStatusCode == 0) + throw new ApiException (localVarStatusCode, "Error calling GetPetByIdInObject: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (InlineResponse200) Configuration.ApiClient.Deserialize(localVarResponse, typeof(InlineResponse200))); + + } + + + /// + /// Fake endpoint to test inline arbitrary object return by 'Find pet by ID' Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Task of InlineResponse200 + public async System.Threading.Tasks.Task GetPetByIdInObjectAsync (long? petId) + { + ApiResponse localVarResponse = await GetPetByIdInObjectAsyncWithHttpInfo(petId); + return localVarResponse.Data; + + } + + /// + /// Fake endpoint to test inline arbitrary object return by 'Find pet by ID' Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Task of ApiResponse (InlineResponse200) + public async System.Threading.Tasks.Task> GetPetByIdInObjectAsyncWithHttpInfo (long? petId) + { + // verify the required parameter 'petId' is set + if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling GetPetByIdInObject"); + + + var localVarPath = "/pet/{petId}?response=inline_arbitrary_object"; + + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json", "application/xml" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add("format", "json"); + if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter + + + + + + + + // authentication (api_key) required + + if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); + } + + // authentication (petstore_auth) required + + // oauth required + if (!String.IsNullOrEmpty(Configuration.AccessToken)) + { + localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (localVarStatusCode >= 400) + throw new ApiException (localVarStatusCode, "Error calling GetPetByIdInObject: " + localVarResponse.Content, localVarResponse.Content); + else if (localVarStatusCode == 0) + throw new ApiException (localVarStatusCode, "Error calling GetPetByIdInObject: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (InlineResponse200) Configuration.ApiClient.Deserialize(localVarResponse, typeof(InlineResponse200))); + + } + /// /// Fake endpoint to test byte array return by 'Find pet by ID' Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions /// diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs index e7da7994614..4000f9b754c 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs @@ -59,6 +59,26 @@ namespace IO.Swagger.Api /// ApiResponse of Dictionary<string, int?> ApiResponse> GetInventoryWithHttpInfo (); + /// + /// Fake endpoint to test arbitrary object return by 'Get inventory' + /// + /// + /// Returns an arbitrary object which is actually a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Object + Object GetInventoryInObject (); + + /// + /// Fake endpoint to test arbitrary object return by 'Get inventory' + /// + /// + /// Returns an arbitrary object which is actually a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// ApiResponse of Object + ApiResponse GetInventoryInObjectWithHttpInfo (); + /// /// Place an order for a pet /// @@ -171,6 +191,26 @@ namespace IO.Swagger.Api /// Task of ApiResponse (Dictionary<string, int?>) System.Threading.Tasks.Task>> GetInventoryAsyncWithHttpInfo (); + /// + /// Fake endpoint to test arbitrary object return by 'Get inventory' + /// + /// + /// Returns an arbitrary object which is actually a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Task of Object + System.Threading.Tasks.Task GetInventoryInObjectAsync (); + + /// + /// Fake endpoint to test arbitrary object return by 'Get inventory' + /// + /// + /// Returns an arbitrary object which is actually a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> GetInventoryInObjectAsyncWithHttpInfo (); + /// /// Place an order for a pet /// @@ -654,6 +694,165 @@ namespace IO.Swagger.Api } + /// + /// Fake endpoint to test arbitrary object return by 'Get inventory' Returns an arbitrary object which is actually a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Object + public Object GetInventoryInObject () + { + ApiResponse localVarResponse = GetInventoryInObjectWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Fake endpoint to test arbitrary object return by 'Get inventory' Returns an arbitrary object which is actually a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// ApiResponse of Object + public ApiResponse< Object > GetInventoryInObjectWithHttpInfo () + { + + + var localVarPath = "/store/inventory?response=arbitrary_object"; + + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json", "application/xml" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add("format", "json"); + + + + + + + // authentication (api_key) required + + if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (localVarStatusCode >= 400) + throw new ApiException (localVarStatusCode, "Error calling GetInventoryInObject: " + localVarResponse.Content, localVarResponse.Content); + else if (localVarStatusCode == 0) + throw new ApiException (localVarStatusCode, "Error calling GetInventoryInObject: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (Object) Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))); + + } + + + /// + /// Fake endpoint to test arbitrary object return by 'Get inventory' Returns an arbitrary object which is actually a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Task of Object + public async System.Threading.Tasks.Task GetInventoryInObjectAsync () + { + ApiResponse localVarResponse = await GetInventoryInObjectAsyncWithHttpInfo(); + return localVarResponse.Data; + + } + + /// + /// Fake endpoint to test arbitrary object return by 'Get inventory' Returns an arbitrary object which is actually a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> GetInventoryInObjectAsyncWithHttpInfo () + { + + + var localVarPath = "/store/inventory?response=arbitrary_object"; + + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json", "application/xml" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add("format", "json"); + + + + + + + + // authentication (api_key) required + + if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (localVarStatusCode >= 400) + throw new ApiException (localVarStatusCode, "Error calling GetInventoryInObject: " + localVarResponse.Content, localVarResponse.Content); + else if (localVarStatusCode == 0) + throw new ApiException (localVarStatusCode, "Error calling GetInventoryInObject: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (Object) Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))); + + } + /// /// Place an order for a pet /// diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs new file mode 100644 index 00000000000..0d5c695c5a0 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/InlineResponse200.cs @@ -0,0 +1,157 @@ +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +namespace IO.Swagger.Model +{ + + /// + /// + /// + [DataContract] + public partial class InlineResponse200 : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// Id (required). + /// Category. + /// Name. + + public InlineResponse200(long? Id = null, Object Category = null, string Name = null) + { + // to ensure "Id" is required (not null) + if (Id == null) + { + throw new InvalidDataException("Id is a required property for InlineResponse200 and cannot be null"); + } + else + { + this.Id = Id; + } + this.Category = Category; + this.Name = Name; + + } + + + /// + /// Gets or Sets Id + /// + [DataMember(Name="id", EmitDefaultValue=false)] + public long? Id { get; set; } + + + /// + /// Gets or Sets Category + /// + [DataMember(Name="category", EmitDefaultValue=false)] + public Object Category { get; set; } + + + /// + /// Gets or Sets Name + /// + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { get; set; } + + + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class InlineResponse200 {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Category: ").Append(Category).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as InlineResponse200); + } + + /// + /// Returns true if InlineResponse200 instances are equal + /// + /// Instance of InlineResponse200 to be compared + /// Boolean + public bool Equals(InlineResponse200 other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.Id == other.Id || + this.Id != null && + this.Id.Equals(other.Id) + ) && + ( + this.Category == other.Category || + this.Category != null && + this.Category.Equals(other.Category) + ) && + ( + this.Name == other.Name || + this.Name != null && + this.Name.Equals(other.Name) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + + if (this.Id != null) + hash = hash * 59 + this.Id.GetHashCode(); + + if (this.Category != null) + hash = hash * 59 + this.Category.GetHashCode(); + + if (this.Name != null) + hash = hash * 59 + this.Name.GetHashCode(); + + return hash; + } + } + + } +} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj index 0b5c3d9a952..bb10c94d339 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj @@ -59,6 +59,7 @@ + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs index 23716351001..3109fc361b3 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs @@ -1,9 +1,10 @@  - + - + + diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index 3db24ccc3d1..aec4a513ef5 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -8,7 +8,7 @@ WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore Automatically generated by the Perl Swagger Codegen project: -- Build date: 2016-02-27T21:43:00.005+08:00 +- Build date: 2016-03-03T20:09:18.907+08:00 - Build package: class io.swagger.codegen.languages.PerlClientCodegen - Codegen version: diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/PetApi.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/PetApi.pm index 1ea4bd68af8..ae57afa1ead 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/PetApi.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/PetApi.pm @@ -186,12 +186,12 @@ sub add_pet { # # Finds Pets by status # -# @param ARRAY[string] $status Status values that need to be considered for filter (optional) +# @param ARRAY[string] $status Status values that need to be considered for query (optional) { my $params = { 'status' => { data_type => 'ARRAY[string]', - description => 'Status values that need to be considered for filter', + description => 'Status values that need to be considered for query', required => '0', }, }; @@ -662,6 +662,81 @@ sub upload_file { } +# +# get_pet_by_id_in_object +# +# Fake endpoint to test inline arbitrary object return by 'Find pet by ID' +# +# @param int $pet_id ID of pet that needs to be fetched (required) +{ + my $params = { + 'pet_id' => { + data_type => 'int', + description => 'ID of pet that needs to be fetched', + required => '1', + }, + }; + __PACKAGE__->method_documentation->{ get_pet_by_id_in_object } = { + summary => 'Fake endpoint to test inline arbitrary object return by 'Find pet by ID'', + params => $params, + returns => 'InlineResponse200', + }; +} +# @return InlineResponse200 +# +sub get_pet_by_id_in_object { + my ($self, %args) = @_; + + + # verify the required parameter 'pet_id' is set + unless (exists $args{'pet_id'}) { + croak("Missing the required parameter 'pet_id' when calling get_pet_by_id_in_object"); + } + + + # parse inputs + my $_resource_path = '/pet/{petId}?response=inline_arbitrary_object'; + $_resource_path =~ s/{format}/json/; # default format to json + + my $_method = 'GET'; + my $query_params = {}; + my $header_params = {}; + my $form_params = {}; + + # 'Accept' and 'Content-Type' header + my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + if ($_header_accept) { + $header_params->{'Accept'} = $_header_accept; + } + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + + + + # path params + if ( exists $args{'pet_id'}) { + my $_base_variable = "{" . "petId" . "}"; + my $_base_value = $self->{api_client}->to_path_value($args{'pet_id'}); + $_resource_path =~ s/$_base_variable/$_base_value/g; + } + + my $_body_data; + + + # authentication setting, if any + my $auth_settings = [qw(api_key petstore_auth )]; + + # make the API Call + my $response = $self->{api_client}->call_api($_resource_path, $_method, + $query_params, $form_params, + $header_params, $_body_data, $auth_settings); + if (!$response) { + return; + } + my $_response_object = $self->{api_client}->deserialize('InlineResponse200', $response); + return $_response_object; + +} + # # pet_pet_idtesting_byte_arraytrue_get # diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm index 2f7f75a5389..033ba9a0dc5 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm @@ -37,7 +37,7 @@ has version_info => ( is => 'ro', default => sub { { app_name => 'Swagger Petstore', app_version => '1.0.0', - generated_date => '2016-02-27T21:43:00.005+08:00', + generated_date => '2016-03-03T20:09:18.907+08:00', generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen', } }, documentation => 'Information about the application version and the codegen codebase version' @@ -103,7 +103,7 @@ Automatically generated by the Perl Swagger Codegen project: =over 4 -=item Build date: 2016-02-27T21:43:00.005+08:00 +=item Build date: 2016-03-03T20:09:18.907+08:00 =item Build package: class io.swagger.codegen.languages.PerlClientCodegen diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/StoreApi.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/StoreApi.pm index a2c37435ee9..fe001897754 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/StoreApi.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/StoreApi.pm @@ -51,6 +51,74 @@ sub new { } +# +# find_orders_by_status +# +# Finds orders by status +# +# @param string $status Status value that needs to be considered for query (optional) +{ + my $params = { + 'status' => { + data_type => 'string', + description => 'Status value that needs to be considered for query', + required => '0', + }, + }; + __PACKAGE__->method_documentation->{ find_orders_by_status } = { + summary => 'Finds orders by status', + params => $params, + returns => 'ARRAY[Order]', + }; +} +# @return ARRAY[Order] +# +sub find_orders_by_status { + my ($self, %args) = @_; + + + + # parse inputs + my $_resource_path = '/store/findByStatus'; + $_resource_path =~ s/{format}/json/; # default format to json + + my $_method = 'GET'; + my $query_params = {}; + my $header_params = {}; + my $form_params = {}; + + # 'Accept' and 'Content-Type' header + my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + if ($_header_accept) { + $header_params->{'Accept'} = $_header_accept; + } + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + + # query params + if ( exists $args{'status'}) { + $query_params->{'status'} = $self->{api_client}->to_query_value($args{'status'}); + } + + + + my $_body_data; + + + # authentication setting, if any + my $auth_settings = [qw(test_api_client_id test_api_client_secret )]; + + # make the API Call + my $response = $self->{api_client}->call_api($_resource_path, $_method, + $query_params, $form_params, + $header_params, $_body_data, $auth_settings); + if (!$response) { + return; + } + my $_response_object = $self->{api_client}->deserialize('ARRAY[Order]', $response); + return $_response_object; + +} + # # get_inventory # @@ -110,6 +178,65 @@ sub get_inventory { } +# +# get_inventory_in_object +# +# Fake endpoint to test arbitrary object return by 'Get inventory' +# +{ + my $params = { + }; + __PACKAGE__->method_documentation->{ get_inventory_in_object } = { + summary => 'Fake endpoint to test arbitrary object return by 'Get inventory'', + params => $params, + returns => 'object', + }; +} +# @return object +# +sub get_inventory_in_object { + my ($self, %args) = @_; + + + + # parse inputs + my $_resource_path = '/store/inventory?response=arbitrary_object'; + $_resource_path =~ s/{format}/json/; # default format to json + + my $_method = 'GET'; + my $query_params = {}; + my $header_params = {}; + my $form_params = {}; + + # 'Accept' and 'Content-Type' header + my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + if ($_header_accept) { + $header_params->{'Accept'} = $_header_accept; + } + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + + + + + + my $_body_data; + + + # authentication setting, if any + my $auth_settings = [qw(api_key )]; + + # make the API Call + my $response = $self->{api_client}->call_api($_resource_path, $_method, + $query_params, $form_params, + $header_params, $_body_data, $auth_settings); + if (!$response) { + return; + } + my $_response_object = $self->{api_client}->deserialize('object', $response); + return $_response_object; + +} + # # place_order # diff --git a/samples/client/petstore/perl/t/PetApiTest.t b/samples/client/petstore/perl/t/PetApiTest.t index 58bf2842f24..52211d2e95f 100644 --- a/samples/client/petstore/perl/t/PetApiTest.t +++ b/samples/client/petstore/perl/t/PetApiTest.t @@ -98,6 +98,14 @@ isa_ok($api, 'WWW::SwaggerClient::PetApi'); my $result = $api->upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file); } +# +# get_pet_by_id_in_object test +# +{ + my $pet_id = undef; # replace NULL with a proper value + my $result = $api->get_pet_by_id_in_object(pet_id => $pet_id); +} + # # pet_pet_idtesting_byte_arraytrue_get test # diff --git a/samples/client/petstore/perl/t/StoreApiTest.t b/samples/client/petstore/perl/t/StoreApiTest.t index fa41c8e7a87..49257eaf3cd 100644 --- a/samples/client/petstore/perl/t/StoreApiTest.t +++ b/samples/client/petstore/perl/t/StoreApiTest.t @@ -29,6 +29,14 @@ use_ok('WWW::SwaggerClient::StoreApi'); my $api = WWW::SwaggerClient::StoreApi->new(); isa_ok($api, 'WWW::SwaggerClient::StoreApi'); +# +# find_orders_by_status test +# +{ + my $status = undef; # replace NULL with a proper value + my $result = $api->find_orders_by_status(status => $status); +} + # # get_inventory test # @@ -36,6 +44,13 @@ isa_ok($api, 'WWW::SwaggerClient::StoreApi'); my $result = $api->get_inventory(); } +# +# get_inventory_in_object test +# +{ + my $result = $api->get_inventory_in_object(); +} + # # place_order test # diff --git a/samples/client/petstore/perl/tests/04_role.t b/samples/client/petstore/perl/tests/04_role.t index 42abf5b4f41..8836c35546c 100644 --- a/samples/client/petstore/perl/tests/04_role.t +++ b/samples/client/petstore/perl/tests/04_role.t @@ -50,7 +50,7 @@ is $get_pet->tags->[0]->id, '11', 'stored and retrieved: got the proper tag id'; # API method docs is_deeply( [sort keys %{$api->pet_api->method_documentation}], - [ 'add_pet', 'add_pet_using_byte_array', 'delete_pet', 'find_pets_by_status', 'find_pets_by_tags', 'get_pet_by_id', 'pet_pet_idtesting_byte_arraytrue_get', 'update_pet', 'update_pet_with_form', 'upload_file'], + [ 'add_pet', 'add_pet_using_byte_array', 'delete_pet', 'find_pets_by_status', 'find_pets_by_tags', 'get_pet_by_id', 'get_pet_by_id_in_object', 'pet_pet_idtesting_byte_arraytrue_get', 'update_pet', 'update_pet_with_form', 'upload_file'], "Pet API method_documentation has the correct keys"); is $api->pet_api->method_documentation->{get_pet_by_id}->{params}->{pet_id}->{description}, 'ID of pet that needs to be fetched', 'get_pet_by_id parameter pet_id description is correct'; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php index c83eec73104..f82bf6f3129 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -878,6 +878,113 @@ class PetApi } } + /** + * getPetByIdInObject + * + * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + * + * @param int $pet_id ID of pet that needs to be fetched (required) + * @return \Swagger\Client\Model\InlineResponse200 + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function getPetByIdInObject($pet_id) + { + list($response, $statusCode, $httpHeader) = $this->getPetByIdInObjectWithHttpInfo ($pet_id); + return $response; + } + + + /** + * getPetByIdInObjectWithHttpInfo + * + * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + * + * @param int $pet_id ID of pet that needs to be fetched (required) + * @return Array of \Swagger\Client\Model\InlineResponse200, HTTP status code, HTTP response headers (array of strings) + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function getPetByIdInObjectWithHttpInfo($pet_id) + { + + // verify the required parameter 'pet_id' is set + if ($pet_id === null) { + throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling getPetByIdInObject'); + } + + // parse inputs + $resourcePath = "/pet/{petId}?response=inline_arbitrary_object"; + $httpBody = ''; + $queryParams = array(); + $headerParams = array(); + $formParams = array(); + $_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml')); + if (!is_null($_header_accept)) { + $headerParams['Accept'] = $_header_accept; + } + $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array()); + + + + // path params + + if ($pet_id !== null) { + $resourcePath = str_replace( + "{" . "petId" . "}", + $this->apiClient->getSerializer()->toPathValue($pet_id), + $resourcePath + ); + } + // default format to json + $resourcePath = str_replace("{format}", "json", $resourcePath); + + + + + // for model (json/xml) + if (isset($_tempBody)) { + $httpBody = $_tempBody; // $_tempBody is the method argument, if present + } elseif (count($formParams) > 0) { + $httpBody = $formParams; // for HTTP post (form) + } + + // this endpoint requires API key authentication + $apiKey = $this->apiClient->getApiKeyWithPrefix('api_key'); + if (strlen($apiKey) !== 0) { + $headerParams['api_key'] = $apiKey; + } + + + // this endpoint requires OAuth (access token) + if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) { + $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken(); + } + + // make the API Call + try { + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( + $resourcePath, 'GET', + $queryParams, $httpBody, + $headerParams, '\Swagger\Client\Model\InlineResponse200' + ); + + if (!$response) { + return array(null, $statusCode, $httpHeader); + } + + return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\InlineResponse200', $httpHeader), $statusCode, $httpHeader); + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\InlineResponse200', $e->getResponseHeaders()); + $e->setResponseObject($data); + break; + } + + throw $e; + } + } + /** * petPetIdtestingByteArraytrueGet * diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php index 7945d21be76..5e9705df3e3 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -280,6 +280,94 @@ class StoreApi } } + /** + * getInventoryInObject + * + * Fake endpoint to test arbitrary object return by 'Get inventory' + * + * @return object + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function getInventoryInObject() + { + list($response, $statusCode, $httpHeader) = $this->getInventoryInObjectWithHttpInfo (); + return $response; + } + + + /** + * getInventoryInObjectWithHttpInfo + * + * Fake endpoint to test arbitrary object return by 'Get inventory' + * + * @return Array of object, HTTP status code, HTTP response headers (array of strings) + * @throws \Swagger\Client\ApiException on non-2xx response + */ + public function getInventoryInObjectWithHttpInfo() + { + + + // parse inputs + $resourcePath = "/store/inventory?response=arbitrary_object"; + $httpBody = ''; + $queryParams = array(); + $headerParams = array(); + $formParams = array(); + $_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml')); + if (!is_null($_header_accept)) { + $headerParams['Accept'] = $_header_accept; + } + $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array()); + + + + + // default format to json + $resourcePath = str_replace("{format}", "json", $resourcePath); + + + + + // for model (json/xml) + if (isset($_tempBody)) { + $httpBody = $_tempBody; // $_tempBody is the method argument, if present + } elseif (count($formParams) > 0) { + $httpBody = $formParams; // for HTTP post (form) + } + + // this endpoint requires API key authentication + $apiKey = $this->apiClient->getApiKeyWithPrefix('api_key'); + if (strlen($apiKey) !== 0) { + $headerParams['api_key'] = $apiKey; + } + + + // make the API Call + try { + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( + $resourcePath, 'GET', + $queryParams, $httpBody, + $headerParams, 'object' + ); + + if (!$response) { + return array(null, $statusCode, $httpHeader); + } + + return array(\Swagger\Client\ObjectSerializer::deserialize($response, 'object', $httpHeader), $statusCode, $httpHeader); + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), 'object', $e->getResponseHeaders()); + $e->setResponseObject($data); + break; + } + + throw $e; + } + } + /** * placeOrder * diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/CategoryTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/CategoryTest.php index c6eaa55d0a5..26214963d3f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/CategoryTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/CategoryTest.php @@ -28,7 +28,7 @@ /** * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. + * Please update the test case below to test the model. */ namespace Swagger\Client\Model; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/OrderTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/OrderTest.php index fa036c10ef1..abfbe53d48f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/OrderTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/OrderTest.php @@ -28,7 +28,7 @@ /** * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. + * Please update the test case below to test the model. */ namespace Swagger\Client\Model; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php index 0505fde1c57..75751960cb1 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php @@ -28,7 +28,7 @@ /** * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. + * Please update the test case below to test the endpoint. */ namespace Swagger\Client\Api; @@ -145,6 +145,16 @@ class PetApiTest extends \PHPUnit_Framework_TestCase } + /** + * Test case for getPetByIdInObject + * + * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + * + */ + public function test_getPetByIdInObject() { + + } + /** * Test case for petPetIdtestingByteArraytrueGet * diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetTest.php index bcfc9b85ad6..571e17f56cb 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetTest.php @@ -28,7 +28,7 @@ /** * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. + * Please update the test case below to test the model. */ namespace Swagger\Client\Model; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php index 8ccedf892a0..6dd3f3ad6c2 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php @@ -28,7 +28,7 @@ /** * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. + * Please update the test case below to test the endpoint. */ namespace Swagger\Client\Api; @@ -85,6 +85,16 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase } + /** + * Test case for getInventoryInObject + * + * Fake endpoint to test arbitrary object return by 'Get inventory' + * + */ + public function test_getInventoryInObject() { + + } + /** * Test case for placeOrder * diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/TagTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/TagTest.php index 726dacbd126..34536dc0d4c 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/TagTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/TagTest.php @@ -28,7 +28,7 @@ /** * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. + * Please update the test case below to test the model. */ namespace Swagger\Client\Model; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/UserApiTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/UserApiTest.php index 500b99c4c4f..e991106ee84 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/UserApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/UserApiTest.php @@ -28,7 +28,7 @@ /** * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. + * Please update the test case below to test the endpoint. */ namespace Swagger\Client\Api; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/UserTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/UserTest.php index 635a91e704e..ffde69ecf2f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/UserTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/UserTest.php @@ -28,7 +28,7 @@ /** * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. + * Please update the test case below to test the model. */ namespace Swagger\Client\Model;