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