001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.juneau.petstore.client; 018 019import java.util.*; 020 021import org.apache.juneau.http.*; 022import org.apache.juneau.http.remote.*; 023import org.apache.juneau.petstore.dto.*; 024 025/** 026 * Typed client view of the petstore pet CRUD surface, consumed via {@code org.apache.juneau.rest.client.RestClient#remote(Class)}. 027 * 028 * <p> 029 * Mirrors the pet endpoints of {@link org.apache.juneau.petstore.rest.PetStoreResource} (mounted at 030 * {@code /petstore} in both the Jetty and Spring Boot deployments). Demonstrates Juneau's REST client consuming 031 * a REST resource written with Juneau's REST server — the client interface and the server resource live in 032 * different modules but share nothing but the wire protocol and the {@link Pet} DTO. 033 * 034 * <h5 class='section'>See Also:</h5><ul> 035 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/RestProxies">REST Proxies</a> 036 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauPetstore">juneau-petstore</a> 037 * </ul> 038 */ 039@Remote(path="/petstore") 040public interface PetStoreClient { 041 042 /** 043 * Lists all pets. 044 * 045 * @return All pets. 046 */ 047 @RemoteGet("/pets") 048 List<Pet> getPets(); 049 050 /** 051 * Retrieves a pet by ID. 052 * 053 * @param id The pet ID. 054 * @return The pet. 055 */ 056 @RemoteGet("/pets/{id}") 057 Pet getPet(@Path("id") long id); 058 059 /** 060 * Creates a new pet. 061 * 062 * @param pet The pet to create. 063 * @return The created pet (with assigned ID). 064 */ 065 @RemotePost("/pets") 066 Pet addPet(@Content Pet pet); 067}