All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.swaggertools.demo.web.PetsApi Maven / Gradle / Ivy

The newest version!
package org.swaggertools.demo.web;

import java.lang.Boolean;
import java.lang.Integer;
import java.lang.Long;
import java.lang.String;
import java.lang.Void;
import java.util.List;
import org.springframework.http.HttpStatus;
import org.springframework.http.codec.ServerSentEvent;
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.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.swaggertools.demo.model.Pet;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

@RestController
public interface PetsApi {
    @GetMapping("/pets")
    Mono> listPets(@RequestParam(name = "limit", required = false) Integer limit);

    @PostMapping("/pets")
    @ResponseStatus(HttpStatus.CREATED)
    Mono createPet(@RequestBody(required = false) Pet requestBody);

    @GetMapping("/pets/{petId}")
    Mono getPetById(@PathVariable(name = "petId", required = true) Long petId,
            @RequestParam(name = "details", required = false, defaultValue = "false") Boolean details,
            @RequestHeader(name = "userId", required = false) String userId);

    @PutMapping("/pets/{petId}")
    @ResponseStatus(HttpStatus.NO_CONTENT)
    Mono updatePet(@PathVariable(name = "petId", required = true) Long petId,
            @RequestBody(required = false) Pet requestBody);

    @DeleteMapping("/pets/{petId}")
    @ResponseStatus(HttpStatus.NO_CONTENT)
    Mono deletePetById(@PathVariable(name = "petId", required = true) Long petId);

    @PostMapping("/pets/bulk")
    Mono> createPets(@RequestBody(required = true) List requestBody);

    @GetMapping(
            value = "/pets/{petId}/events",
            produces = "text/event-stream"
    )
    Flux getPetEvents(@PathVariable(name = "petId", required = true) Long petId,
            @RequestHeader(name = "Last-Event-Id", required = false) String lastEventId);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy