|
| 1 | +package io.swagger.api; |
| 2 | + |
| 3 | +import io.swagger.model.*; |
| 4 | +import io.swagger.api.PetApiService; |
| 5 | +import io.swagger.api.factories.PetApiServiceFactory; |
| 6 | + |
| 7 | +import com.wordnik.swagger.annotations.ApiParam; |
| 8 | + |
| 9 | +import com.sun.jersey.multipart.FormDataParam; |
| 10 | + |
| 11 | +import io.swagger.model.Pet; |
| 12 | +import java.io.File; |
| 13 | + |
| 14 | +import java.util.List; |
| 15 | +import io.swagger.api.NotFoundException; |
| 16 | + |
| 17 | +import java.io.InputStream; |
| 18 | + |
| 19 | +import com.sun.jersey.core.header.FormDataContentDisposition; |
| 20 | +import com.sun.jersey.multipart.FormDataParam; |
| 21 | + |
| 22 | +import javax.ws.rs.core.Response; |
| 23 | +import javax.ws.rs.*; |
| 24 | + |
| 25 | +@Path("/pet") |
| 26 | + |
| 27 | + |
| 28 | +@com.wordnik.swagger.annotations.Api(value = "/pet", description = "the pet API") |
| 29 | +public class PetApi { |
| 30 | + |
| 31 | + private final PetApiService delegate = PetApiServiceFactory.getPetApi(); |
| 32 | + |
| 33 | + @PUT |
| 34 | + |
| 35 | + @Consumes({ "application/json", "application/xml" }) |
| 36 | + @Produces({ "application/json", "application/xml" }) |
| 37 | + @com.wordnik.swagger.annotations.ApiOperation(value = "Update an existing pet", notes = "", response = Void.class) |
| 38 | + @com.wordnik.swagger.annotations.ApiResponses(value = { |
| 39 | + @com.wordnik.swagger.annotations.ApiResponse(code = 405, message = "Validation exception"), |
| 40 | + |
| 41 | + @com.wordnik.swagger.annotations.ApiResponse(code = 404, message = "Pet not found"), |
| 42 | + |
| 43 | + @com.wordnik.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied") }) |
| 44 | + |
| 45 | + public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body) |
| 46 | + throws NotFoundException { |
| 47 | + // do some magic! |
| 48 | + return delegate.updatePet(body); |
| 49 | + } |
| 50 | + @POST |
| 51 | + |
| 52 | + @Consumes({ "application/json", "application/xml" }) |
| 53 | + @Produces({ "application/json", "application/xml" }) |
| 54 | + @com.wordnik.swagger.annotations.ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class) |
| 55 | + @com.wordnik.swagger.annotations.ApiResponses(value = { |
| 56 | + @com.wordnik.swagger.annotations.ApiResponse(code = 405, message = "Invalid input") }) |
| 57 | + |
| 58 | + public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body) |
| 59 | + throws NotFoundException { |
| 60 | + // do some magic! |
| 61 | + return delegate.addPet(body); |
| 62 | + } |
| 63 | + @GET |
| 64 | + @Path("/findByStatus") |
| 65 | + |
| 66 | + @Produces({ "application/json", "application/xml" }) |
| 67 | + @com.wordnik.swagger.annotations.ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma seperated strings", response = Pet.class, responseContainer = "List") |
| 68 | + @com.wordnik.swagger.annotations.ApiResponses(value = { |
| 69 | + @com.wordnik.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), |
| 70 | + |
| 71 | + @com.wordnik.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value") }) |
| 72 | + |
| 73 | + public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", defaultValue="available") @QueryParam("status") List<String> status) |
| 74 | + throws NotFoundException { |
| 75 | + // do some magic! |
| 76 | + return delegate.findPetsByStatus(status); |
| 77 | + } |
| 78 | + @GET |
| 79 | + @Path("/findByTags") |
| 80 | + |
| 81 | + @Produces({ "application/json", "application/xml" }) |
| 82 | + @com.wordnik.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List") |
| 83 | + @com.wordnik.swagger.annotations.ApiResponses(value = { |
| 84 | + @com.wordnik.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), |
| 85 | + |
| 86 | + @com.wordnik.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value") }) |
| 87 | + |
| 88 | + public Response findPetsByTags(@ApiParam(value = "Tags to filter by") @QueryParam("tags") List<String> tags) |
| 89 | + throws NotFoundException { |
| 90 | + // do some magic! |
| 91 | + return delegate.findPetsByTags(tags); |
| 92 | + } |
| 93 | + @GET |
| 94 | + @Path("/{petId}") |
| 95 | + |
| 96 | + @Produces({ "application/json", "application/xml" }) |
| 97 | + @com.wordnik.swagger.annotations.ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.class) |
| 98 | + @com.wordnik.swagger.annotations.ApiResponses(value = { |
| 99 | + @com.wordnik.swagger.annotations.ApiResponse(code = 404, message = "Pet not found"), |
| 100 | + |
| 101 | + @com.wordnik.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), |
| 102 | + |
| 103 | + @com.wordnik.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied") }) |
| 104 | + |
| 105 | + public Response getPetById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathParam("petId") Long petId) |
| 106 | + throws NotFoundException { |
| 107 | + // do some magic! |
| 108 | + return delegate.getPetById(petId); |
| 109 | + } |
| 110 | + @POST |
| 111 | + @Path("/{petId}") |
| 112 | + @Consumes({ "application/x-www-form-urlencoded" }) |
| 113 | + @Produces({ "application/json", "application/xml" }) |
| 114 | + @com.wordnik.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class) |
| 115 | + @com.wordnik.swagger.annotations.ApiResponses(value = { |
| 116 | + @com.wordnik.swagger.annotations.ApiResponse(code = 405, message = "Invalid input") }) |
| 117 | + |
| 118 | + public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathParam("petId") String petId, |
| 119 | + @ApiParam(value = "Updated name of the pet" )@FormParam("name") String name, |
| 120 | + @ApiParam(value = "Updated status of the pet" )@FormParam("status") String status) |
| 121 | + throws NotFoundException { |
| 122 | + // do some magic! |
| 123 | + return delegate.updatePetWithForm(petId,name,status); |
| 124 | + } |
| 125 | + @DELETE |
| 126 | + @Path("/{petId}") |
| 127 | + |
| 128 | + @Produces({ "application/json", "application/xml" }) |
| 129 | + @com.wordnik.swagger.annotations.ApiOperation(value = "Deletes a pet", notes = "", response = Void.class) |
| 130 | + @com.wordnik.swagger.annotations.ApiResponses(value = { |
| 131 | + @com.wordnik.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value") }) |
| 132 | + |
| 133 | + public Response deletePet(@ApiParam(value = "" )@HeaderParam("api_key") String apiKey, |
| 134 | + @ApiParam(value = "Pet id to delete",required=true ) @PathParam("petId") Long petId) |
| 135 | + throws NotFoundException { |
| 136 | + // do some magic! |
| 137 | + return delegate.deletePet(apiKey,petId); |
| 138 | + } |
| 139 | + @POST |
| 140 | + @Path("/{petId}/uploadImage") |
| 141 | + @Consumes({ "multipart/form-data" }) |
| 142 | + @Produces({ "application/json", "application/xml" }) |
| 143 | + @com.wordnik.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = Void.class) |
| 144 | + @com.wordnik.swagger.annotations.ApiResponses(value = { |
| 145 | + @com.wordnik.swagger.annotations.ApiResponse(code = 0, message = "successful operation") }) |
| 146 | + |
| 147 | + public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathParam("petId") Long petId, |
| 148 | + @ApiParam(value = "Additional data to pass to server" )@FormParam("additionalMetadata") String additionalMetadata, |
| 149 | + @ApiParam(value = "file to upload") @FormDataParam("file") InputStream inputStream, |
| 150 | + @ApiParam(value = "file detail") @FormDataParam("file") FormDataContentDisposition fileDetail) |
| 151 | + throws NotFoundException { |
| 152 | + // do some magic! |
| 153 | + return delegate.uploadFile(petId,additionalMetadata,fileDetail); |
| 154 | + } |
| 155 | +} |
| 156 | + |
0 commit comments