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

org.swaggertools.demo.client.PetsClient Maven / Gradle / Ivy

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

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 java.util.Map;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.codec.ServerSentEvent;
import org.springframework.web.reactive.function.client.WebClient;
import org.swaggertools.demo.model.Pet;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

public class PetsClient extends BaseClient {
    public PetsClient(WebClient webClient) {
        super(webClient);
    }

    public PetsClient(WebClient webClient, String basePath) {
        super(webClient, basePath);
    }

    public PetsClient(WebClient webClient, String basePath, Map> headers) {
        super(webClient, basePath, headers);
    }

    public Mono> listPets(Integer limit) {
        ParameterizedTypeReference> responseType = new ParameterizedTypeReference>(){};
        return invokeAPI("/pets", "GET", createUrlVariables(), createQueryParameters("limit", limit), createQueryParameters(), null, null).flatMap(e -> mapResponse(e, responseType));
    }

    public Mono createPet(Pet requestBody) {
        ParameterizedTypeReference requestType = new ParameterizedTypeReference(){};
        ParameterizedTypeReference responseType = new ParameterizedTypeReference(){};
        return invokeAPI("/pets", "POST", createUrlVariables(), createQueryParameters(), createQueryParameters(), requestBody, requestType).flatMap(e -> mapResponse(e, responseType));
    }

    public Mono getPetById(Long petId, Boolean details, String userId) {
        ParameterizedTypeReference responseType = new ParameterizedTypeReference(){};
        return invokeAPI("/pets/{petId}", "GET", createUrlVariables("petId", petId), createQueryParameters("details", details), createQueryParameters("userId", userId), null, null).flatMap(e -> mapResponse(e, responseType));
    }

    public Mono updatePet(Long petId, Pet requestBody) {
        ParameterizedTypeReference requestType = new ParameterizedTypeReference(){};
        ParameterizedTypeReference responseType = VOID;
        return invokeAPI("/pets/{petId}", "PUT", createUrlVariables("petId", petId), createQueryParameters(), createQueryParameters(), requestBody, requestType).flatMap(e -> mapResponse(e, responseType));
    }

    public Mono deletePetById(Long petId) {
        ParameterizedTypeReference responseType = VOID;
        return invokeAPI("/pets/{petId}", "DELETE", createUrlVariables("petId", petId), createQueryParameters(), createQueryParameters(), null, null).flatMap(e -> mapResponse(e, responseType));
    }

    public Mono> createPets(List requestBody) {
        ParameterizedTypeReference> requestType = new ParameterizedTypeReference>(){};
        ParameterizedTypeReference> responseType = new ParameterizedTypeReference>(){};
        return invokeAPI("/pets/bulk", "POST", createUrlVariables(), createQueryParameters(), createQueryParameters(), requestBody, requestType).flatMap(e -> mapResponse(e, responseType));
    }

    public Flux getPetEvents(Long petId, String lastEventId) {
        ParameterizedTypeReference responseType = new ParameterizedTypeReference(){};
        return invokeAPI("/pets/{petId}/events", "GET", createUrlVariables("petId", petId), createQueryParameters(), createQueryParameters("Last-Event-Id", lastEventId), null, null).flatMapMany(e -> e.bodyToFlux(responseType));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy