org.swaggertools.demo.web.PetsApi Maven / Gradle / Ivy
package org.swaggertools.demo.web;
import java.lang.Boolean;
import java.lang.Integer;
import java.lang.Long;
import java.util.List;
import javax.validation.Valid;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import org.swaggertools.demo.model.Pet;
@RestController
public interface PetsApi {
@GetMapping("/pets")
List listPets(@RequestParam(name = "limit", required = false) Integer limit);
@PostMapping("/pets")
@ResponseStatus(HttpStatus.CREATED)
Pet createPet(@Valid @RequestBody(required = false) Pet requestBody);
@GetMapping("/pets/{petId}")
Pet getPetById(@PathVariable(name = "petId", required = true) Long petId,
@RequestParam(name = "details", required = false, defaultValue = "false") Boolean details);
@PutMapping("/pets/{petId}")
@ResponseStatus(HttpStatus.NO_CONTENT)
void updatePet(@PathVariable(name = "petId", required = true) Long petId,
@Valid @RequestBody(required = false) Pet requestBody);
@DeleteMapping("/pets/{petId}")
@ResponseStatus(HttpStatus.NO_CONTENT)
void deletePetById(@PathVariable(name = "petId", required = true) Long petId);
@GetMapping(
value = "/pets/{petId}/events",
produces = "text/event-stream"
)
SseEmitter getPetEvents(@PathVariable(name = "petId", required = true) Long petId);
}