From 83567861e0987f731db3ecde4eee20b3f975d036 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sat, 30 Apr 2016 20:15:45 +0800 Subject: [PATCH 1/3] update JS readme to use gitUserId instead --- .../main/resources/Javascript/README.mustache | 4 +- samples/client/petstore/javascript/README.md | 48 +--- .../client/petstore/javascript/docs/PetApi.md | 251 +++--------------- .../petstore/javascript/docs/StoreApi.md | 167 ++---------- .../petstore/javascript/docs/UserApi.md | 60 ++--- .../petstore/javascript/src/ApiClient.js | 5 - .../petstore/javascript/src/api/PetApi.js | 145 +--------- .../petstore/javascript/src/api/StoreApi.js | 86 +----- .../petstore/javascript/src/api/UserApi.js | 2 +- .../client/petstore/javascript/src/index.js | 51 +--- 10 files changed, 101 insertions(+), 718 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Javascript/README.mustache b/modules/swagger-codegen/src/main/resources/Javascript/README.mustache index 37282d5a24c..7136e9f326a 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/README.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/README.mustache @@ -32,11 +32,11 @@ npm install {{{projectName}}} --save #### git # If the library is hosted at a git repository, e.g. -https://github.com/{{#gitUserName}}{{.}}{{/gitUserName}}{{^gitUserName}}YOUR_USERNAME{{/gitUserName}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}{{projectName}}{{/gitRepoId}} +https://github.com/{{#gitUserId}}{{.}}{{/gitUserId}}{{^gitUserId}}YOUR_USERNAME{{/gitUserId}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}{{projectName}}{{/gitRepoId}} then install it via: ```shell -npm install {{#gitUserName}}{{.}}{{/gitUserName}}{{^gitUserName}}YOUR_USERNAME{{/gitUserName}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}{{projectName}}{{/gitRepoId}} --save + npm install {{#gitUserId}}{{.}}{{/gitUserId}}{{^gitUserId}}YOUR_USERNAME{{/gitUserId}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}{{projectName}}{{/gitRepoId}} --save ``` ### For browser diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index c57237d7ceb..3c23ae243f1 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -6,7 +6,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-11T22:17:15.122+08:00 +- Build date: 2016-04-30T20:15:39.280+08:00 - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation @@ -27,11 +27,11 @@ npm install swagger-petstore --save #### git # If the library is hosted at a git repository, e.g. -https://github.com/YOUR_USERNAME/YOUR_GIT_REPO_ID +https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID then install it via: ```shell -npm install YOUR_USERNAME/YOUR_GIT_REPO_ID --save + npm install YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID --save ``` ### For browser @@ -83,20 +83,15 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *SwaggerPetstore.PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store -*SwaggerPetstore.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 *SwaggerPetstore.PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet *SwaggerPetstore.PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *SwaggerPetstore.PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *SwaggerPetstore.PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID -*SwaggerPetstore.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' -*SwaggerPetstore.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' *SwaggerPetstore.PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet *SwaggerPetstore.PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data *SwaggerPetstore.PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image *SwaggerPetstore.StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -*SwaggerPetstore.StoreApi* | [**findOrdersByStatus**](docs/StoreApi.md#findOrdersByStatus) | **GET** /store/findByStatus | Finds orders by status *SwaggerPetstore.StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status -*SwaggerPetstore.StoreApi* | [**getInventoryInObject**](docs/StoreApi.md#getInventoryInObject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' *SwaggerPetstore.StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID *SwaggerPetstore.StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet *SwaggerPetstore.UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user @@ -111,18 +106,9 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [SwaggerPetstore.Animal](docs/Animal.md) - - [SwaggerPetstore.Cat](docs/Cat.md) - [SwaggerPetstore.Category](docs/Category.md) - - [SwaggerPetstore.Dog](docs/Dog.md) - - [SwaggerPetstore.FormatTest](docs/FormatTest.md) - - [SwaggerPetstore.InlineResponse200](docs/InlineResponse200.md) - - [SwaggerPetstore.Model200Response](docs/Model200Response.md) - - [SwaggerPetstore.ModelReturn](docs/ModelReturn.md) - - [SwaggerPetstore.Name](docs/Name.md) - [SwaggerPetstore.Order](docs/Order.md) - [SwaggerPetstore.Pet](docs/Pet.md) - - [SwaggerPetstore.SpecialModelName](docs/SpecialModelName.md) - [SwaggerPetstore.Tag](docs/Tag.md) - [SwaggerPetstore.User](docs/User.md) @@ -130,40 +116,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/javascript/docs/PetApi.md b/samples/client/petstore/javascript/docs/PetApi.md index 35a760e218b..39b8726b0b6 100644 --- a/samples/client/petstore/javascript/docs/PetApi.md +++ b/samples/client/petstore/javascript/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 @@ -32,12 +29,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); var opts = { - 'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store + 'body': new SwaggerPetstore.Pet() // Pet | Pet object that needs to be added to the store }; var callback = function(error, data, response) { @@ -47,7 +44,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.addPet(opts, callback); +apiInstance.addPet(opts, callback); ``` ### Parameters @@ -64,58 +61,6 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml - - -# **addPetUsingByteArray** -> addPetUsingByteArray(opts) - -Fake endpoint to test byte array in body parameter for adding a new pet to the store - - - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" - -var apiInstance = new SwaggerPetstore.PetApi() - -var opts = { - 'body': "B" // {String} Pet object in the form of byte array -}; - -var callback = function(error, data, response) { - if (error) { - console.error(error); - } else { - console.log('API called successfully.'); - } -}; -api.addPetUsingByteArray(opts, callback); -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **String**| Pet object in the form of byte array | [optional] - -### Return type - -null (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - ### HTTP request headers - **Content-Type**: application/json, application/xml @@ -136,14 +81,14 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // {Integer} Pet id to delete +var petId = 789; // Integer | Pet id to delete var opts = { - 'apiKey': "apiKey_example" // {String} + 'apiKey': "apiKey_example" // String | }; var callback = function(error, data, response) { @@ -153,7 +98,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.deletePet(petId, opts, callback); +apiInstance.deletePet(petId, opts, callback); ``` ### Parameters @@ -182,7 +127,7 @@ null (empty response body) Finds Pets by status -Multiple status values can be provided with comma separated strings +Multiple status values can be provided with comma seperated strings ### Example ```javascript @@ -191,12 +136,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); var opts = { - 'status': ["available"] // {[String]} Status values that need to be considered for query + 'status': ["available"] // [String] | Status values that need to be considered for filter }; var callback = function(error, data, response) { @@ -206,14 +151,14 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -api.findPetsByStatus(opts, callback); +apiInstance.findPetsByStatus(opts, callback); ``` ### Parameters 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 | [optional] [default to available] ### Return type @@ -243,12 +188,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); var opts = { - 'tags': ["tags_example"] // {[String]} Tags to filter by + 'tags': ["tags_example"] // [String] | Tags to filter by }; var callback = function(error, data, response) { @@ -258,7 +203,7 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -api.findPetsByTags(opts, callback); +apiInstance.findPetsByTags(opts, callback); ``` ### Parameters @@ -295,17 +240,17 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure API key authorization: api_key var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" +api_key.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" +//api_key.apiKeyPrefix = 'Token'; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // {Integer} ID of pet that needs to be fetched +var petId = 789; // Integer | ID of pet that needs to be fetched var callback = function(error, data, response) { @@ -315,7 +260,7 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -api.getPetById(petId, callback); +apiInstance.getPetById(petId, callback); ``` ### Parameters @@ -332,120 +277,6 @@ Name | Type | Description | Notes [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **getPetByIdInObject** -> InlineResponse200 getPetByIdInObject(petId) - -Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" - -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" - -var apiInstance = new SwaggerPetstore.PetApi() - -var petId = 789; // {Integer} ID of pet that needs to be fetched - - -var callback = function(error, data, response) { - if (error) { - console.error(error); - } else { - console.log('API called successfully. Returned data: ' + data); - } -}; -api.getPetByIdInObject(petId, callback); -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Integer**| ID of pet that needs to be fetched | - -### Return type - -[**InlineResponse200**](InlineResponse200.md) - -### Authorization - -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **petPetIdtestingByteArraytrueGet** -> 'String' petPetIdtestingByteArraytrueGet(petId) - -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 -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" - -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" - -var apiInstance = new SwaggerPetstore.PetApi() - -var petId = 789; // {Integer} ID of pet that needs to be fetched - - -var callback = function(error, data, response) { - if (error) { - console.error(error); - } else { - console.log('API called successfully. Returned data: ' + data); - } -}; -api.petPetIdtestingByteArraytrueGet(petId, callback); -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Integer**| 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 request headers - **Content-Type**: Not defined @@ -466,12 +297,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); var opts = { - 'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store + 'body': new SwaggerPetstore.Pet() // Pet | Pet object that needs to be added to the store }; var callback = function(error, data, response) { @@ -481,7 +312,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.updatePet(opts, callback); +apiInstance.updatePet(opts, callback); ``` ### Parameters @@ -518,15 +349,15 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); -var petId = "petId_example"; // {String} ID of pet that needs to be updated +var petId = "petId_example"; // String | ID of pet that needs to be updated var opts = { - 'name': "name_example", // {String} Updated name of the pet - 'status': "status_example" // {String} Updated status of the pet + 'name': "name_example", // String | Updated name of the pet + 'status': "status_example" // String | Updated status of the pet }; var callback = function(error, data, response) { @@ -536,7 +367,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.updatePetWithForm(petId, opts, callback); +apiInstance.updatePetWithForm(petId, opts, callback); ``` ### Parameters @@ -575,15 +406,15 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // {Integer} ID of pet to update +var petId = 789; // Integer | ID of pet to update var opts = { - 'additionalMetadata': "additionalMetadata_example", // {String} Additional data to pass to server - 'file': "/path/to/file.txt" // {File} file to upload + 'additionalMetadata': "additionalMetadata_example", // String | Additional data to pass to server + 'file': "/path/to/file.txt" // File | file to upload }; var callback = function(error, data, response) { @@ -593,7 +424,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.uploadFile(petId, opts, callback); +apiInstance.uploadFile(petId, opts, callback); ``` ### Parameters diff --git a/samples/client/petstore/javascript/docs/StoreApi.md b/samples/client/petstore/javascript/docs/StoreApi.md index 6ad8406dfc9..563157be5b0 100644 --- a/samples/client/petstore/javascript/docs/StoreApi.md +++ b/samples/client/petstore/javascript/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 @@ -24,9 +22,9 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.StoreApi() +var apiInstance = new SwaggerPetstore.StoreApi(); -var orderId = "orderId_example"; // {String} ID of the order that needs to be deleted +var orderId = "orderId_example"; // String | ID of the order that needs to be deleted var callback = function(error, data, response) { @@ -36,7 +34,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.deleteOrder(orderId, callback); +apiInstance.deleteOrder(orderId, callback); ``` ### Parameters @@ -53,66 +51,6 @@ null (empty response body) No authorization required -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **findOrdersByStatus** -> [Order] findOrdersByStatus(opts) - -Finds orders by status - -A single status value can be provided as a string - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: test_api_client_id -var test_api_client_id = defaultClient.authentications['test_api_client_id']; -test_api_client_id.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_client_id.apiKeyPrefix['x-test_api_client_id'] = "Token" - -// Configure API key authorization: test_api_client_secret -var test_api_client_secret = defaultClient.authentications['test_api_client_secret']; -test_api_client_secret.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token" - -var apiInstance = new SwaggerPetstore.StoreApi() - -var opts = { - 'status': "placed" // {String} Status value that needs to be considered for query -}; - -var callback = function(error, data, response) { - if (error) { - console.error(error); - } else { - console.log('API called successfully. Returned data: ' + data); - } -}; -api.findOrdersByStatus(opts, callback); -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | **String**| Status value that needs to be considered for query | [optional] [default to placed] - -### Return type - -[**[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 request headers - **Content-Type**: Not defined @@ -120,7 +58,7 @@ Name | Type | Description | Notes # **getInventory** -> {'String': 'Integer'} getInventory +> {'String': 'Integer'} getInventory() Returns pet inventories by status @@ -133,11 +71,11 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure API key authorization: api_key var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" +api_key.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" +//api_key.apiKeyPrefix = 'Token'; -var apiInstance = new SwaggerPetstore.StoreApi() +var apiInstance = new SwaggerPetstore.StoreApi(); var callback = function(error, data, response) { if (error) { @@ -146,7 +84,7 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -api.getInventory(callback); +apiInstance.getInventory(callback); ``` ### Parameters @@ -160,53 +98,6 @@ This endpoint does not need any parameter. [api_key](../README.md#api_key) -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **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 -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" - -var apiInstance = new SwaggerPetstore.StoreApi() - -var callback = function(error, data, response) { - if (error) { - console.error(error); - } else { - console.log('API called successfully. Returned data: ' + data); - } -}; -api.getInventoryInObject(callback); -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**Object** - -### Authorization - -[api_key](../README.md#api_key) - ### HTTP request headers - **Content-Type**: Not defined @@ -223,23 +114,10 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ### Example ```javascript var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; -// Configure API key authorization: test_api_key_header -var test_api_key_header = defaultClient.authentications['test_api_key_header']; -test_api_key_header.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_key_header.apiKeyPrefix['test_api_key_header'] = "Token" +var apiInstance = new SwaggerPetstore.StoreApi(); -// Configure API key authorization: test_api_key_query -var test_api_key_query = defaultClient.authentications['test_api_key_query']; -test_api_key_query.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_key_query.apiKeyPrefix['test_api_key_query'] = "Token" - -var apiInstance = new SwaggerPetstore.StoreApi() - -var orderId = "orderId_example"; // {String} ID of pet that needs to be fetched +var orderId = "orderId_example"; // String | ID of pet that needs to be fetched var callback = function(error, data, response) { @@ -249,7 +127,7 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -api.getOrderById(orderId, callback); +apiInstance.getOrderById(orderId, callback); ``` ### Parameters @@ -264,7 +142,7 @@ 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 request headers @@ -282,24 +160,11 @@ Place an order for a pet ### Example ```javascript var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; -// Configure API key authorization: test_api_client_id -var test_api_client_id = defaultClient.authentications['test_api_client_id']; -test_api_client_id.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_client_id.apiKeyPrefix['x-test_api_client_id'] = "Token" - -// Configure API key authorization: test_api_client_secret -var test_api_client_secret = defaultClient.authentications['test_api_client_secret']; -test_api_client_secret.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token" - -var apiInstance = new SwaggerPetstore.StoreApi() +var apiInstance = new SwaggerPetstore.StoreApi(); var opts = { - 'body': new SwaggerPetstore.Order() // {Order} order placed for purchasing the pet + 'body': new SwaggerPetstore.Order() // Order | order placed for purchasing the pet }; var callback = function(error, data, response) { @@ -309,7 +174,7 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -api.placeOrder(opts, callback); +apiInstance.placeOrder(opts, callback); ``` ### Parameters @@ -324,7 +189,7 @@ 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 request headers diff --git a/samples/client/petstore/javascript/docs/UserApi.md b/samples/client/petstore/javascript/docs/UserApi.md index 4e990c89426..5f9faae29b5 100644 --- a/samples/client/petstore/javascript/docs/UserApi.md +++ b/samples/client/petstore/javascript/docs/UserApi.md @@ -26,10 +26,10 @@ This can only be done by the logged in user. ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); var opts = { - 'body': new SwaggerPetstore.User() // {User} Created user object + 'body': new SwaggerPetstore.User() // User | Created user object }; var callback = function(error, data, response) { @@ -39,7 +39,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.createUser(opts, callback); +apiInstance.createUser(opts, callback); ``` ### Parameters @@ -73,10 +73,10 @@ Creates list of users with given input array ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); var opts = { - 'body': [new SwaggerPetstore.User()] // {[User]} List of user object + 'body': [new SwaggerPetstore.User()] // [User] | List of user object }; var callback = function(error, data, response) { @@ -86,7 +86,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.createUsersWithArrayInput(opts, callback); +apiInstance.createUsersWithArrayInput(opts, callback); ``` ### Parameters @@ -120,10 +120,10 @@ Creates list of users with given input array ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); var opts = { - 'body': [new SwaggerPetstore.User()] // {[User]} List of user object + 'body': [new SwaggerPetstore.User()] // [User] | List of user object }; var callback = function(error, data, response) { @@ -133,7 +133,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.createUsersWithListInput(opts, callback); +apiInstance.createUsersWithListInput(opts, callback); ``` ### Parameters @@ -166,16 +166,10 @@ This can only be done by the logged in user. ### Example ```javascript var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; -// Configure HTTP basic authorization: test_http_basic -var test_http_basic = defaultClient.authentications['test_http_basic']; -test_http_basic.username = 'YOUR USERNAME' -test_http_basic.password = 'YOUR PASSWORD' +var apiInstance = new SwaggerPetstore.UserApi(); -var apiInstance = new SwaggerPetstore.UserApi() - -var username = "username_example"; // {String} The name that needs to be deleted +var username = "username_example"; // String | The name that needs to be deleted var callback = function(error, data, response) { @@ -185,7 +179,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.deleteUser(username, callback); +apiInstance.deleteUser(username, callback); ``` ### Parameters @@ -200,7 +194,7 @@ null (empty response body) ### Authorization -[test_http_basic](../README.md#test_http_basic) +No authorization required ### HTTP request headers @@ -219,9 +213,9 @@ Get user by user name ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); -var username = "username_example"; // {String} The name that needs to be fetched. Use user1 for testing. +var username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. var callback = function(error, data, response) { @@ -231,7 +225,7 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -api.getUserByName(username, callback); +apiInstance.getUserByName(username, callback); ``` ### Parameters @@ -265,11 +259,11 @@ Logs user into the system ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); var opts = { - 'username': "username_example", // {String} The user name for login - 'password': "password_example" // {String} The password for login in clear text + 'username': "username_example", // String | The user name for login + 'password': "password_example" // String | The password for login in clear text }; var callback = function(error, data, response) { @@ -279,7 +273,7 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -api.loginUser(opts, callback); +apiInstance.loginUser(opts, callback); ``` ### Parameters @@ -304,7 +298,7 @@ No authorization required # **logoutUser** -> logoutUser +> logoutUser() Logs out current logged in user session @@ -314,7 +308,7 @@ Logs out current logged in user session ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); var callback = function(error, data, response) { if (error) { @@ -323,7 +317,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.logoutUser(callback); +apiInstance.logoutUser(callback); ``` ### Parameters @@ -354,12 +348,12 @@ This can only be done by the logged in user. ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); -var username = "username_example"; // {String} name that need to be deleted +var username = "username_example"; // String | name that need to be deleted var opts = { - 'body': new SwaggerPetstore.User() // {User} Updated user object + 'body': new SwaggerPetstore.User() // User | Updated user object }; var callback = function(error, data, response) { @@ -369,7 +363,7 @@ var callback = function(error, data, response) { console.log('API called successfully.'); } }; -api.updateUser(username, opts, callback); +apiInstance.updateUser(username, opts, callback); ``` ### Parameters diff --git a/samples/client/petstore/javascript/src/ApiClient.js b/samples/client/petstore/javascript/src/ApiClient.js index 2b6c0c5b192..f8c45a6680f 100644 --- a/samples/client/petstore/javascript/src/ApiClient.js +++ b/samples/client/petstore/javascript/src/ApiClient.js @@ -40,12 +40,7 @@ * @type {Array.} */ this.authentications = { - 'test_api_key_header': {type: 'apiKey', 'in': 'header', name: 'test_api_key_header'}, 'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'}, - 'test_http_basic': {type: 'basic'}, - 'test_api_client_secret': {type: 'apiKey', 'in': 'header', name: 'x-test_api_client_secret'}, - 'test_api_client_id': {type: 'apiKey', 'in': 'header', name: 'x-test_api_client_id'}, - 'test_api_key_query': {type: 'apiKey', 'in': 'query', name: 'test_api_key_query'}, 'petstore_auth': {type: 'oauth2'} }; /** diff --git a/samples/client/petstore/javascript/src/api/PetApi.js b/samples/client/petstore/javascript/src/api/PetApi.js index 3bfc6ffd4f0..3e55e3264ba 100644 --- a/samples/client/petstore/javascript/src/api/PetApi.js +++ b/samples/client/petstore/javascript/src/api/PetApi.js @@ -1,18 +1,18 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', '../model/Pet', '../model/InlineResponse200'], factory); + define(['../ApiClient', '../model/Pet'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('../model/Pet'), require('../model/InlineResponse200')); + module.exports = factory(require('../ApiClient'), require('../model/Pet')); } else { // Browser globals (root is window) if (!root.SwaggerPetstore) { root.SwaggerPetstore = {}; } - root.SwaggerPetstore.PetApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Pet, root.SwaggerPetstore.InlineResponse200); + root.SwaggerPetstore.PetApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Pet); } -}(this, function(ApiClient, Pet, InlineResponse200) { +}(this, function(ApiClient, Pet) { 'use strict'; /** @@ -73,47 +73,6 @@ ); } - /** - * Callback function to receive the result of the addPetUsingByteArray operation. - * @callback module:api/PetApi~addPetUsingByteArrayCallback - * @param {String} error Error message, if any. - * @param data This operation does not return a value. - * @param {String} response The complete HTTP response. - */ - - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param {Object} opts Optional parameters - * @param {String} opts.body Pet object in the form of byte array - * @param {module:api/PetApi~addPetUsingByteArrayCallback} callback The callback function, accepting three arguments: error, data, response - */ - this.addPetUsingByteArray = function(opts, callback) { - opts = opts || {}; - var postBody = opts['body']; - - - var pathParams = { - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['petstore_auth']; - var contentTypes = ['application/json', 'application/xml']; - var accepts = ['application/json', 'application/xml']; - var returnType = null; - - return this.apiClient.callApi( - '/pet?testing_byte_array=true', 'POST', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, callback - ); - } - /** * Callback function to receive the result of the deletePet operation. * @callback module:api/PetApi~deletePetCallback @@ -173,9 +132,9 @@ /** * Finds Pets by status - * Multiple status values can be provided with comma separated strings + * Multiple status values can be provided with comma seperated strings * @param {Object} opts Optional parameters - * @param {Array.} opts.status Status values that need to be considered for query (default to available) + * @param {Array.} opts.status Status values that need to be considered for filter (default to available) * @param {module:api/PetApi~findPetsByStatusCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {Array.} */ @@ -295,98 +254,6 @@ ); } - /** - * Callback function to receive the result of the getPetByIdInObject operation. - * @callback module:api/PetApi~getPetByIdInObjectCallback - * @param {String} error Error message, if any. - * @param {module:model/InlineResponse200} data The data returned by the service call. - * @param {String} response The complete HTTP response. - */ - - /** - * 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 - * @param {Integer} petId ID of pet that needs to be fetched - * @param {module:api/PetApi~getPetByIdInObjectCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {module:model/InlineResponse200} - */ - this.getPetByIdInObject = function(petId, callback) { - var postBody = null; - - // verify the required parameter 'petId' is set - if (petId == undefined || petId == null) { - throw "Missing the required parameter 'petId' when calling getPetByIdInObject"; - } - - - var pathParams = { - 'petId': petId - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['api_key', 'petstore_auth']; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = InlineResponse200; - - return this.apiClient.callApi( - '/pet/{petId}?response=inline_arbitrary_object', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, callback - ); - } - - /** - * Callback function to receive the result of the petPetIdtestingByteArraytrueGet operation. - * @callback module:api/PetApi~petPetIdtestingByteArraytrueGetCallback - * @param {String} error Error message, if any. - * @param {'String'} data The data returned by the service call. - * @param {String} response The complete HTTP response. - */ - - /** - * 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 - * @param {Integer} petId ID of pet that needs to be fetched - * @param {module:api/PetApi~petPetIdtestingByteArraytrueGetCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {'String'} - */ - this.petPetIdtestingByteArraytrueGet = function(petId, callback) { - var postBody = null; - - // verify the required parameter 'petId' is set - if (petId == undefined || petId == null) { - throw "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet"; - } - - - var pathParams = { - 'petId': petId - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['api_key', 'petstore_auth']; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = 'String'; - - return this.apiClient.callApi( - '/pet/{petId}?testing_byte_array=true', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, callback - ); - } - /** * Callback function to receive the result of the updatePet operation. * @callback module:api/PetApi~updatePetCallback diff --git a/samples/client/petstore/javascript/src/api/StoreApi.js b/samples/client/petstore/javascript/src/api/StoreApi.js index cdda27abba4..7b965834669 100644 --- a/samples/client/petstore/javascript/src/api/StoreApi.js +++ b/samples/client/petstore/javascript/src/api/StoreApi.js @@ -77,49 +77,6 @@ ); } - /** - * Callback function to receive the result of the findOrdersByStatus operation. - * @callback module:api/StoreApi~findOrdersByStatusCallback - * @param {String} error Error message, if any. - * @param {Array.} data The data returned by the service call. - * @param {String} response The complete HTTP response. - */ - - /** - * Finds orders by status - * A single status value can be provided as a string - * @param {Object} opts Optional parameters - * @param {module:model/String} opts.status Status value that needs to be considered for query (default to placed) - * @param {module:api/StoreApi~findOrdersByStatusCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {Array.} - */ - this.findOrdersByStatus = function(opts, callback) { - opts = opts || {}; - var postBody = null; - - - var pathParams = { - }; - var queryParams = { - 'status': opts['status'] - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['test_api_client_id', 'test_api_client_secret']; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = [Order]; - - return this.apiClient.callApi( - '/store/findByStatus', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, callback - ); - } - /** * Callback function to receive the result of the getInventory operation. * @callback module:api/StoreApi~getInventoryCallback @@ -159,45 +116,6 @@ ); } - /** - * Callback function to receive the result of the getInventoryInObject operation. - * @callback module:api/StoreApi~getInventoryInObjectCallback - * @param {String} error Error message, if any. - * @param {Object} data The data returned by the service call. - * @param {String} response The complete HTTP response. - */ - - /** - * Fake endpoint to test arbitrary object return by 'Get inventory' - * Returns an arbitrary object which is actually a map of status codes to quantities - * @param {module:api/StoreApi~getInventoryInObjectCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {Object} - */ - this.getInventoryInObject = function(callback) { - var postBody = null; - - - var pathParams = { - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['api_key']; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = Object; - - return this.apiClient.callApi( - '/store/inventory?response=arbitrary_object', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType, callback - ); - } - /** * Callback function to receive the result of the getOrderById operation. * @callback module:api/StoreApi~getOrderByIdCallback @@ -232,7 +150,7 @@ var formParams = { }; - var authNames = ['test_api_key_header', 'test_api_key_query']; + var authNames = []; var contentTypes = []; var accepts = ['application/json', 'application/xml']; var returnType = Order; @@ -274,7 +192,7 @@ var formParams = { }; - var authNames = ['test_api_client_id', 'test_api_client_secret']; + var authNames = []; var contentTypes = []; var accepts = ['application/json', 'application/xml']; var returnType = Order; diff --git a/samples/client/petstore/javascript/src/api/UserApi.js b/samples/client/petstore/javascript/src/api/UserApi.js index 30f18bbb755..d865a3e9af1 100644 --- a/samples/client/petstore/javascript/src/api/UserApi.js +++ b/samples/client/petstore/javascript/src/api/UserApi.js @@ -188,7 +188,7 @@ var formParams = { }; - var authNames = ['test_http_basic']; + var authNames = []; var contentTypes = []; var accepts = ['application/json', 'application/xml']; var returnType = null; diff --git a/samples/client/petstore/javascript/src/index.js b/samples/client/petstore/javascript/src/index.js index c29f14094f9..54f3dd19961 100644 --- a/samples/client/petstore/javascript/src/index.js +++ b/samples/client/petstore/javascript/src/index.js @@ -1,12 +1,12 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['./ApiClient', './model/Animal', './model/Cat', './model/Category', './model/Dog', './model/FormatTest', './model/InlineResponse200', './model/Model200Response', './model/ModelReturn', './model/Name', './model/Order', './model/Pet', './model/SpecialModelName', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); + define(['./ApiClient', './model/Category', './model/Order', './model/Pet', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('./ApiClient'), require('./model/Animal'), require('./model/Cat'), require('./model/Category'), require('./model/Dog'), require('./model/FormatTest'), require('./model/InlineResponse200'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); + module.exports = factory(require('./ApiClient'), require('./model/Category'), require('./model/Order'), require('./model/Pet'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); } -}(function(ApiClient, Animal, Cat, Category, Dog, FormatTest, InlineResponse200, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, PetApi, StoreApi, UserApi) { +}(function(ApiClient, Category, Order, Pet, Tag, User, PetApi, StoreApi, UserApi) { 'use strict'; /** @@ -46,51 +46,11 @@ * @property {module:ApiClient} */ ApiClient: ApiClient, - /** - * The Animal model constructor. - * @property {module:model/Animal} - */ - Animal: Animal, - /** - * The Cat model constructor. - * @property {module:model/Cat} - */ - Cat: Cat, /** * The Category model constructor. * @property {module:model/Category} */ Category: Category, - /** - * The Dog model constructor. - * @property {module:model/Dog} - */ - Dog: Dog, - /** - * The FormatTest model constructor. - * @property {module:model/FormatTest} - */ - FormatTest: FormatTest, - /** - * The InlineResponse200 model constructor. - * @property {module:model/InlineResponse200} - */ - InlineResponse200: InlineResponse200, - /** - * The Model200Response model constructor. - * @property {module:model/Model200Response} - */ - Model200Response: Model200Response, - /** - * The ModelReturn model constructor. - * @property {module:model/ModelReturn} - */ - ModelReturn: ModelReturn, - /** - * The Name model constructor. - * @property {module:model/Name} - */ - Name: Name, /** * The Order model constructor. * @property {module:model/Order} @@ -101,11 +61,6 @@ * @property {module:model/Pet} */ Pet: Pet, - /** - * The SpecialModelName model constructor. - * @property {module:model/SpecialModelName} - */ - SpecialModelName: SpecialModelName, /** * The Tag model constructor. * @property {module:model/Tag} From 7f09a86a1e00717c02a8544c9dd5424507e9afa9 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sat, 30 Apr 2016 20:23:35 +0800 Subject: [PATCH 2/3] update wording related to git --- .../codegen/config/CodegenConfigurator.java | 4 +- .../petstore/javascript-promise/README.md | 48 +--- .../javascript-promise/docs/PetApi.md | 226 +++--------------- .../javascript-promise/docs/StoreApi.md | 153 +----------- .../javascript-promise/docs/UserApi.md | 44 ++-- .../petstore/javascript-promise/git_push.sh | 4 +- .../javascript-promise/src/ApiClient.js | 5 - .../javascript-promise/src/api/PetApi.js | 121 +--------- .../javascript-promise/src/api/StoreApi.js | 70 +----- .../javascript-promise/src/api/UserApi.js | 2 +- .../petstore/javascript-promise/src/index.js | 51 +--- samples/client/petstore/javascript/README.md | 6 +- .../client/petstore/javascript/git_push.sh | 4 +- 13 files changed, 88 insertions(+), 650 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/config/CodegenConfigurator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/config/CodegenConfigurator.java index faa2d581533..4ac39d5296f 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/config/CodegenConfigurator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/config/CodegenConfigurator.java @@ -60,8 +60,8 @@ public class CodegenConfigurator { private Map additionalProperties = new HashMap(); private Map importMappings = new HashMap(); private Set languageSpecificPrimitives = new HashSet(); - private String gitUserId="YOUR_GIT_USR_ID"; - private String gitRepoId="YOUR_GIT_REPO_ID"; + private String gitUserId="GIT_USER_ID"; + private String gitRepoId="GIT_REPO_ID"; private String releaseNote="Minor update"; private String httpUserAgent; diff --git a/samples/client/petstore/javascript-promise/README.md b/samples/client/petstore/javascript-promise/README.md index 2b49c2d1519..9c652f5ed62 100644 --- a/samples/client/petstore/javascript-promise/README.md +++ b/samples/client/petstore/javascript-promise/README.md @@ -6,7 +6,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-11T22:19:40.915+08:00 +- Build date: 2016-04-30T20:22:59.696+08:00 - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation @@ -27,11 +27,11 @@ npm install swagger-petstore --save #### git # If the library is hosted at a git repository, e.g. -https://github.com/YOUR_USERNAME/YOUR_GIT_REPO_ID +https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via: ```shell -npm install YOUR_USERNAME/YOUR_GIT_REPO_ID --save + npm install GIT_USER_ID/GIT_REPO_ID --save ``` ### For browser @@ -80,20 +80,15 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *SwaggerPetstore.PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store -*SwaggerPetstore.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 *SwaggerPetstore.PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet *SwaggerPetstore.PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *SwaggerPetstore.PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *SwaggerPetstore.PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID -*SwaggerPetstore.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' -*SwaggerPetstore.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' *SwaggerPetstore.PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet *SwaggerPetstore.PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data *SwaggerPetstore.PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image *SwaggerPetstore.StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -*SwaggerPetstore.StoreApi* | [**findOrdersByStatus**](docs/StoreApi.md#findOrdersByStatus) | **GET** /store/findByStatus | Finds orders by status *SwaggerPetstore.StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status -*SwaggerPetstore.StoreApi* | [**getInventoryInObject**](docs/StoreApi.md#getInventoryInObject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' *SwaggerPetstore.StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID *SwaggerPetstore.StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet *SwaggerPetstore.UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user @@ -108,18 +103,9 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [SwaggerPetstore.Animal](docs/Animal.md) - - [SwaggerPetstore.Cat](docs/Cat.md) - [SwaggerPetstore.Category](docs/Category.md) - - [SwaggerPetstore.Dog](docs/Dog.md) - - [SwaggerPetstore.FormatTest](docs/FormatTest.md) - - [SwaggerPetstore.InlineResponse200](docs/InlineResponse200.md) - - [SwaggerPetstore.Model200Response](docs/Model200Response.md) - - [SwaggerPetstore.ModelReturn](docs/ModelReturn.md) - - [SwaggerPetstore.Name](docs/Name.md) - [SwaggerPetstore.Order](docs/Order.md) - [SwaggerPetstore.Pet](docs/Pet.md) - - [SwaggerPetstore.SpecialModelName](docs/SpecialModelName.md) - [SwaggerPetstore.Tag](docs/Tag.md) - [SwaggerPetstore.User](docs/User.md) @@ -127,40 +113,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/javascript-promise/docs/PetApi.md b/samples/client/petstore/javascript-promise/docs/PetApi.md index 5aecb88ee7c..0a0513875eb 100644 --- a/samples/client/petstore/javascript-promise/docs/PetApi.md +++ b/samples/client/petstore/javascript-promise/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 @@ -32,12 +29,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); var opts = { - 'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store + 'body': new SwaggerPetstore.Pet() // Pet | Pet object that needs to be added to the store }; apiInstance.addPet(opts).then(function() { console.log('API called successfully.'); @@ -61,55 +58,6 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml - - -# **addPetUsingByteArray** -> addPetUsingByteArray(opts) - -Fake endpoint to test byte array in body parameter for adding a new pet to the store - - - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" - -var apiInstance = new SwaggerPetstore.PetApi() - -var opts = { - 'body': "B" // {String} Pet object in the form of byte array -}; -apiInstance.addPetUsingByteArray(opts).then(function() { - console.log('API called successfully.'); -}, function(error) { - console.error(error); -}); - -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **String**| Pet object in the form of byte array | [optional] - -### Return type - -null (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - ### HTTP request headers - **Content-Type**: application/json, application/xml @@ -130,14 +78,14 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // {Integer} Pet id to delete +var petId = 789; // Integer | Pet id to delete var opts = { - 'apiKey': "apiKey_example" // {String} + 'apiKey': "apiKey_example" // String | }; apiInstance.deletePet(petId, opts).then(function() { console.log('API called successfully.'); @@ -173,7 +121,7 @@ null (empty response body) Finds Pets by status -Multiple status values can be provided with comma separated strings +Multiple status values can be provided with comma seperated strings ### Example ```javascript @@ -182,12 +130,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); var opts = { - 'status': ["available"] // {[String]} Status values that need to be considered for query + 'status': ["available"] // [String] | Status values that need to be considered for filter }; apiInstance.findPetsByStatus(opts).then(function(data) { console.log('API called successfully. Returned data: ' + data); @@ -201,7 +149,7 @@ apiInstance.findPetsByStatus(opts).then(function(data) { 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 | [optional] [default to available] ### Return type @@ -231,12 +179,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); var opts = { - 'tags': ["tags_example"] // {[String]} Tags to filter by + 'tags': ["tags_example"] // [String] | Tags to filter by }; apiInstance.findPetsByTags(opts).then(function(data) { console.log('API called successfully. Returned data: ' + data); @@ -280,17 +228,17 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure API key authorization: api_key var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" +api_key.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" +//api_key.apiKeyPrefix = 'Token'; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // {Integer} ID of pet that needs to be fetched +var petId = 789; // Integer | ID of pet that needs to be fetched apiInstance.getPetById(petId).then(function(data) { console.log('API called successfully. Returned data: ' + data); @@ -314,114 +262,6 @@ Name | Type | Description | Notes [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **getPetByIdInObject** -> InlineResponse200 getPetByIdInObject(petId) - -Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" - -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" - -var apiInstance = new SwaggerPetstore.PetApi() - -var petId = 789; // {Integer} ID of pet that needs to be fetched - -apiInstance.getPetByIdInObject(petId).then(function(data) { - console.log('API called successfully. Returned data: ' + data); -}, function(error) { - console.error(error); -}); - -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Integer**| ID of pet that needs to be fetched | - -### Return type - -[**InlineResponse200**](InlineResponse200.md) - -### Authorization - -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **petPetIdtestingByteArraytrueGet** -> 'String' petPetIdtestingByteArraytrueGet(petId) - -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 -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" - -// Configure OAuth2 access token for authorization: petstore_auth -var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" - -var apiInstance = new SwaggerPetstore.PetApi() - -var petId = 789; // {Integer} ID of pet that needs to be fetched - -apiInstance.petPetIdtestingByteArraytrueGet(petId).then(function(data) { - console.log('API called successfully. Returned data: ' + data); -}, function(error) { - console.error(error); -}); - -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Integer**| 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 request headers - **Content-Type**: Not defined @@ -442,12 +282,12 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); var opts = { - 'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store + 'body': new SwaggerPetstore.Pet() // Pet | Pet object that needs to be added to the store }; apiInstance.updatePet(opts).then(function() { console.log('API called successfully.'); @@ -491,15 +331,15 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); -var petId = "petId_example"; // {String} ID of pet that needs to be updated +var petId = "petId_example"; // String | ID of pet that needs to be updated var opts = { - 'name': "name_example", // {String} Updated name of the pet - 'status': "status_example" // {String} Updated status of the pet + 'name': "name_example", // String | Updated name of the pet + 'status': "status_example" // String | Updated status of the pet }; apiInstance.updatePetWithForm(petId, opts).then(function() { console.log('API called successfully.'); @@ -545,15 +385,15 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure OAuth2 access token for authorization: petstore_auth var petstore_auth = defaultClient.authentications['petstore_auth']; -petstore_auth.accessToken = "YOUR ACCESS TOKEN" +petstore_auth.accessToken = 'YOUR ACCESS TOKEN'; -var apiInstance = new SwaggerPetstore.PetApi() +var apiInstance = new SwaggerPetstore.PetApi(); -var petId = 789; // {Integer} ID of pet to update +var petId = 789; // Integer | ID of pet to update var opts = { - 'additionalMetadata': "additionalMetadata_example", // {String} Additional data to pass to server - 'file': "/path/to/file.txt" // {File} file to upload + 'additionalMetadata': "additionalMetadata_example", // String | Additional data to pass to server + 'file': "/path/to/file.txt" // File | file to upload }; apiInstance.uploadFile(petId, opts).then(function() { console.log('API called successfully.'); diff --git a/samples/client/petstore/javascript-promise/docs/StoreApi.md b/samples/client/petstore/javascript-promise/docs/StoreApi.md index d083e46c0db..ce57b57bc4f 100644 --- a/samples/client/petstore/javascript-promise/docs/StoreApi.md +++ b/samples/client/petstore/javascript-promise/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 @@ -24,9 +22,9 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.StoreApi() +var apiInstance = new SwaggerPetstore.StoreApi(); -var orderId = "orderId_example"; // {String} ID of the order that needs to be deleted +var orderId = "orderId_example"; // String | ID of the order that needs to be deleted apiInstance.deleteOrder(orderId).then(function() { console.log('API called successfully.'); @@ -50,63 +48,6 @@ null (empty response body) No authorization required -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **findOrdersByStatus** -> [Order] findOrdersByStatus(opts) - -Finds orders by status - -A single status value can be provided as a string - -### Example -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: test_api_client_id -var test_api_client_id = defaultClient.authentications['test_api_client_id']; -test_api_client_id.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_client_id.apiKeyPrefix['x-test_api_client_id'] = "Token" - -// Configure API key authorization: test_api_client_secret -var test_api_client_secret = defaultClient.authentications['test_api_client_secret']; -test_api_client_secret.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token" - -var apiInstance = new SwaggerPetstore.StoreApi() - -var opts = { - 'status': "placed" // {String} Status value that needs to be considered for query -}; -apiInstance.findOrdersByStatus(opts).then(function(data) { - console.log('API called successfully. Returned data: ' + data); -}, function(error) { - console.error(error); -}); - -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | **String**| Status value that needs to be considered for query | [optional] [default to placed] - -### Return type - -[**[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 request headers - **Content-Type**: Not defined @@ -114,7 +55,7 @@ Name | Type | Description | Notes # **getInventory** -> {'String': 'Integer'} getInventory +> {'String': 'Integer'} getInventory() Returns pet inventories by status @@ -127,11 +68,11 @@ var defaultClient = SwaggerPetstore.ApiClient.default; // Configure API key authorization: api_key var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" +api_key.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" +//api_key.apiKeyPrefix = 'Token'; -var apiInstance = new SwaggerPetstore.StoreApi() +var apiInstance = new SwaggerPetstore.StoreApi(); apiInstance.getInventory().then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { @@ -151,50 +92,6 @@ This endpoint does not need any parameter. [api_key](../README.md#api_key) -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - -# **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 -```javascript -var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; - -// Configure API key authorization: api_key -var api_key = defaultClient.authentications['api_key']; -api_key.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.apiKeyPrefix['api_key'] = "Token" - -var apiInstance = new SwaggerPetstore.StoreApi() -apiInstance.getInventoryInObject().then(function(data) { - console.log('API called successfully. Returned data: ' + data); -}, function(error) { - console.error(error); -}); - -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**Object** - -### Authorization - -[api_key](../README.md#api_key) - ### HTTP request headers - **Content-Type**: Not defined @@ -211,23 +108,10 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ### Example ```javascript var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; -// Configure API key authorization: test_api_key_header -var test_api_key_header = defaultClient.authentications['test_api_key_header']; -test_api_key_header.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_key_header.apiKeyPrefix['test_api_key_header'] = "Token" +var apiInstance = new SwaggerPetstore.StoreApi(); -// Configure API key authorization: test_api_key_query -var test_api_key_query = defaultClient.authentications['test_api_key_query']; -test_api_key_query.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_key_query.apiKeyPrefix['test_api_key_query'] = "Token" - -var apiInstance = new SwaggerPetstore.StoreApi() - -var orderId = "orderId_example"; // {String} ID of pet that needs to be fetched +var orderId = "orderId_example"; // String | ID of pet that needs to be fetched apiInstance.getOrderById(orderId).then(function(data) { console.log('API called successfully. Returned data: ' + data); @@ -249,7 +133,7 @@ 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 request headers @@ -267,24 +151,11 @@ Place an order for a pet ### Example ```javascript var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; -// Configure API key authorization: test_api_client_id -var test_api_client_id = defaultClient.authentications['test_api_client_id']; -test_api_client_id.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_client_id.apiKeyPrefix['x-test_api_client_id'] = "Token" - -// Configure API key authorization: test_api_client_secret -var test_api_client_secret = defaultClient.authentications['test_api_client_secret']; -test_api_client_secret.apiKey = "YOUR API KEY" -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token" - -var apiInstance = new SwaggerPetstore.StoreApi() +var apiInstance = new SwaggerPetstore.StoreApi(); var opts = { - 'body': new SwaggerPetstore.Order() // {Order} order placed for purchasing the pet + 'body': new SwaggerPetstore.Order() // Order | order placed for purchasing the pet }; apiInstance.placeOrder(opts).then(function(data) { console.log('API called successfully. Returned data: ' + data); @@ -306,7 +177,7 @@ 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 request headers diff --git a/samples/client/petstore/javascript-promise/docs/UserApi.md b/samples/client/petstore/javascript-promise/docs/UserApi.md index b68f2e8bffc..99b56e9cf3d 100644 --- a/samples/client/petstore/javascript-promise/docs/UserApi.md +++ b/samples/client/petstore/javascript-promise/docs/UserApi.md @@ -26,10 +26,10 @@ This can only be done by the logged in user. ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); var opts = { - 'body': new SwaggerPetstore.User() // {User} Created user object + 'body': new SwaggerPetstore.User() // User | Created user object }; apiInstance.createUser(opts).then(function() { console.log('API called successfully.'); @@ -70,10 +70,10 @@ Creates list of users with given input array ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); var opts = { - 'body': [new SwaggerPetstore.User()] // {[User]} List of user object + 'body': [new SwaggerPetstore.User()] // [User] | List of user object }; apiInstance.createUsersWithArrayInput(opts).then(function() { console.log('API called successfully.'); @@ -114,10 +114,10 @@ Creates list of users with given input array ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); var opts = { - 'body': [new SwaggerPetstore.User()] // {[User]} List of user object + 'body': [new SwaggerPetstore.User()] // [User] | List of user object }; apiInstance.createUsersWithListInput(opts).then(function() { console.log('API called successfully.'); @@ -157,16 +157,10 @@ This can only be done by the logged in user. ### Example ```javascript var SwaggerPetstore = require('swagger-petstore'); -var defaultClient = SwaggerPetstore.ApiClient.default; -// Configure HTTP basic authorization: test_http_basic -var test_http_basic = defaultClient.authentications['test_http_basic']; -test_http_basic.username = 'YOUR USERNAME' -test_http_basic.password = 'YOUR PASSWORD' +var apiInstance = new SwaggerPetstore.UserApi(); -var apiInstance = new SwaggerPetstore.UserApi() - -var username = "username_example"; // {String} The name that needs to be deleted +var username = "username_example"; // String | The name that needs to be deleted apiInstance.deleteUser(username).then(function() { console.log('API called successfully.'); @@ -188,7 +182,7 @@ null (empty response body) ### Authorization -[test_http_basic](../README.md#test_http_basic) +No authorization required ### HTTP request headers @@ -207,9 +201,9 @@ Get user by user name ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); -var username = "username_example"; // {String} The name that needs to be fetched. Use user1 for testing. +var username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. apiInstance.getUserByName(username).then(function(data) { console.log('API called successfully. Returned data: ' + data); @@ -250,11 +244,11 @@ Logs user into the system ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); var opts = { - 'username': "username_example", // {String} The user name for login - 'password': "password_example" // {String} The password for login in clear text + 'username': "username_example", // String | The user name for login + 'password': "password_example" // String | The password for login in clear text }; apiInstance.loginUser(opts).then(function(data) { console.log('API called successfully. Returned data: ' + data); @@ -286,7 +280,7 @@ No authorization required # **logoutUser** -> logoutUser +> logoutUser() Logs out current logged in user session @@ -296,7 +290,7 @@ Logs out current logged in user session ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); apiInstance.logoutUser().then(function() { console.log('API called successfully.'); }, function(error) { @@ -333,12 +327,12 @@ This can only be done by the logged in user. ```javascript var SwaggerPetstore = require('swagger-petstore'); -var apiInstance = new SwaggerPetstore.UserApi() +var apiInstance = new SwaggerPetstore.UserApi(); -var username = "username_example"; // {String} name that need to be deleted +var username = "username_example"; // String | name that need to be deleted var opts = { - 'body': new SwaggerPetstore.User() // {User} Updated user object + 'body': new SwaggerPetstore.User() // User | Updated user object }; apiInstance.updateUser(username, opts).then(function() { console.log('API called successfully.'); diff --git a/samples/client/petstore/javascript-promise/git_push.sh b/samples/client/petstore/javascript-promise/git_push.sh index 1a36388db02..ed374619b13 100644 --- a/samples/client/petstore/javascript-promise/git_push.sh +++ b/samples/client/petstore/javascript-promise/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/javascript-promise/src/ApiClient.js b/samples/client/petstore/javascript-promise/src/ApiClient.js index da6c506ba64..5ee2b04a14f 100644 --- a/samples/client/petstore/javascript-promise/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise/src/ApiClient.js @@ -40,12 +40,7 @@ * @type {Array.} */ this.authentications = { - 'test_api_key_header': {type: 'apiKey', 'in': 'header', name: 'test_api_key_header'}, 'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'}, - 'test_http_basic': {type: 'basic'}, - 'test_api_client_secret': {type: 'apiKey', 'in': 'header', name: 'x-test_api_client_secret'}, - 'test_api_client_id': {type: 'apiKey', 'in': 'header', name: 'x-test_api_client_id'}, - 'test_api_key_query': {type: 'apiKey', 'in': 'query', name: 'test_api_key_query'}, 'petstore_auth': {type: 'oauth2'} }; /** diff --git a/samples/client/petstore/javascript-promise/src/api/PetApi.js b/samples/client/petstore/javascript-promise/src/api/PetApi.js index 520791b3f0a..1a021ccfcaa 100644 --- a/samples/client/petstore/javascript-promise/src/api/PetApi.js +++ b/samples/client/petstore/javascript-promise/src/api/PetApi.js @@ -1,18 +1,18 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['../ApiClient', '../model/Pet', '../model/InlineResponse200'], factory); + define(['../ApiClient', '../model/Pet'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('../model/Pet'), require('../model/InlineResponse200')); + module.exports = factory(require('../ApiClient'), require('../model/Pet')); } else { // Browser globals (root is window) if (!root.SwaggerPetstore) { root.SwaggerPetstore = {}; } - root.SwaggerPetstore.PetApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Pet, root.SwaggerPetstore.InlineResponse200); + root.SwaggerPetstore.PetApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Pet); } -}(this, function(ApiClient, Pet, InlineResponse200) { +}(this, function(ApiClient, Pet) { 'use strict'; /** @@ -66,39 +66,6 @@ } - /** - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param {Object} opts Optional parameters - * @param {String} opts.body Pet object in the form of byte array - */ - this.addPetUsingByteArray = function(opts) { - opts = opts || {}; - var postBody = opts['body']; - - - var pathParams = { - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['petstore_auth']; - var contentTypes = ['application/json', 'application/xml']; - var accepts = ['application/json', 'application/xml']; - var returnType = null; - - return this.apiClient.callApi( - '/pet?testing_byte_array=true', 'POST', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - } - - /** * Deletes a pet * @@ -142,9 +109,9 @@ /** * Finds Pets by status - * Multiple status values can be provided with comma separated strings + * Multiple status values can be provided with comma seperated strings * @param {Object} opts Optional parameters - * @param {Array.} opts.status Status values that need to be considered for query (default to available) + * @param {Array.} opts.status Status values that need to be considered for filter (default to available) * data is of type: {Array.} */ this.findPetsByStatus = function(opts) { @@ -248,82 +215,6 @@ } - /** - * 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 - * @param {Integer} petId ID of pet that needs to be fetched - * data is of type: {module:model/InlineResponse200} - */ - this.getPetByIdInObject = function(petId) { - var postBody = null; - - // verify the required parameter 'petId' is set - if (petId == undefined || petId == null) { - throw "Missing the required parameter 'petId' when calling getPetByIdInObject"; - } - - - var pathParams = { - 'petId': petId - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['api_key', 'petstore_auth']; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = InlineResponse200; - - return this.apiClient.callApi( - '/pet/{petId}?response=inline_arbitrary_object', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - } - - - /** - * 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 - * @param {Integer} petId ID of pet that needs to be fetched - * data is of type: {'String'} - */ - this.petPetIdtestingByteArraytrueGet = function(petId) { - var postBody = null; - - // verify the required parameter 'petId' is set - if (petId == undefined || petId == null) { - throw "Missing the required parameter 'petId' when calling petPetIdtestingByteArraytrueGet"; - } - - - var pathParams = { - 'petId': petId - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['api_key', 'petstore_auth']; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = 'String'; - - return this.apiClient.callApi( - '/pet/{petId}?testing_byte_array=true', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - } - - /** * Update an existing pet * diff --git a/samples/client/petstore/javascript-promise/src/api/StoreApi.js b/samples/client/petstore/javascript-promise/src/api/StoreApi.js index 77d0276ead0..e5d35fee0ed 100644 --- a/samples/client/petstore/javascript-promise/src/api/StoreApi.js +++ b/samples/client/petstore/javascript-promise/src/api/StoreApi.js @@ -70,41 +70,6 @@ } - /** - * Finds orders by status - * A single status value can be provided as a string - * @param {Object} opts Optional parameters - * @param {module:model/String} opts.status Status value that needs to be considered for query (default to placed) - * data is of type: {Array.} - */ - this.findOrdersByStatus = function(opts) { - opts = opts || {}; - var postBody = null; - - - var pathParams = { - }; - var queryParams = { - 'status': opts['status'] - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['test_api_client_id', 'test_api_client_secret']; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = [Order]; - - return this.apiClient.callApi( - '/store/findByStatus', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - } - - /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -136,37 +101,6 @@ } - /** - * Fake endpoint to test arbitrary object return by 'Get inventory' - * Returns an arbitrary object which is actually a map of status codes to quantities - * data is of type: {Object} - */ - this.getInventoryInObject = function() { - var postBody = null; - - - var pathParams = { - }; - var queryParams = { - }; - var headerParams = { - }; - var formParams = { - }; - - var authNames = ['api_key']; - var contentTypes = []; - var accepts = ['application/json', 'application/xml']; - var returnType = Object; - - return this.apiClient.callApi( - '/store/inventory?response=arbitrary_object', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - } - - /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -192,7 +126,7 @@ var formParams = { }; - var authNames = ['test_api_key_header', 'test_api_key_query']; + var authNames = []; var contentTypes = []; var accepts = ['application/json', 'application/xml']; var returnType = Order; @@ -226,7 +160,7 @@ var formParams = { }; - var authNames = ['test_api_client_id', 'test_api_client_secret']; + var authNames = []; var contentTypes = []; var accepts = ['application/json', 'application/xml']; var returnType = Order; diff --git a/samples/client/petstore/javascript-promise/src/api/UserApi.js b/samples/client/petstore/javascript-promise/src/api/UserApi.js index b2f3e8c16c9..9dfad35ded4 100644 --- a/samples/client/petstore/javascript-promise/src/api/UserApi.js +++ b/samples/client/petstore/javascript-promise/src/api/UserApi.js @@ -156,7 +156,7 @@ var formParams = { }; - var authNames = ['test_http_basic']; + var authNames = []; var contentTypes = []; var accepts = ['application/json', 'application/xml']; var returnType = null; diff --git a/samples/client/petstore/javascript-promise/src/index.js b/samples/client/petstore/javascript-promise/src/index.js index c29f14094f9..54f3dd19961 100644 --- a/samples/client/petstore/javascript-promise/src/index.js +++ b/samples/client/petstore/javascript-promise/src/index.js @@ -1,12 +1,12 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['./ApiClient', './model/Animal', './model/Cat', './model/Category', './model/Dog', './model/FormatTest', './model/InlineResponse200', './model/Model200Response', './model/ModelReturn', './model/Name', './model/Order', './model/Pet', './model/SpecialModelName', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); + define(['./ApiClient', './model/Category', './model/Order', './model/Pet', './model/Tag', './model/User', './api/PetApi', './api/StoreApi', './api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('./ApiClient'), require('./model/Animal'), require('./model/Cat'), require('./model/Category'), require('./model/Dog'), require('./model/FormatTest'), require('./model/InlineResponse200'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/Order'), require('./model/Pet'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); + module.exports = factory(require('./ApiClient'), require('./model/Category'), require('./model/Order'), require('./model/Pet'), require('./model/Tag'), require('./model/User'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); } -}(function(ApiClient, Animal, Cat, Category, Dog, FormatTest, InlineResponse200, Model200Response, ModelReturn, Name, Order, Pet, SpecialModelName, Tag, User, PetApi, StoreApi, UserApi) { +}(function(ApiClient, Category, Order, Pet, Tag, User, PetApi, StoreApi, UserApi) { 'use strict'; /** @@ -46,51 +46,11 @@ * @property {module:ApiClient} */ ApiClient: ApiClient, - /** - * The Animal model constructor. - * @property {module:model/Animal} - */ - Animal: Animal, - /** - * The Cat model constructor. - * @property {module:model/Cat} - */ - Cat: Cat, /** * The Category model constructor. * @property {module:model/Category} */ Category: Category, - /** - * The Dog model constructor. - * @property {module:model/Dog} - */ - Dog: Dog, - /** - * The FormatTest model constructor. - * @property {module:model/FormatTest} - */ - FormatTest: FormatTest, - /** - * The InlineResponse200 model constructor. - * @property {module:model/InlineResponse200} - */ - InlineResponse200: InlineResponse200, - /** - * The Model200Response model constructor. - * @property {module:model/Model200Response} - */ - Model200Response: Model200Response, - /** - * The ModelReturn model constructor. - * @property {module:model/ModelReturn} - */ - ModelReturn: ModelReturn, - /** - * The Name model constructor. - * @property {module:model/Name} - */ - Name: Name, /** * The Order model constructor. * @property {module:model/Order} @@ -101,11 +61,6 @@ * @property {module:model/Pet} */ Pet: Pet, - /** - * The SpecialModelName model constructor. - * @property {module:model/SpecialModelName} - */ - SpecialModelName: SpecialModelName, /** * The Tag model constructor. * @property {module:model/Tag} diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index 3c23ae243f1..e52ef5daae6 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -6,7 +6,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-30T20:15:39.280+08:00 +- Build date: 2016-04-30T20:20:04.619+08:00 - Build package: class io.swagger.codegen.languages.JavascriptClientCodegen ## Installation @@ -27,11 +27,11 @@ npm install swagger-petstore --save #### git # If the library is hosted at a git repository, e.g. -https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID +https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via: ```shell - npm install YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID --save + npm install GIT_USER_ID/GIT_REPO_ID --save ``` ### For browser diff --git a/samples/client/petstore/javascript/git_push.sh b/samples/client/petstore/javascript/git_push.sh index 1a36388db02..ed374619b13 100644 --- a/samples/client/petstore/javascript/git_push.sh +++ b/samples/client/petstore/javascript/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi From 8d9a09efb10650b5998a4f8c99dcf6f6789fc888 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sat, 30 Apr 2016 21:36:25 +0800 Subject: [PATCH 3/3] update JS test case --- .../petstore/javascript-promise/test/ApiClientTest.js | 8 ++++++-- samples/client/petstore/javascript/test/ApiClientTest.js | 8 ++++++-- samples/client/petstore/javascript/test/api/PetApiTest.js | 3 +++ .../client/petstore/javascript/test/api/StoreApiTest.js | 4 ++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/samples/client/petstore/javascript-promise/test/ApiClientTest.js b/samples/client/petstore/javascript-promise/test/ApiClientTest.js index c91fbb03783..085983688bb 100644 --- a/samples/client/petstore/javascript-promise/test/ApiClientTest.js +++ b/samples/client/petstore/javascript-promise/test/ApiClientTest.js @@ -13,7 +13,11 @@ describe('ApiClient', function() { expect(apiClient.basePath).to.be('http://petstore.swagger.io/v2'); expect(apiClient.authentications).to.eql({ petstore_auth: {type: 'oauth2'}, - api_key: {type: 'apiKey', 'in': 'header', name: 'api_key'}, + api_key: {type: 'apiKey', 'in': 'header', name: 'api_key'} + /* comment out the following as these fake security def (testing purpose) + * are removed from the spec, we'll add these back after updating the + * petstore server + * test_http_basic: {type: 'basic'}, test_api_client_id: { type: 'apiKey', @@ -34,7 +38,7 @@ describe('ApiClient', function() { type: 'apiKey', 'in': 'header', name: 'test_api_key_header' - } + }*/ }); }); diff --git a/samples/client/petstore/javascript/test/ApiClientTest.js b/samples/client/petstore/javascript/test/ApiClientTest.js index d259ad54c14..3a8eb843d74 100644 --- a/samples/client/petstore/javascript/test/ApiClientTest.js +++ b/samples/client/petstore/javascript/test/ApiClientTest.js @@ -13,7 +13,11 @@ describe('ApiClient', function() { expect(apiClient.basePath).to.be('http://petstore.swagger.io/v2'); expect(apiClient.authentications).to.eql({ petstore_auth: {type: 'oauth2'}, - api_key: {type: 'apiKey', 'in': 'header', name: 'api_key'}, + api_key: {type: 'apiKey', 'in': 'header', name: 'api_key'} + /* commented out the following as these fake security def (testing purpose) + * has been removed from the spec, we'll add it back after updating the + * petstore server + * test_http_basic: {type: 'basic'}, test_api_client_id: { type: 'apiKey', @@ -34,7 +38,7 @@ describe('ApiClient', function() { type: 'apiKey', 'in': 'header', name: 'test_api_key_header' - } + }*/ }); }); diff --git a/samples/client/petstore/javascript/test/api/PetApiTest.js b/samples/client/petstore/javascript/test/api/PetApiTest.js index d5f7ba3424c..700b30ac505 100644 --- a/samples/client/petstore/javascript/test/api/PetApiTest.js +++ b/samples/client/petstore/javascript/test/api/PetApiTest.js @@ -79,6 +79,8 @@ }); }); + /* commented out the following as the fake endpoint has been removed from the spec + * we'll add it back after updating the Petstore server it('getPetByIdInObject', function(done) { var pet = createRandomPet(); api.addPet({body: pet}, function(error) { @@ -104,6 +106,7 @@ }); }); }); + */ }); })); diff --git a/samples/client/petstore/javascript/test/api/StoreApiTest.js b/samples/client/petstore/javascript/test/api/StoreApiTest.js index 6347148221a..65fb06b3fd0 100644 --- a/samples/client/petstore/javascript/test/api/StoreApiTest.js +++ b/samples/client/petstore/javascript/test/api/StoreApiTest.js @@ -19,6 +19,9 @@ }); describe('StoreApi', function() { + /* commented out the following as the fake endpoint has been removed from the spec + * we'll add it back after updating the petstore server + * it('getInventoryInObject', function(done) { api.getInventoryInObject(function(error, obj) { if (error) throw error; @@ -36,6 +39,7 @@ done(); }); }); + */ }); }));