/* * Swagger Petstore * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ public class SwagPetApi { SwagClient client; public SwagPetApi(SwagClient client) { this.client = client; } public SwagPetApi() { this.client = new SwagClient(); } public SwagClient getClient() { return this.client; } /** * Add a new pet to the store * * @param body Pet object that needs to be added to the store (required) * @throws Swagger.ApiException if fails to make API call */ public void addPet(Map params) { client.assertNotNull(params.get('body'), 'body'); List query = new List(); List form = new List(); client.invoke( 'POST', '/pet', (SwagPet) params.get('body'), query, form, new Map(), new Map(), new List{ 'application/json' }, new List{ 'application/json' }, new List { 'petstore_auth' }, null ); } /** * Deletes a pet * * @param petId Pet id to delete (required) * @param apiKey (optional) * @throws Swagger.ApiException if fails to make API call */ public void deletePet(Map params) { client.assertNotNull(params.get('petId'), 'petId'); List query = new List(); List form = new List(); client.invoke( 'DELETE', '/pet/{petId}', '', query, form, new Map{ 'petId' => (Long) params.get('petId') }, new Map{ 'api_key' => (String) params.get('apiKey') }, new List{ 'application/json' }, new List{ 'application/json' }, new List { 'petstore_auth' }, null ); } /** * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter (required) * @return List * @throws Swagger.ApiException if fails to make API call */ public List findPetsByStatus(Map params) { client.assertNotNull(params.get('status'), 'status'); List query = new List(); // cast query params to verify their expected type query.addAll(client.makeParam('status', (List) params.get('status'), 'csv')); List form = new List(); return (List) client.invoke( 'GET', '/pet/findByStatus', '', query, form, new Map(), new Map(), new List{ 'application/json' }, new List{ 'application/json' }, new List { 'petstore_auth' }, List.class ); } /** * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by (required) * @return List * @throws Swagger.ApiException if fails to make API call */ public List findPetsByTags(Map params) { client.assertNotNull(params.get('tags'), 'tags'); List query = new List(); // cast query params to verify their expected type query.addAll(client.makeParam('tags', (List) params.get('tags'), 'csv')); List form = new List(); return (List) client.invoke( 'GET', '/pet/findByTags', '', query, form, new Map(), new Map(), new List{ 'application/json' }, new List{ 'application/json' }, new List { 'petstore_auth' }, List.class ); } /** * Find pet by ID * Returns a single pet * @param petId ID of pet to return (required) * @return SwagPet * @throws Swagger.ApiException if fails to make API call */ public SwagPet getPetById(Map params) { client.assertNotNull(params.get('petId'), 'petId'); List query = new List(); List form = new List(); return (SwagPet) client.invoke( 'GET', '/pet/{petId}', '', query, form, new Map{ 'petId' => (Long) params.get('petId') }, new Map(), new List{ 'application/json' }, new List{ 'application/json' }, new List { 'api_key' }, SwagPet.class ); } /** * Update an existing pet * * @param body Pet object that needs to be added to the store (required) * @throws Swagger.ApiException if fails to make API call */ public void updatePet(Map params) { client.assertNotNull(params.get('body'), 'body'); List query = new List(); List form = new List(); client.invoke( 'PUT', '/pet', (SwagPet) params.get('body'), query, form, new Map(), new Map(), new List{ 'application/json' }, new List{ 'application/json' }, new List { 'petstore_auth' }, null ); } /** * Updates a pet in the store with form data * * @param petId ID of pet that needs to be updated (required) * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @throws Swagger.ApiException if fails to make API call */ public void updatePetWithForm(Map params) { client.assertNotNull(params.get('petId'), 'petId'); List query = new List(); List form = new List(); // cast form params to verify their expected type form.addAll(client.makeParam('name', (String) params.get('name'))); form.addAll(client.makeParam('status', (String) params.get('status'))); client.invoke( 'POST', '/pet/{petId}', '', query, form, new Map{ 'petId' => (Long) params.get('petId') }, new Map(), new List{ 'application/json' }, new List{ 'application/x-www-form-urlencoded' }, new List { 'petstore_auth' }, null ); } /** * uploads an image * * @param petId ID of pet to update (required) * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return SwagApiResponse * @throws Swagger.ApiException if fails to make API call */ public SwagApiResponse uploadFile(Map params) { client.assertNotNull(params.get('petId'), 'petId'); List query = new List(); List form = new List(); // cast form params to verify their expected type form.addAll(client.makeParam('additionalMetadata', (String) params.get('additionalMetadata'))); form.addAll(client.makeParam('file', (Blob) params.get('file'))); return (SwagApiResponse) client.invoke( 'POST', '/pet/{petId}/uploadImage', '', query, form, new Map{ 'petId' => (Long) params.get('petId') }, new Map(), new List{ 'application/json' }, new List{ 'application/x-www-form-urlencoded' }, new List { 'petstore_auth' }, SwagApiResponse.class ); } }