title: Should I use retrofit with a singleton?
body: <p>I'm new to retrofit and want to know what's the best practice.</p>
  
  <p>Here is some abstracted code that I found online:</p>
  
  <pre><code>public class RestClient
  
  {
      private static final String BASE_URL = "your base url";
      private ApiService apiService;
  
      public RestClient()
      {
          Gson gson = new GsonBuilder()
                  .registerTypeAdapterFactory(new ItemTypeAdapterFactory()) // This is the important line ;)
                  .setDateFormat("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'SSS'Z'")
                  .create();
  
          RestAdapter restAdapter = new RestAdapter.Builder()
                  .setLogLevel(RestAdapter.LogLevel.FULL)
                  .setEndpoint(BASE_URL)
                  .setConverter(new GsonConverter(gson))
                  .setRequestInterceptor(new SessionRequestInterceptor())
                  .build();
  
          apiService = restAdapter.create(ApiService.class);
      }
  
      public ApiService getApiService()
      {
          return apiService;
      }
  }
  </code></pre>
  
  <p>and lets say I want to make a api request/call with this function</p>
  
  <pre><code>RestClient restClient = new RestClient();
  restClient.getApiService().getPosts();
  </code></pre>
  
  <p>My question is should I make a new restClient object or this should be a singleton, or the ApiService should be a singleton.</p>
  
  <p>What's the best practice? Please keep in mind that I don't want to use dependency injection, I just want to understand how best to use retrofit. </p>
  
  <p>How would some of you make this call?</p>