View Javadoc
1   package ca.uhn.fhir.rest.gclient;
2   
3   import ca.uhn.fhir.rest.api.CacheControlDirective;
4   import ca.uhn.fhir.rest.api.EncodingEnum;
5   import ca.uhn.fhir.rest.api.SummaryEnum;
6   import org.hl7.fhir.instance.model.api.IBaseResource;
7   
8   import java.util.List;
9   
10  /*
11   * #%L
12   * HAPI FHIR - Core Library
13   * %%
14   * Copyright (C) 2014 - 2018 University Health Network
15   * %%
16   * Licensed under the Apache License, Version 2.0 (the "License");
17   * you may not use this file except in compliance with the License.
18   * You may obtain a copy of the License at
19   * 
20   *      http://www.apache.org/licenses/LICENSE-2.0
21   * 
22   * Unless required by applicable law or agreed to in writing, software
23   * distributed under the License is distributed on an "AS IS" BASIS,
24   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25   * See the License for the specific language governing permissions and
26   * limitations under the License.
27   * #L%
28   */
29  
30  
31  public interface IClientExecutable<T extends IClientExecutable<?,Y>, Y> {
32  
33  	/**
34  	 * If set to true, the client will log the request and response to the SLF4J logger. This can be useful for
35  	 * debugging, but is generally not desirable in a production situation.
36  	 * 
37  	 * @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.
38  	 */
39  	@Deprecated
40  	T andLogRequestAndResponse(boolean theLogRequestAndResponse);
41  
42  	/**
43  	 * Sets the <code>Cache-Control</code> header value, which advises the server (or any cache in front of it)
44  	 * how to behave in terms of cached requests
45  	 */
46  	T cacheControl(CacheControlDirective theCacheControlDirective);
47  
48  	/**
49  	 * Request that the server return subsetted resources, containing only the elements specified in the given parameters. 
50  	 * For example: <code>subsetElements("name", "identifier")</code> requests that the server only return
51  	 * the "name" and "identifier" fields in the returned resource, and omit any others.  
52  	 */
53  	T elementsSubset(String... theElements);
54  
55  	T encoded(EncodingEnum theEncoding);
56  
57  	T encodedJson();
58  
59  	T encodedXml();
60  
61  	/**
62  	 * Actually execute the client operation
63  	 */
64  	Y execute();
65  
66  	/**
67  	 * Explicitly specify a custom structure type to attempt to use when parsing the response. This
68  	 * is useful for invocations where the response is a Bundle/Parameters containing nested resources,
69  	 * and you want to use specific custom structures for those nested resources.
70  	 * <p>
71  	 * See <a href="https://jamesagnew.github.io/hapi-fhir/doc_extensions.html">Profiles and Extensions</a> for more information on using custom structures
72  	 * </p>
73  	 */
74  	T preferResponseType(Class<? extends IBaseResource> theType);
75  
76  	/**
77  	 * Explicitly specify a list of custom structure types to attempt to use (in order from most to
78  	 * least preferred) when parsing the response. This
79  	 * is useful for invocations where the response is a Bundle/Parameters containing nested resources,
80  	 * and you want to use specific custom structures for those nested resources.
81  	 * <p>
82  	 * See <a href="https://jamesagnew.github.io/hapi-fhir/doc_extensions.html">Profiles and Extensions</a> for more information on using custom structures
83  	 * </p>
84  	 */
85  	T preferResponseTypes(List<Class<? extends IBaseResource>> theTypes);
86  
87  	T prettyPrint();
88  
89  	/**
90  	 * Request that the server modify the response using the <code>_summary</code> param 
91  	 */
92  	T summaryMode(SummaryEnum theSummary);
93  
94  }