diff --git a/bin/php-petstore.sh b/bin/php-petstore.sh index 14b53d65b4f1..3b25c1c1cc31 100755 --- a/bin/php-petstore.sh +++ b/bin/php-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/php -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l php -o samples/client/petstore/php" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/php -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l php -o samples/client/petstore/php" java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml new file mode 100644 index 000000000000..bf84cf9c38cb --- /dev/null +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -0,0 +1,792 @@ +swagger: '2.0' +info: + description: 'This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.' + version: 1.0.0 + title: Swagger Petstore + termsOfService: 'http://swagger.io/terms/' + contact: + email: apiteam@swagger.io + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +host: petstore.swagger.io +basePath: /v2 +tags: + - name: pet + description: Everything about your Pets + externalDocs: + description: Find out more + url: 'http://swagger.io' + - name: store + description: Access to Petstore orders + - name: user + description: Operations about user + externalDocs: + description: Find out more about our store + url: 'http://swagger.io' +schemes: + - http +paths: + /pet: + post: + tags: + - pet + summary: Add a new pet to the store + description: '' + operationId: addPet + consumes: + - application/json + - application/xml + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: Pet object that needs to be added to the store + required: true + schema: + $ref: '#/definitions/Pet' + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + put: + tags: + - pet + summary: Update an existing pet + description: '' + operationId: updatePet + consumes: + - application/json + - application/xml + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: Pet object that needs to be added to the store + required: true + schema: + $ref: '#/definitions/Pet' + responses: + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + /pet/findByStatus: + get: + tags: + - pet + summary: Finds Pets by status + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + produces: + - application/xml + - application/json + parameters: + - name: status + in: query + description: Status values that need to be considered for filter + required: true + type: array + items: + type: string + enum: + - available + - pending + - sold + default: available + collectionFormat: csv + responses: + '200': + description: successful operation + schema: + type: array + items: + $ref: '#/definitions/Pet' + '400': + description: Invalid status value + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + /pet/findByTags: + get: + tags: + - pet + summary: Finds Pets by tags + description: 'Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.' + operationId: findPetsByTags + produces: + - application/xml + - application/json + parameters: + - name: tags + in: query + description: Tags to filter by + required: true + type: array + items: + type: string + collectionFormat: csv + responses: + '200': + description: successful operation + schema: + type: array + items: + $ref: '#/definitions/Pet' + '400': + description: Invalid tag value + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + '/pet/{petId}': + get: + tags: + - pet + summary: Find pet by ID + description: Returns a single pet + operationId: getPetById + produces: + - application/xml + - application/json + parameters: + - name: petId + in: path + description: ID of pet to return + required: true + type: integer + format: int64 + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/Pet' + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + post: + tags: + - pet + summary: Updates a pet in the store with form data + description: '' + operationId: updatePetWithForm + consumes: + - application/x-www-form-urlencoded + produces: + - application/xml + - application/json + parameters: + - name: petId + in: path + description: ID of pet that needs to be updated + required: true + type: integer + format: int64 + - name: name + in: formData + description: Updated name of the pet + required: false + type: string + - name: status + in: formData + description: Updated status of the pet + required: false + type: string + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + delete: + tags: + - pet + summary: Deletes a pet + description: '' + operationId: deletePet + produces: + - application/xml + - application/json + parameters: + - name: api_key + in: header + required: false + type: string + - name: petId + in: path + description: Pet id to delete + required: true + type: integer + format: int64 + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + '/pet/{petId}/uploadImage': + post: + tags: + - pet + summary: uploads an image + description: '' + operationId: uploadFile + consumes: + - multipart/form-data + produces: + - application/json + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + type: integer + format: int64 + - name: additionalMetadata + in: formData + description: Additional data to pass to server + required: false + type: string + - name: file + in: formData + description: file to upload + required: false + type: file + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/ApiResponse' + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + /store/inventory: + get: + tags: + - store + summary: Returns pet inventories by status + description: Returns a map of status codes to quantities + operationId: getInventory + produces: + - application/json + parameters: [] + responses: + '200': + description: successful operation + schema: + type: object + additionalProperties: + type: integer + format: int32 + security: + - api_key: [] + /store/order: + post: + tags: + - store + summary: Place an order for a pet + description: '' + operationId: placeOrder + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: order placed for purchasing the pet + required: true + schema: + $ref: '#/definitions/Order' + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/Order' + '400': + description: Invalid Order + '/store/order/{orderId}': + get: + tags: + - store + summary: Find purchase order by ID + description: 'For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions' + operationId: getOrderById + produces: + - application/xml + - application/json + parameters: + - name: orderId + in: path + description: ID of pet that needs to be fetched + required: true + type: integer + maximum: 5 + minimum: 1 + format: int64 + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/Order' + '400': + description: Invalid ID supplied + '404': + description: Order not found + delete: + tags: + - store + summary: Delete purchase order by ID + description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + operationId: deleteOrder + produces: + - application/xml + - application/json + parameters: + - name: orderId + in: path + description: ID of the order that needs to be deleted + required: true + type: string + minimum: 1 + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + /user: + post: + tags: + - user + summary: Create user + description: This can only be done by the logged in user. + operationId: createUser + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: Created user object + required: true + schema: + $ref: '#/definitions/User' + responses: + default: + description: successful operation + /user/createWithArray: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithArrayInput + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: List of user object + required: true + schema: + type: array + items: + $ref: '#/definitions/User' + responses: + default: + description: successful operation + /user/createWithList: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithListInput + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: List of user object + required: true + schema: + type: array + items: + $ref: '#/definitions/User' + responses: + default: + description: successful operation + /user/login: + get: + tags: + - user + summary: Logs user into the system + description: '' + operationId: loginUser + produces: + - application/xml + - application/json + parameters: + - name: username + in: query + description: The user name for login + required: true + type: string + - name: password + in: query + description: The password for login in clear text + required: true + type: string + responses: + '200': + description: successful operation + schema: + type: string + headers: + X-Rate-Limit: + type: integer + format: int32 + description: calls per hour allowed by the user + X-Expires-After: + type: string + format: date-time + description: date in UTC when toekn expires + '400': + description: Invalid username/password supplied + /user/logout: + get: + tags: + - user + summary: Logs out current logged in user session + description: '' + operationId: logoutUser + produces: + - application/xml + - application/json + parameters: [] + responses: + default: + description: successful operation + '/user/{username}': + get: + tags: + - user + summary: Get user by user name + description: '' + operationId: getUserByName + produces: + - application/xml + - application/json + parameters: + - name: username + in: path + description: 'The name that needs to be fetched. Use user1 for testing. ' + required: true + type: string + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/User' + '400': + description: Invalid username supplied + '404': + description: User not found + put: + tags: + - user + summary: Updated user + description: This can only be done by the logged in user. + operationId: updateUser + produces: + - application/xml + - application/json + parameters: + - name: username + in: path + description: name that need to be deleted + required: true + type: string + - in: body + name: body + description: Updated user object + required: true + schema: + $ref: '#/definitions/User' + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + delete: + tags: + - user + summary: Delete user + description: This can only be done by the logged in user. + operationId: deleteUser + produces: + - application/xml + - application/json + parameters: + - name: username + in: path + description: The name that needs to be deleted + required: true + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found +securityDefinitions: + petstore_auth: + type: oauth2 + authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog' + flow: implicit + scopes: + 'write:pets': modify pets in your account + 'read:pets': read your pets + api_key: + type: apiKey + name: api_key + in: header +definitions: + Order: + type: object + properties: + id: + type: integer + format: int64 + petId: + type: integer + format: int64 + quantity: + type: integer + format: int32 + shipDate: + type: string + format: date-time + status: + type: string + description: Order Status + enum: + - placed + - approved + - delivered + complete: + type: boolean + default: false + xml: + name: Order + Category: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Category + User: + type: object + properties: + id: + type: integer + format: int64 + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + type: integer + format: int32 + description: User Status + xml: + name: User + Tag: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Tag + Pet: + type: object + required: + - name + - photoUrls + properties: + id: + type: integer + format: int64 + category: + $ref: '#/definitions/Category' + name: + type: string + example: doggie + photoUrls: + type: array + xml: + name: photoUrl + wrapped: true + items: + type: string + tags: + type: array + xml: + name: tag + wrapped: true + items: + $ref: '#/definitions/Tag' + status: + type: string + description: pet status in the store + enum: + - available + - pending + - sold + xml: + name: Pet + ApiResponse: + type: object + properties: + code: + type: integer + format: int32 + type: + type: string + message: + type: string + '$special[model.name]': + properties: + '$special[property.name]': + type: integer + format: int64 + xml: + name: '$special[model.name]' + Return: + description: Model for testing reserved words + properties: + return: + type: integer + format: int32 + xml: + name: Return + Name: + description: Model for testing model name same as property name + required: + - name + properties: + name: + type: integer + format: int32 + snake_case: + readOnly: true + type: integer + format: int32 + xml: + name: Name + 200_response: + description: Model for testing model name starting with number + properties: + name: + type: integer + format: int32 + xml: + name: Name + Dog: + allOf: + - $ref: '#/definitions/Animal' + - type: object + properties: + breed: + type: string + Cat: + allOf: + - $ref: '#/definitions/Animal' + - type: object + properties: + declawed: + type: boolean + Animal: + type: object + discriminator: className + required: + - className + properties: + className: + type: string + format_test: + type: object + required: + - number + properties: + integer: + type: integer + int32: + type: integer + format: int32 + int64: + type: integer + format: int64 + number: + type: number + float: + type: number + format: float + double: + type: number + format: double + string: + type: string + byte: + type: string + format: byte + binary: + type: string + format: binary + date: + type: string + format: date + dateTime: + type: string + format: date-time + password: + type: string + format: password +externalDocs: + description: Find out more about Swagger + url: 'http://swagger.io' diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index 4d73a38f0842..18eb2791d460 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -1,11 +1,11 @@ # SwaggerClient-php -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-11T16:59:06.544+08:00 +- Build date: 2016-04-12T20:01:35.068+08:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -80,20 +80,15 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store -*PetApi* | [**addPetUsingByteArray**](docs/PetApi.md#addpetusingbytearray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetApi* | [**getPetByIdInObject**](docs/PetApi.md#getpetbyidinobject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' -*PetApi* | [**petPetIdtestingByteArraytrueGet**](docs/PetApi.md#petpetidtestingbytearraytrueget) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' *PetApi* | [**updatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet *PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**uploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image *StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -*StoreApi* | [**findOrdersByStatus**](docs/StoreApi.md#findordersbystatus) | **GET** /store/findByStatus | Finds orders by status *StoreApi* | [**getInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status -*StoreApi* | [**getInventoryInObject**](docs/StoreApi.md#getinventoryinobject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' *StoreApi* | [**getOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID *StoreApi* | [**placeOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet *UserApi* | [**createUser**](docs/UserApi.md#createuser) | **POST** /user | Create user @@ -109,11 +104,11 @@ Class | Method | HTTP request | Description ## Documentation For Models - [Animal](docs/Animal.md) + - [ApiResponse](docs/ApiResponse.md) - [Cat](docs/Cat.md) - [Category](docs/Category.md) - [Dog](docs/Dog.md) - [FormatTest](docs/FormatTest.md) - - [InlineResponse200](docs/InlineResponse200.md) - [Model200Response](docs/Model200Response.md) - [ModelReturn](docs/ModelReturn.md) - [Name](docs/Name.md) @@ -127,40 +122,12 @@ Class | Method | HTTP request | Description ## Documentation For Authorization -## test_api_key_header - -- **Type**: API key -- **API key parameter name**: test_api_key_header -- **Location**: HTTP header - ## api_key - **Type**: API key - **API key parameter name**: api_key - **Location**: HTTP header -## test_http_basic - -- **Type**: HTTP basic authentication - -## test_api_client_secret - -- **Type**: API key -- **API key parameter name**: x-test_api_client_secret -- **Location**: HTTP header - -## test_api_client_id - -- **Type**: API key -- **API key parameter name**: x-test_api_client_id -- **Location**: HTTP header - -## test_api_key_query - -- **Type**: API key -- **API key parameter name**: test_api_key_query -- **Location**: URL query string - ## petstore_auth - **Type**: OAuth diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md b/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md index 7ea1a17404f0..e0598317f5e6 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md @@ -13,7 +13,8 @@ Name | Type | Description | Notes **byte** | **string** | | [optional] **binary** | **string** | | [optional] **date** | [**\DateTime**](Date.md) | | [optional] -**date_time** | **string** | | [optional] +**date_time** | [**\DateTime**](\DateTime.md) | | [optional] +**password** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Order.md b/samples/client/petstore/php/SwaggerClient-php/docs/Order.md index 8932478b0228..ddae5cc2b571 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Order.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Order.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **quantity** | **int** | | [optional] **ship_date** | [**\DateTime**](\DateTime.md) | | [optional] **status** | **string** | Order Status | [optional] -**complete** | **bool** | | [optional] +**complete** | **bool** | | [optional] [default to false] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md index 9164cd278767..16dd52ff0477 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md @@ -5,13 +5,10 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store -[**addPetUsingByteArray**](PetApi.md#addPetUsingByteArray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID -[**getPetByIdInObject**](PetApi.md#getPetByIdInObject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' -[**petPetIdtestingByteArraytrueGet**](PetApi.md#petPetIdtestingByteArraytrueGet) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -47,7 +44,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\Swagger\Client\Model\Pet**](\Swagger\Client\Model\Pet.md)| Pet object that needs to be added to the store | [optional] + **body** | [**\Swagger\Client\Model\Pet**](\Swagger\Client\Model\Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -60,54 +57,7 @@ void (empty response body) ### HTTP reuqest headers - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **addPetUsingByteArray** -> addPetUsingByteArray($body) - -Fake endpoint to test byte array in body parameter for adding a new pet to the store - - - -### Example -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - -$api_instance = new Swagger\Client\Api\PetApi(); -$body = "B"; // string | Pet object in the form of byte array - -try { - $api_instance->addPetUsingByteArray($body); -} catch (Exception $e) { - echo 'Exception when calling PetApi->addPetUsingByteArray: ', $e->getMessage(), "\n"; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **string**| Pet object in the form of byte array | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP reuqest headers - - - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -156,7 +106,7 @@ void (empty response body) ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -176,7 +126,7 @@ require_once(__DIR__ . '/vendor/autoload.php'); Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $api_instance = new Swagger\Client\Api\PetApi(); -$status = array("available"); // string[] | Status values that need to be considered for query +$status = array("status_example"); // string[] | Status values that need to be considered for filter try { $result = $api_instance->findPetsByStatus($status); @@ -191,7 +141,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**string[]**](string.md)| Status values that need to be considered for query | [optional] [default to available] + **status** | [**string[]**](string.md)| Status values that need to be considered for filter | ### Return type @@ -204,7 +154,7 @@ Name | Type | Description | Notes ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -213,7 +163,7 @@ Name | Type | Description | Notes Finds Pets by tags -Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. ### Example ```php @@ -239,7 +189,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**string[]**](string.md)| Tags to filter by | [optional] + **tags** | [**string[]**](string.md)| Tags to filter by | ### Return type @@ -252,7 +202,7 @@ Name | Type | Description | Notes ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -261,7 +211,7 @@ Name | Type | Description | Notes Find pet by ID -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions +Returns a single pet ### Example ```php @@ -272,11 +222,9 @@ require_once(__DIR__ . '/vendor/autoload.php'); Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed // Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER'); -// Configure OAuth2 access token for authorization: petstore_auth -Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $api_instance = new Swagger\Client\Api\PetApi(); -$pet_id = 789; // int | ID of pet that needs to be fetched +$pet_id = 789; // int | ID of pet to return try { $result = $api_instance->getPetById($pet_id); @@ -291,7 +239,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet that needs to be fetched | + **pet_id** | **int**| ID of pet to return | ### Return type @@ -299,116 +247,12 @@ Name | Type | Description | Notes ### Authorization -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) +[api_key](../README.md#api_key) ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getPetByIdInObject** -> \Swagger\Client\Model\InlineResponse200 getPetByIdInObject($pet_id) - -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 - -### Example -```php -setApiKey('api_key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER'); -// Configure OAuth2 access token for authorization: petstore_auth -Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); - -$api_instance = new Swagger\Client\Api\PetApi(); -$pet_id = 789; // int | ID of pet that needs to be fetched - -try { - $result = $api_instance->getPetByIdInObject($pet_id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling PetApi->getPetByIdInObject: ', $e->getMessage(), "\n"; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet that needs to be fetched | - -### Return type - -[**\Swagger\Client\Model\InlineResponse200**](InlineResponse200.md) - -### Authorization - -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) - -### HTTP reuqest headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **petPetIdtestingByteArraytrueGet** -> string petPetIdtestingByteArraytrueGet($pet_id) - -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 - -### Example -```php -setApiKey('api_key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER'); -// Configure OAuth2 access token for authorization: petstore_auth -Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); - -$api_instance = new Swagger\Client\Api\PetApi(); -$pet_id = 789; // int | ID of pet that needs to be fetched - -try { - $result = $api_instance->petPetIdtestingByteArraytrueGet($pet_id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling PetApi->petPetIdtestingByteArraytrueGet: ', $e->getMessage(), "\n"; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet that needs to be fetched | - -### Return type - -**string** - -### Authorization - -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) - -### HTTP reuqest headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -442,7 +286,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\Swagger\Client\Model\Pet**](\Swagger\Client\Model\Pet.md)| Pet object that needs to be added to the store | [optional] + **body** | [**\Swagger\Client\Model\Pet**](\Swagger\Client\Model\Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -455,7 +299,7 @@ void (empty response body) ### HTTP reuqest headers - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -475,7 +319,7 @@ require_once(__DIR__ . '/vendor/autoload.php'); Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $api_instance = new Swagger\Client\Api\PetApi(); -$pet_id = "pet_id_example"; // string | ID of pet that needs to be updated +$pet_id = 789; // int | ID of pet that needs to be updated $name = "name_example"; // string | Updated name of the pet $status = "status_example"; // string | Updated status of the pet @@ -491,7 +335,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **string**| ID of pet that needs to be updated | + **pet_id** | **int**| ID of pet that needs to be updated | **name** | **string**| Updated name of the pet | [optional] **status** | **string**| Updated status of the pet | [optional] @@ -506,12 +350,12 @@ void (empty response body) ### HTTP reuqest headers - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **uploadFile** -> uploadFile($pet_id, $additional_metadata, $file) +> \Swagger\Client\Model\ApiResponse uploadFile($pet_id, $additional_metadata, $file) uploads an image @@ -531,7 +375,8 @@ $additional_metadata = "additional_metadata_example"; // string | Additional dat $file = "/path/to/file.txt"; // \SplFileObject | file to upload try { - $api_instance->uploadFile($pet_id, $additional_metadata, $file); + $result = $api_instance->uploadFile($pet_id, $additional_metadata, $file); + print_r($result); } catch (Exception $e) { echo 'Exception when calling PetApi->uploadFile: ', $e->getMessage(), "\n"; } @@ -548,7 +393,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +[**\Swagger\Client\Model\ApiResponse**](ApiResponse.md) ### Authorization @@ -557,7 +402,7 @@ void (empty response body) ### HTTP reuqest headers - **Content-Type**: multipart/form-data - - **Accept**: application/json, application/xml + - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md index c60ac6032991..efbdc89a511e 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md @@ -5,9 +5,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -[**findOrdersByStatus**](StoreApi.md#findOrdersByStatus) | **GET** /store/findByStatus | Finds orders by status [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status -[**getInventoryInObject**](StoreApi.md#getInventoryInObject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet @@ -52,61 +50,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **findOrdersByStatus** -> \Swagger\Client\Model\Order[] findOrdersByStatus($status) - -Finds orders by status - -A single status value can be provided as a string - -### Example -```php -setApiKey('x-test_api_client_id', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-test_api_client_id', 'BEARER'); -// Configure API key authorization: test_api_client_secret -Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('x-test_api_client_secret', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-test_api_client_secret', 'BEARER'); - -$api_instance = new Swagger\Client\Api\StoreApi(); -$status = "placed"; // string | Status value that needs to be considered for query - -try { - $result = $api_instance->findOrdersByStatus($status); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling StoreApi->findOrdersByStatus: ', $e->getMessage(), "\n"; -} -?> -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | **string**| Status value that needs to be considered for query | [optional] [default to placed] - -### Return type - -[**\Swagger\Client\Model\Order[]**](Order.md) - -### Authorization - -[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) - -### HTTP reuqest headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -152,53 +96,7 @@ This endpoint does not need any parameter. ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getInventoryInObject** -> 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 - -### Example -```php -setApiKey('api_key', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER'); - -$api_instance = new Swagger\Client\Api\StoreApi(); - -try { - $result = $api_instance->getInventoryInObject(); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling StoreApi->getInventoryInObject: ', $e->getMessage(), "\n"; -} -?> -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**object** - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP reuqest headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -214,17 +112,8 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge setApiKey('test_api_key_header', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('test_api_key_header', 'BEARER'); -// Configure API key authorization: test_api_key_query -Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('test_api_key_query', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('test_api_key_query', 'BEARER'); - $api_instance = new Swagger\Client\Api\StoreApi(); -$order_id = "order_id_example"; // string | ID of pet that needs to be fetched +$order_id = 789; // int | ID of pet that needs to be fetched try { $result = $api_instance->getOrderById($order_id); @@ -239,7 +128,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order_id** | **string**| ID of pet that needs to be fetched | + **order_id** | **int**| ID of pet that needs to be fetched | ### Return type @@ -247,12 +136,12 @@ Name | Type | Description | Notes ### Authorization -[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query) +No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -268,15 +157,6 @@ Place an order for a pet setApiKey('x-test_api_client_id', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-test_api_client_id', 'BEARER'); -// Configure API key authorization: test_api_client_secret -Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('x-test_api_client_secret', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed -// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-test_api_client_secret', 'BEARER'); - $api_instance = new Swagger\Client\Api\StoreApi(); $body = new \Swagger\Client\Model\Order(); // \Swagger\Client\Model\Order | order placed for purchasing the pet @@ -293,7 +173,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\Swagger\Client\Model\Order**](\Swagger\Client\Model\Order.md)| order placed for purchasing the pet | [optional] + **body** | [**\Swagger\Client\Model\Order**](\Swagger\Client\Model\Order.md)| order placed for purchasing the pet | ### Return type @@ -301,12 +181,12 @@ Name | Type | Description | Notes ### Authorization -[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) +No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md index e6a19891ba5c..c5cb7a34cc76 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md @@ -41,7 +41,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\Swagger\Client\Model\User**](\Swagger\Client\Model\User.md)| Created user object | [optional] + **body** | [**\Swagger\Client\Model\User**](\Swagger\Client\Model\User.md)| Created user object | ### Return type @@ -54,7 +54,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -85,7 +85,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\Swagger\Client\Model\User[]**](User.md)| List of user object | [optional] + **body** | [**\Swagger\Client\Model\User[]**](User.md)| List of user object | ### Return type @@ -98,7 +98,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -129,7 +129,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\Swagger\Client\Model\User[]**](User.md)| List of user object | [optional] + **body** | [**\Swagger\Client\Model\User[]**](User.md)| List of user object | ### Return type @@ -142,7 +142,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -158,10 +158,6 @@ This can only be done by the logged in user. setUsername('YOUR_USERNAME'); -Swagger\Client\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD'); - $api_instance = new Swagger\Client\Api\UserApi(); $username = "username_example"; // string | The name that needs to be deleted @@ -185,12 +181,12 @@ void (empty response body) ### Authorization -[test_http_basic](../README.md#test_http_basic) +No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -235,7 +231,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -268,8 +264,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **string**| The user name for login | [optional] - **password** | **string**| The password for login in clear text | [optional] + **username** | **string**| The user name for login | + **password** | **string**| The password for login in clear text | ### Return type @@ -282,7 +278,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -322,7 +318,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -355,7 +351,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **string**| name that need to be deleted | - **body** | [**\Swagger\Client\Model\User**](\Swagger\Client\Model\User.md)| Updated user object | [optional] + **body** | [**\Swagger\Client\Model\User**](\Swagger\Client\Model\User.md)| Updated user object | ### Return type @@ -368,7 +364,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) 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 4661a5b3bd87..1154b72929c7 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -95,11 +95,11 @@ class PetApi * * Add a new pet to the store * - * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (optional) + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function addPet($body = null) + public function addPet($body) { list($response) = $this->addPetWithHttpInfo ($body); return $response; @@ -111,13 +111,17 @@ class PetApi * * Add a new pet to the store * - * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (optional) + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) * @return Array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function addPetWithHttpInfo($body = null) + public function addPetWithHttpInfo($body) { + // verify the required parameter 'body' is set + if ($body === null) { + throw new \InvalidArgumentException('Missing the required parameter $body when calling addPet'); + } // parse inputs $resourcePath = "/pet"; @@ -125,88 +129,7 @@ class PetApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/xml')); - - - - - // default format to json - $resourcePath = str_replace("{format}", "json", $resourcePath); - - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - // 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 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, 'POST', - $queryParams, $httpBody, - $headerParams - ); - - return array(null, $statusCode, $httpHeader); - } catch (ApiException $e) { - switch ($e->getCode()) { - } - - throw $e; - } - } - /** - * addPetUsingByteArray - * - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param string $body Pet object in the form of byte array (optional) - * @return void - * @throws \Swagger\Client\ApiException on non-2xx response - */ - public function addPetUsingByteArray($body = null) - { - list($response) = $this->addPetUsingByteArrayWithHttpInfo ($body); - return $response; - } - - - /** - * addPetUsingByteArrayWithHttpInfo - * - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param string $body Pet object in the form of byte array (optional) - * @return Array of null, HTTP status code, HTTP response headers (array of strings) - * @throws \Swagger\Client\ApiException on non-2xx response - */ - public function addPetUsingByteArrayWithHttpInfo($body = null) - { - - - // parse inputs - $resourcePath = "/pet?testing_byte_array=true"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -293,7 +216,7 @@ class PetApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -350,11 +273,11 @@ class PetApi * * Finds Pets by status * - * @param string[] $status Status values that need to be considered for query (optional, default to available) + * @param string[] $status Status values that need to be considered for filter (required) * @return \Swagger\Client\Model\Pet[] * @throws \Swagger\Client\ApiException on non-2xx response */ - public function findPetsByStatus($status = null) + public function findPetsByStatus($status) { list($response) = $this->findPetsByStatusWithHttpInfo ($status); return $response; @@ -366,13 +289,17 @@ class PetApi * * Finds Pets by status * - * @param string[] $status Status values that need to be considered for query (optional, default to available) + * @param string[] $status Status values that need to be considered for filter (required) * @return Array of \Swagger\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function findPetsByStatusWithHttpInfo($status = null) + public function findPetsByStatusWithHttpInfo($status) { + // verify the required parameter 'status' is set + if ($status === null) { + throw new \InvalidArgumentException('Missing the required parameter $status when calling findPetsByStatus'); + } // parse inputs $resourcePath = "/pet/findByStatus"; @@ -380,7 +307,7 @@ class PetApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -388,7 +315,7 @@ class PetApi // query params if (is_array($status)) { - $status = $this->apiClient->getSerializer()->serializeCollection($status, 'multi', true); + $status = $this->apiClient->getSerializer()->serializeCollection($status, 'csv', true); } if ($status !== null) { $queryParams['status'] = $this->apiClient->getSerializer()->toQueryValue($status); @@ -440,11 +367,11 @@ class PetApi * * Finds Pets by tags * - * @param string[] $tags Tags to filter by (optional) + * @param string[] $tags Tags to filter by (required) * @return \Swagger\Client\Model\Pet[] * @throws \Swagger\Client\ApiException on non-2xx response */ - public function findPetsByTags($tags = null) + public function findPetsByTags($tags) { list($response) = $this->findPetsByTagsWithHttpInfo ($tags); return $response; @@ -456,13 +383,17 @@ class PetApi * * Finds Pets by tags * - * @param string[] $tags Tags to filter by (optional) + * @param string[] $tags Tags to filter by (required) * @return Array of \Swagger\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function findPetsByTagsWithHttpInfo($tags = null) + public function findPetsByTagsWithHttpInfo($tags) { + // verify the required parameter 'tags' is set + if ($tags === null) { + throw new \InvalidArgumentException('Missing the required parameter $tags when calling findPetsByTags'); + } // parse inputs $resourcePath = "/pet/findByTags"; @@ -470,7 +401,7 @@ class PetApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -478,7 +409,7 @@ class PetApi // query params if (is_array($tags)) { - $tags = $this->apiClient->getSerializer()->serializeCollection($tags, 'multi', true); + $tags = $this->apiClient->getSerializer()->serializeCollection($tags, 'csv', true); } if ($tags !== null) { $queryParams['tags'] = $this->apiClient->getSerializer()->toQueryValue($tags); @@ -530,7 +461,7 @@ class PetApi * * Find pet by ID * - * @param int $pet_id ID of pet that needs to be fetched (required) + * @param int $pet_id ID of pet to return (required) * @return \Swagger\Client\Model\Pet * @throws \Swagger\Client\ApiException on non-2xx response */ @@ -546,7 +477,7 @@ class PetApi * * Find pet by ID * - * @param int $pet_id ID of pet that needs to be fetched (required) + * @param int $pet_id ID of pet to return (required) * @return Array of \Swagger\Client\Model\Pet, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ @@ -564,7 +495,7 @@ class PetApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -599,11 +530,6 @@ class PetApi $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( @@ -627,220 +553,16 @@ class PetApi throw $e; } } - /** - * 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) = $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 = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->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($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\InlineResponse200', $httpHeader), $statusCode, $httpHeader); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\InlineResponse200', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - - throw $e; - } - } - /** - * petPetIdtestingByteArraytrueGet - * - * Fake endpoint to test byte array return by 'Find pet by ID' - * - * @param int $pet_id ID of pet that needs to be fetched (required) - * @return string - * @throws \Swagger\Client\ApiException on non-2xx response - */ - public function petPetIdtestingByteArraytrueGet($pet_id) - { - list($response) = $this->petPetIdtestingByteArraytrueGetWithHttpInfo ($pet_id); - return $response; - } - - - /** - * petPetIdtestingByteArraytrueGetWithHttpInfo - * - * Fake endpoint to test byte array return by 'Find pet by ID' - * - * @param int $pet_id ID of pet that needs to be fetched (required) - * @return Array of string, HTTP status code, HTTP response headers (array of strings) - * @throws \Swagger\Client\ApiException on non-2xx response - */ - public function petPetIdtestingByteArraytrueGetWithHttpInfo($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 petPetIdtestingByteArraytrueGet'); - } - - // parse inputs - $resourcePath = "/pet/{petId}?testing_byte_array=true"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->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, 'string' - ); - if (!$response) { - return array(null, $statusCode, $httpHeader); - } - - return array($this->apiClient->getSerializer()->deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'string', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - - throw $e; - } - } /** * updatePet * * Update an existing pet * - * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (optional) + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function updatePet($body = null) + public function updatePet($body) { list($response) = $this->updatePetWithHttpInfo ($body); return $response; @@ -852,13 +574,17 @@ class PetApi * * Update an existing pet * - * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (optional) + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) * @return Array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function updatePetWithHttpInfo($body = null) + public function updatePetWithHttpInfo($body) { + // verify the required parameter 'body' is set + if ($body === null) { + throw new \InvalidArgumentException('Missing the required parameter $body when calling updatePet'); + } // parse inputs $resourcePath = "/pet"; @@ -866,7 +592,7 @@ class PetApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -917,7 +643,7 @@ class PetApi * * Updates a pet in the store with form data * - * @param string $pet_id ID of pet that needs to be updated (required) + * @param int $pet_id ID of pet that needs to be updated (required) * @param string $name Updated name of the pet (optional) * @param string $status Updated status of the pet (optional) * @return void @@ -935,7 +661,7 @@ class PetApi * * Updates a pet in the store with form data * - * @param string $pet_id ID of pet that needs to be updated (required) + * @param int $pet_id ID of pet that needs to be updated (required) * @param string $name Updated name of the pet (optional) * @param string $status Updated status of the pet (optional) * @return Array of null, HTTP status code, HTTP response headers (array of strings) @@ -955,7 +681,7 @@ class PetApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -1018,7 +744,7 @@ class PetApi * @param int $pet_id ID of pet to update (required) * @param string $additional_metadata Additional data to pass to server (optional) * @param \SplFileObject $file file to upload (optional) - * @return void + * @return \Swagger\Client\Model\ApiResponse * @throws \Swagger\Client\ApiException on non-2xx response */ public function uploadFile($pet_id, $additional_metadata = null, $file = null) @@ -1036,7 +762,7 @@ class PetApi * @param int $pet_id ID of pet to update (required) * @param string $additional_metadata Additional data to pass to server (optional) * @param \SplFileObject $file file to upload (optional) - * @return Array of null, HTTP status code, HTTP response headers (array of strings) + * @return Array of \Swagger\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $file = null) @@ -1053,7 +779,7 @@ class PetApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -1103,12 +829,19 @@ class PetApi list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, 'POST', $queryParams, $httpBody, - $headerParams + $headerParams, '\Swagger\Client\Model\ApiResponse' ); + if (!$response) { + return array(null, $statusCode, $httpHeader); + } - return array(null, $statusCode, $httpHeader); - } catch (ApiException $e) { + return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\ApiResponse', $httpHeader), $statusCode, $httpHeader); + } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\ApiResponse', $e->getResponseHeaders()); + $e->setResponseObject($data); + break; } throw $e; 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 387cd476c555..e5bf83b4463d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -129,7 +129,7 @@ class StoreApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -173,102 +173,6 @@ class StoreApi throw $e; } } - /** - * findOrdersByStatus - * - * Finds orders by status - * - * @param string $status Status value that needs to be considered for query (optional, default to placed) - * @return \Swagger\Client\Model\Order[] - * @throws \Swagger\Client\ApiException on non-2xx response - */ - public function findOrdersByStatus($status = null) - { - list($response) = $this->findOrdersByStatusWithHttpInfo ($status); - return $response; - } - - - /** - * findOrdersByStatusWithHttpInfo - * - * Finds orders by status - * - * @param string $status Status value that needs to be considered for query (optional, default to placed) - * @return Array of \Swagger\Client\Model\Order[], HTTP status code, HTTP response headers (array of strings) - * @throws \Swagger\Client\ApiException on non-2xx response - */ - public function findOrdersByStatusWithHttpInfo($status = null) - { - - - // parse inputs - $resourcePath = "/store/findByStatus"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); - - // query params - if ($status !== null) { - $queryParams['status'] = $this->apiClient->getSerializer()->toQueryValue($status); - } - - - // 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('x-test_api_client_id'); - if (strlen($apiKey) !== 0) { - $headerParams['x-test_api_client_id'] = $apiKey; - } - - - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('x-test_api_client_secret'); - if (strlen($apiKey) !== 0) { - $headerParams['x-test_api_client_secret'] = $apiKey; - } - - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, 'GET', - $queryParams, $httpBody, - $headerParams, '\Swagger\Client\Model\Order[]' - ); - if (!$response) { - return array(null, $statusCode, $httpHeader); - } - - return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order[]', $httpHeader), $statusCode, $httpHeader); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order[]', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - - throw $e; - } - } /** * getInventory * @@ -302,7 +206,7 @@ class StoreApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -353,96 +257,12 @@ class StoreApi throw $e; } } - /** - * 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) = $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 = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->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($this->apiClient->getSerializer()->deserialize($response, 'object', $httpHeader), $statusCode, $httpHeader); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'object', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - - throw $e; - } - } /** * getOrderById * * Find purchase order by ID * - * @param string $order_id ID of pet that needs to be fetched (required) + * @param int $order_id ID of pet that needs to be fetched (required) * @return \Swagger\Client\Model\Order * @throws \Swagger\Client\ApiException on non-2xx response */ @@ -458,7 +278,7 @@ class StoreApi * * Find purchase order by ID * - * @param string $order_id ID of pet that needs to be fetched (required) + * @param int $order_id ID of pet that needs to be fetched (required) * @return Array of \Swagger\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ @@ -476,7 +296,7 @@ class StoreApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -504,21 +324,7 @@ class StoreApi } elseif (count($formParams) > 0) { $httpBody = $formParams; // for HTTP post (form) } - - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_header'); - if (strlen($apiKey) !== 0) { - $headerParams['test_api_key_header'] = $apiKey; - } - - - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_query'); - if (strlen($apiKey) !== 0) { - $queryParams['test_api_key_query'] = $apiKey; - } - - // make the API Call + // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, 'GET', @@ -546,11 +352,11 @@ class StoreApi * * Place an order for a pet * - * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (optional) + * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) * @return \Swagger\Client\Model\Order * @throws \Swagger\Client\ApiException on non-2xx response */ - public function placeOrder($body = null) + public function placeOrder($body) { list($response) = $this->placeOrderWithHttpInfo ($body); return $response; @@ -562,13 +368,17 @@ class StoreApi * * Place an order for a pet * - * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (optional) + * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) * @return Array of \Swagger\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function placeOrderWithHttpInfo($body = null) + public function placeOrderWithHttpInfo($body) { + // verify the required parameter 'body' is set + if ($body === null) { + throw new \InvalidArgumentException('Missing the required parameter $body when calling placeOrder'); + } // parse inputs $resourcePath = "/store/order"; @@ -576,7 +386,7 @@ class StoreApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -601,21 +411,7 @@ class StoreApi } elseif (count($formParams) > 0) { $httpBody = $formParams; // for HTTP post (form) } - - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('x-test_api_client_id'); - if (strlen($apiKey) !== 0) { - $headerParams['x-test_api_client_id'] = $apiKey; - } - - - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('x-test_api_client_secret'); - if (strlen($apiKey) !== 0) { - $headerParams['x-test_api_client_secret'] = $apiKey; - } - - // make the API Call + // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, 'POST', diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php index 23f682e49430..4882ccd97640 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php @@ -95,11 +95,11 @@ class UserApi * * Create user * - * @param \Swagger\Client\Model\User $body Created user object (optional) + * @param \Swagger\Client\Model\User $body Created user object (required) * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function createUser($body = null) + public function createUser($body) { list($response) = $this->createUserWithHttpInfo ($body); return $response; @@ -111,13 +111,17 @@ class UserApi * * Create user * - * @param \Swagger\Client\Model\User $body Created user object (optional) + * @param \Swagger\Client\Model\User $body Created user object (required) * @return Array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function createUserWithHttpInfo($body = null) + public function createUserWithHttpInfo($body) { + // verify the required parameter 'body' is set + if ($body === null) { + throw new \InvalidArgumentException('Missing the required parameter $body when calling createUser'); + } // parse inputs $resourcePath = "/user"; @@ -125,7 +129,7 @@ class UserApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -171,11 +175,11 @@ class UserApi * * Creates list of users with given input array * - * @param \Swagger\Client\Model\User[] $body List of user object (optional) + * @param \Swagger\Client\Model\User[] $body List of user object (required) * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function createUsersWithArrayInput($body = null) + public function createUsersWithArrayInput($body) { list($response) = $this->createUsersWithArrayInputWithHttpInfo ($body); return $response; @@ -187,13 +191,17 @@ class UserApi * * Creates list of users with given input array * - * @param \Swagger\Client\Model\User[] $body List of user object (optional) + * @param \Swagger\Client\Model\User[] $body List of user object (required) * @return Array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function createUsersWithArrayInputWithHttpInfo($body = null) + public function createUsersWithArrayInputWithHttpInfo($body) { + // verify the required parameter 'body' is set + if ($body === null) { + throw new \InvalidArgumentException('Missing the required parameter $body when calling createUsersWithArrayInput'); + } // parse inputs $resourcePath = "/user/createWithArray"; @@ -201,7 +209,7 @@ class UserApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -247,11 +255,11 @@ class UserApi * * Creates list of users with given input array * - * @param \Swagger\Client\Model\User[] $body List of user object (optional) + * @param \Swagger\Client\Model\User[] $body List of user object (required) * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function createUsersWithListInput($body = null) + public function createUsersWithListInput($body) { list($response) = $this->createUsersWithListInputWithHttpInfo ($body); return $response; @@ -263,13 +271,17 @@ class UserApi * * Creates list of users with given input array * - * @param \Swagger\Client\Model\User[] $body List of user object (optional) + * @param \Swagger\Client\Model\User[] $body List of user object (required) * @return Array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function createUsersWithListInputWithHttpInfo($body = null) + public function createUsersWithListInputWithHttpInfo($body) { + // verify the required parameter 'body' is set + if ($body === null) { + throw new \InvalidArgumentException('Missing the required parameter $body when calling createUsersWithListInput'); + } // parse inputs $resourcePath = "/user/createWithList"; @@ -277,7 +289,7 @@ class UserApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -357,7 +369,7 @@ class UserApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -385,12 +397,7 @@ class UserApi } elseif (count($formParams) > 0) { $httpBody = $formParams; // for HTTP post (form) } - - // this endpoint requires HTTP basic authentication - if (strlen($this->apiClient->getConfig()->getUsername()) !== 0 or strlen($this->apiClient->getConfig()->getPassword()) !== 0) { - $headerParams['Authorization'] = 'Basic ' . base64_encode($this->apiClient->getConfig()->getUsername() . ":" . $this->apiClient->getConfig()->getPassword()); - } - // make the API Call + // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, 'DELETE', @@ -445,7 +452,7 @@ class UserApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -501,12 +508,12 @@ class UserApi * * Logs user into the system * - * @param string $username The user name for login (optional) - * @param string $password The password for login in clear text (optional) + * @param string $username The user name for login (required) + * @param string $password The password for login in clear text (required) * @return string * @throws \Swagger\Client\ApiException on non-2xx response */ - public function loginUser($username = null, $password = null) + public function loginUser($username, $password) { list($response) = $this->loginUserWithHttpInfo ($username, $password); return $response; @@ -518,14 +525,22 @@ class UserApi * * Logs user into the system * - * @param string $username The user name for login (optional) - * @param string $password The password for login in clear text (optional) + * @param string $username The user name for login (required) + * @param string $password The password for login in clear text (required) * @return Array of string, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function loginUserWithHttpInfo($username = null, $password = null) + public function loginUserWithHttpInfo($username, $password) { + // verify the required parameter 'username' is set + if ($username === null) { + throw new \InvalidArgumentException('Missing the required parameter $username when calling loginUser'); + } + // verify the required parameter 'password' is set + if ($password === null) { + throw new \InvalidArgumentException('Missing the required parameter $password when calling loginUser'); + } // parse inputs $resourcePath = "/user/login"; @@ -533,7 +548,7 @@ class UserApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -616,7 +631,7 @@ class UserApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -659,11 +674,11 @@ class UserApi * Updated user * * @param string $username name that need to be deleted (required) - * @param \Swagger\Client\Model\User $body Updated user object (optional) + * @param \Swagger\Client\Model\User $body Updated user object (required) * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function updateUser($username, $body = null) + public function updateUser($username, $body) { list($response) = $this->updateUserWithHttpInfo ($username, $body); return $response; @@ -676,17 +691,21 @@ class UserApi * Updated user * * @param string $username name that need to be deleted (required) - * @param \Swagger\Client\Model\User $body Updated user object (optional) + * @param \Swagger\Client\Model\User $body Updated user object (required) * @return Array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function updateUserWithHttpInfo($username, $body = null) + public function updateUserWithHttpInfo($username, $body) { // verify the required parameter 'username' is set if ($username === null) { throw new \InvalidArgumentException('Missing the required parameter $username when calling updateUser'); } + // verify the required parameter 'body' is set + if ($body === null) { + throw new \InvalidArgumentException('Missing the required parameter $body when calling updateUser'); + } // parse inputs $resourcePath = "/user/{username}"; @@ -694,7 +713,7 @@ class UserApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php index 949603d7d0ae..7bfe30c0ef76 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -67,7 +67,8 @@ class FormatTest implements ArrayAccess 'byte' => 'string', 'binary' => 'string', 'date' => '\DateTime', - 'date_time' => 'string' + 'date_time' => '\DateTime', + 'password' => 'string' ); static function swaggerTypes() { @@ -89,7 +90,8 @@ class FormatTest implements ArrayAccess 'byte' => 'byte', 'binary' => 'binary', 'date' => 'date', - 'date_time' => 'dateTime' + 'date_time' => 'dateTime', + 'password' => 'password' ); static function attributeMap() { @@ -111,7 +113,8 @@ class FormatTest implements ArrayAccess 'byte' => 'setByte', 'binary' => 'setBinary', 'date' => 'setDate', - 'date_time' => 'setDateTime' + 'date_time' => 'setDateTime', + 'password' => 'setPassword' ); static function setters() { @@ -133,7 +136,8 @@ class FormatTest implements ArrayAccess 'byte' => 'getByte', 'binary' => 'getBinary', 'date' => 'getDate', - 'date_time' => 'getDateTime' + 'date_time' => 'getDateTime', + 'password' => 'getPassword' ); static function getters() { @@ -192,9 +196,14 @@ class FormatTest implements ArrayAccess protected $date; /** * $date_time - * @var string + * @var \DateTime */ protected $date_time; + /** + * $password + * @var string + */ + protected $password; /** * Constructor @@ -216,6 +225,7 @@ class FormatTest implements ArrayAccess $this->binary = $data["binary"]; $this->date = $data["date"]; $this->date_time = $data["date_time"]; + $this->password = $data["password"]; } } /** @@ -420,7 +430,7 @@ class FormatTest implements ArrayAccess } /** * Gets date_time - * @return string + * @return \DateTime */ public function getDateTime() { @@ -429,7 +439,7 @@ class FormatTest implements ArrayAccess /** * Sets date_time - * @param string $date_time + * @param \DateTime $date_time * @return $this */ public function setDateTime($date_time) @@ -438,6 +448,26 @@ class FormatTest implements ArrayAccess $this->date_time = $date_time; return $this; } + /** + * Gets password + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets password + * @param string $password + * @return $this + */ + public function setPassword($password) + { + + $this->password = $password; + return $this; + } /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php index a2dfe6009508..7ee5c124d2cd 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -149,7 +149,7 @@ class Order implements ArrayAccess * $complete * @var bool */ - protected $complete; + protected $complete = false; /** * Constructor 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 f70ddf001077..af6b1018332e 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php @@ -72,15 +72,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase */ public function test_addPet() { - } - /** - * Test case for addPetUsingByteArray - * - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - */ - public function test_addPetUsingByteArray() { - } /** * Test case for deletePet @@ -117,24 +108,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase */ public function test_getPetById() { - } - /** - * 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 - * - * Fake endpoint to test byte array return by 'Find pet by ID' - * - */ - public function test_petPetIdtestingByteArraytrueGet() { - } /** * Test case for updatePet 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 2eaf5f5dd111..25fa53169f21 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php @@ -72,15 +72,6 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase */ public function test_deleteOrder() { - } - /** - * Test case for findOrdersByStatus - * - * Finds orders by status - * - */ - public function test_findOrdersByStatus() { - } /** * Test case for getInventory @@ -90,15 +81,6 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase */ public function test_getInventory() { - } - /** - * Test case for getInventoryInObject - * - * Fake endpoint to test arbitrary object return by 'Get inventory' - * - */ - public function test_getInventoryInObject() { - } /** * Test case for getOrderById diff --git a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php index 240f32eca4f9..ea6c307decd0 100644 --- a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php @@ -111,6 +111,10 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $this->assertSame($response->getTags()[0]->getName(), 'test php tag'); } + /* + * comment out as we've removed invalid endpoints from the spec, we'll introduce something + * similar in the future when we've time to update the petstore server + * // test getPetById with a Pet object (id 10005) public function testGetPetByIdInObject() { @@ -133,6 +137,7 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $this->assertSame($response->getTags()[0]->getId(), $pet_id); $this->assertSame($response->getTags()[0]->getName(), 'test php tag'); } + */ // test getPetByIdWithHttpInfo with a Pet object (id 10005) public function testGetPetByIdWithHttpInfo() @@ -274,7 +279,11 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $this->assertSame($response->getId(), $new_pet_id); $this->assertSame($response->getName(), 'PHP Unit Test 2'); } - + + /* + * comment out as we've removed invalid endpoints from the spec, we'll introduce something + * similar in the future when we've time to update the petstore server + * // test addPetUsingByteArray and verify by the "id" and "name" of the response public function testAddPetUsingByteArray() { @@ -310,8 +319,7 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $this->assertSame($response->getId(), $new_pet_id); $this->assertSame($response->getName(), 'PHP Unit Test 3'); } - - + */ // test upload file public function testUploadFile() @@ -322,9 +330,10 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $pet_api = new Swagger\Client\Api\PetApi($api_client); // upload file $pet_id = 10001; - $add_response = $pet_api->uploadFile($pet_id, "test meta", "./composer.json"); - // return nothing (void) - $this->assertSame($add_response, NULL); + $response = $pet_api->uploadFile($pet_id, "test meta", "./composer.json"); + // return ApiResponse + $this->assertInstanceOf('Swagger\Client\Model\ApiResponse', $response); + } // test get inventory @@ -341,7 +350,11 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $this->assertInternalType("int", $get_response['sold']); $this->assertInternalType("int", $get_response['pending']); } - + + /* + * comment out as we've removed invalid endpoints from the spec, we'll introduce something + * similar in the future when we've time to update the petstore server + * // test byte array response public function testGetPetByIdWithByteArray() { @@ -365,6 +378,7 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $this->assertSame($json['tags'][0]['id'], $pet_id); $this->assertSame($json['tags'][0]['name'], 'test php tag'); } + */ // test empty object serialization public function testEmptyPetSerialization() diff --git a/samples/client/petstore/php/SwaggerClient-php/tests/StoreApiTest.php b/samples/client/petstore/php/SwaggerClient-php/tests/StoreApiTest.php index b54416f28a91..378fa5e7e19a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/tests/StoreApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/tests/StoreApiTest.php @@ -47,6 +47,10 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase $this->assertInternalType("int", $get_response['available']); } + /* + * comment out as we've removed invalid endpoints from the spec, we'll introduce something + * similar in the future when we've time to update the petstore server + * // test get inventory public function testGetInventoryInObject() { @@ -60,6 +64,7 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase $this->assertInternalType("array", $get_response); $this->assertInternalType("int", $get_response['available']); } + */ }