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

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

There is a newer version: 0.5.6
Show 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.util.List;
import java.util.Map;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.ResponseExtractor;
import org.springframework.web.client.RestTemplate;
import org.swaggertools.demo.model.Pet;

public class PetsClient extends BaseClient {
    public PetsClient(RestTemplate restTemplate) {
        super(restTemplate);
    }

    public PetsClient(RestTemplate restTemplate, String basePath) {
        super(restTemplate, basePath);
    }

    public PetsClient(RestTemplate restTemplate, String basePath,
            Map> headers) {
        super(restTemplate, basePath, headers);
    }

    public List listPets(Integer limit) {
        ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>(){};
        ResponseEntity> response = invokeAPI("/pets", "GET", createUrlVariables(), createQueryParameters("limit", limit), null, typeRef);
        return response.getBody();
    }

    public Pet createPet(Pet requestBody) {
        ParameterizedTypeReference typeRef = new ParameterizedTypeReference(){};
        ResponseEntity response = invokeAPI("/pets", "POST", createUrlVariables(), createQueryParameters(), requestBody, typeRef);
        return response.getBody();
    }

    public Pet getPetById(Long petId, Boolean details) {
        ParameterizedTypeReference typeRef = new ParameterizedTypeReference(){};
        ResponseEntity response = invokeAPI("/pets/{petId}", "GET", createUrlVariables("petId", petId), createQueryParameters("details", details), null, typeRef);
        return response.getBody();
    }

    public void updatePet(Long petId, Pet requestBody) {
        ParameterizedTypeReference typeRef = VOID;
        invokeAPI("/pets/{petId}", "PUT", createUrlVariables("petId", petId), createQueryParameters(), requestBody, typeRef);
    }

    public void deletePetById(Long petId) {
        ParameterizedTypeReference typeRef = VOID;
        invokeAPI("/pets/{petId}", "DELETE", createUrlVariables("petId", petId), createQueryParameters(), null, typeRef);
    }

    public void getPetEvents(Long petId, ResponseExtractor responseExtractor) {
        executeAPI("/pets/{petId}/events", "GET", createUrlVariables("petId", petId), createQueryParameters(), null, responseExtractor);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy