Interface EasyDonateClient

  • All Known Implementing Classes:
    SimpleEasyDonateClient

    public interface EasyDonateClient
    The EasyDonate API client that will be used for all further operations with the platform API.
    Author:
    soknight
    • Method Detail

      • create

        @NotNull
        static @NotNull EasyDonateClient create​(@NotNull
                                                @NotNull String accessKey)
        Create a new EasyDonate API client instance with minimal customization.
        Parameters:
        accessKey - the access key of your shop on the EasyDonate site.
        Returns:
        The created API client instance.
      • create

        @NotNull
        static @NotNull EasyDonateClient create​(@NotNull
                                                @NotNull String accessKey,
                                                @NotNull
                                                @NotNull String userAgent)
        Create a new EasyDonate API client instance using a custom User-Agent.
        Parameters:
        accessKey - the access key of your shop on the EasyDonate site.
        userAgent - the User-Agent header value for all further HTTP requests.
        Returns:
        The created API client instance.
      • create

        @NotNull
        static @NotNull EasyDonateClient create​(@NotNull
                                                @NotNull String accessKey,
                                                long connectTimeout,
                                                long readTimeout,
                                                long writeTimeout)
        Create a new EasyDonate API client instance using a custom timeout values.
        Parameters:
        accessKey - the access key of your shop on the EasyDonate site.
        connectTimeout - the connection establishing timeout.
        readTimeout - the API response awaiting and reading timeout.
        writeTimeout - the API request writing and sending timeout.
        Returns:
        The created API client instance.
      • create

        @NotNull
        static @NotNull EasyDonateClient create​(@NotNull
                                                @NotNull String accessKey,
                                                @NotNull
                                                @NotNull String userAgent,
                                                long connectTimeout,
                                                long readTimeout,
                                                long writeTimeout)
        Create a new EasyDonate API client instance with maximum of customization
        Parameters:
        accessKey - the access key of your shop on the EasyDonate site.
        userAgent - the User-Agent header value for all further HTTP requests.
        connectTimeout - the connection establishing timeout.
        readTimeout - the API response awaiting and reading timeout.
        writeTimeout - the API request writing and sending timeout.
        Returns:
        The created API client instance.
      • builder

        @NotNull
        static EasyDonateClient.Builder builder()
        Create a new EasyDonate API client builder.
        Usage of builder is more visually beautiful, but actually all creation methods uses any builder methods.
        Returns:
        The API client builder instance.
        See Also:
        EasyDonateClient.Builder
      • getAccessKey

        @NotNull
        @NotNull String getAccessKey()
        Get a used access key of any shop.
        Returns:
        The shop access key.
        See Also:
        Shop.Extra.getAccessKey()
      • getHttpClient

        @NotNull
        @NotNull HttpClient getHttpClient()
        Get a used HTTP client implementation that was actually registered.
        Returns:
        The HTTP client implementation.
        See Also:
        HttpClient
      • getJsonSerialization

        @NotNull
        @NotNull JsonSerializationService getJsonSerialization()
        Get a used JSON serialization service implementation that was actually registered.
        Returns:
        The JSON serialization service implementation.
      • createPayment

        @NotNull
        @NotNull PendingPaymentBuilder createPayment()
        Create a new payment to use the EasyDonate platform only for money receiving.
        You can generate a new payment and send the link to needed players in your plugin.
        Returns:
        The pending payment builder instance.
        See Also:
        PendingPaymentBuilder
      • getPluginManager

        @NotNull
        @NotNull PluginManager getPluginManager()
        Get the plugin manager for any plugins related operations performing.
        Returns:
        The plugin manager instance for this shop.
        See Also:
        PluginManager
      • request

        @NotNull
        <T> T request​(@NotNull
                      @NotNull Class<? extends ApiResponse<T>> responseObjectType,
                      @NotNull
                      @NotNull EasyHttpRequest httpRequest)
               throws HttpRequestException,
                      HttpResponseException
        Execute a raw HTTP request and deserialize a response as an object with specified type.
        Type Parameters:
        T - the generic type that represents a response object type.
        Parameters:
        responseObjectType - the type of object to deserialize from.
        httpRequest - the built HTTP request instance to execute.
        Returns:
        The deserialized instance from response for your request.
        Throws:
        HttpRequestException - when any errors with request sending has occured.
        HttpResponseException - when any errors with response handling has occured.
        See Also:
        requestAsync(Class, EasyHttpRequest)
      • requestAsync

        @NotNull
        <T> @NotNull CompletableFuture<T> requestAsync​(@NotNull
                                                       @NotNull Class<? extends ApiResponse<T>> responseObjectType,
                                                       @NotNull
                                                       @NotNull EasyHttpRequest httpRequest)
        Same that request(Class, EasyHttpRequest) but asynchronous.
        Attention! A returned CompletableFuture instance may be completed exceptionally!
        Type Parameters:
        T - the generic type that represents a response object type.
        Parameters:
        responseObjectType - the type of object to deserialize from.
        httpRequest - the built HTTP request instance to execute.
        Returns:
        The future-wrapped deserialized instance from response for your request.
        See Also:
        request(Class, EasyHttpRequest)
      • createRequest

        @NotNull
        EasyHttpRequest.Builder createRequest​(@NotNull
                                              HttpClient.Method method)
        Get a new HTTP request builder using the API client provided HTTP client.
        Parameters:
        method - the HTTP method of a new request.
        Returns:
        The new HTTP request builder instance.