001package ca.uhn.fhir.rest.gclient;
002
003import ca.uhn.fhir.rest.api.EncodingEnum;
004import ca.uhn.fhir.rest.api.SummaryEnum;
005import org.hl7.fhir.instance.model.api.IBaseResource;
006
007import java.util.List;
008
009/*
010 * #%L
011 * HAPI FHIR - Core Library
012 * %%
013 * Copyright (C) 2014 - 2017 University Health Network
014 * %%
015 * Licensed under the Apache License, Version 2.0 (the "License");
016 * you may not use this file except in compliance with the License.
017 * You may obtain a copy of the License at
018 * 
019 *      http://www.apache.org/licenses/LICENSE-2.0
020 * 
021 * Unless required by applicable law or agreed to in writing, software
022 * distributed under the License is distributed on an "AS IS" BASIS,
023 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
024 * See the License for the specific language governing permissions and
025 * limitations under the License.
026 * #L%
027 */
028
029
030public interface IClientExecutable<T extends IClientExecutable<?,Y>, Y> {
031
032        /**
033         * If set to true, the client will log the request and response to the SLF4J logger. This can be useful for
034         * debugging, but is generally not desirable in a production situation.
035         * 
036         * @deprecated Use the client logging interceptor to log requests and responses instead. See <a href="http://jamesagnew.github.io/hapi-fhir/doc_rest_client.html#req_resp_logging">here</a> for more information.
037         */
038        @Deprecated
039        T andLogRequestAndResponse(boolean theLogRequestAndResponse);
040
041        /**
042         * Request that the server return subsetted resources, containing only the elements specified in the given parameters. 
043         * For example: <code>subsetElements("name", "identifier")</code> requests that the server only return
044         * the "name" and "identifier" fields in the returned resource, and omit any others.  
045         */
046        T elementsSubset(String... theElements);
047
048        T encoded(EncodingEnum theEncoding);
049
050        T encodedJson();
051
052        T encodedXml();
053
054        /**
055         * Actually execute the client operation
056         */
057        Y execute();
058
059        /**
060         * Explicitly specify a custom structure type to attempt to use when parsing the response. This
061         * is useful for invocations where the response is a Bundle/Parameters containing nested resources,
062         * and you want to use specific custom structures for those nested resources.
063         * <p>
064         * See <a href="https://jamesagnew.github.io/hapi-fhir/doc_extensions.html">Profiles and Extensions</a> for more information on using custom structures
065         * </p>
066         */
067        T preferResponseType(Class<? extends IBaseResource> theType);
068
069        /**
070         * Explicitly specify a list of custom structure types to attempt to use (in order from most to
071         * least preferred) when parsing the response. This
072         * is useful for invocations where the response is a Bundle/Parameters containing nested resources,
073         * and you want to use specific custom structures for those nested resources.
074         * <p>
075         * See <a href="https://jamesagnew.github.io/hapi-fhir/doc_extensions.html">Profiles and Extensions</a> for more information on using custom structures
076         * </p>
077         */
078        T preferResponseTypes(List<Class<? extends IBaseResource>> theTypes);
079
080        T prettyPrint();
081
082        /**
083         * Request that the server modify the response using the <code>_summary</code> param 
084         */
085        T summaryMode(SummaryEnum theSummary);
086
087}