Class OkHttpClientHelperKt

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final static OkHttpClient okHttpClient
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final OkHttpClient getOkHttpClient() The default OkHttpClient for ORT to use.
      final static OkHttpClient.Builder addBasicAuthorization(OkHttpClient.Builder $self, String username, String password) Add a request interceptor that injects basic authorization using the username and password into the client builder.
      final static Result<File> downloadFile(OkHttpClient $self, String url, File directory) Download from url and return a Result with a file inside directory that holds the response body content on success, or a Result wrapping an IOException (which might be a HttpDownloadError) on failure.
      final static Result<String> downloadText(OkHttpClient $self, String url) Download from url and return a Result with a string representing the response body content on success, or a Result wrapping an IOException (which might be a HttpDownloadError) on failure.
      final static Result<Pair<Response, ResponseBody>> download(OkHttpClient $self, String url, String acceptEncoding) Download from url with optional acceptEncoding and return a Result with the Response and non-nullable ResponseBody on success, or a Result wrapping an IOException (which might be a HttpDownloadError) on failure.
      final static Response ping(OkHttpClient $self, String url) Execute a HEAD-request against url to ping for its existence.
      final static Response execute(OkHttpClient $self, Request request) Execute a request using the client.
      final static Response await(OkHttpClient $self, Request request) Asynchronously enqueue a request using the client and await its response.
      final static Response await(Call $self) Asynchronously enqueue the Call's request and await its Response.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • getOkHttpClient

         final OkHttpClient getOkHttpClient()

        The default OkHttpClient for ORT to use.

      • addBasicAuthorization

         final static OkHttpClient.Builder addBasicAuthorization(OkHttpClient.Builder $self, String username, String password)

        Add a request interceptor that injects basic authorization using the username and password into the client builder.

      • ping

         final static Response ping(OkHttpClient $self, String url)

        Execute a HEAD-request against url to ping for its existence.

      • execute

         final static Response execute(OkHttpClient $self, Request request)

        Execute a request using the client.

      • await

         final static Response await(OkHttpClient $self, Request request)

        Asynchronously enqueue a request using the client and await its response.

      • await

         final static Response await(Call $self)

        Asynchronously enqueue the Call's request and await its Response.