How to actually use an okhttp client
what i need is to build a com.meilisearch.sdk.Client that uses OkHttp and jackson whenever it makes requests
I read the example on OkHttp in the documentation (and in the test source), but don't understand where to use the resulting serviceTemplate.
Thank you
Config config = new Config("http://localhost:7700", "masterKey");
HttpAsyncClient client = HttpAsyncClients.createDefault();
ApacheHttpClient client = new ApacheHttpClient(config, client);
private final JsonHandler jsonHandler = new JacksonJsonHandler(new ObjectMapper());
private final RequestFactory requestFactory = new BasicRequestFactory(jsonHandler);
private final GenericServiceTemplate serviceTemplate = new GenericServiceTemplate(client, jsonHandler, requestFactory);
private final ServiceTemplate serviceTemplate;
serviceTemplate.getProcessor().encode("your_data");
```
Hi @tropikoder, Very sorry for the delay of answer. This part of the code was added a long time ago by a contributor to refactor the SDK; it was designed to create customizable handlers for each class such as :
private final IndexHandler indexHandler = new IndexHandler(serviceTemplate, serviceTemplate.getRequestFactory());
But the final code was never merged so this part of the code is not fully functional. A big refactoring of the SDK is planned with only the use of the OkHttp client and will be available in a few weeks if all goes well. I'm not sure if my answer will help you a lot...
Close due to merge of #425