Interface EasyDonateClient
-
- All Known Implementing Classes:
SimpleEasyDonateClient
public interface EasyDonateClientThe EasyDonate API client that will be used for all further operations with the platform API.- Author:
- soknight
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceEasyDonateClient.BuilderThe EasyDonate API client instance builder.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static EasyDonateClient.Builderbuilder()Create a new EasyDonate API client builder.
Usage of builder is more visually beautiful, but actually all creation methods uses any builder methods.static @NotNull EasyDonateClientcreate(@NotNull String accessKey)Create a new EasyDonate API client instance with minimal customization.static @NotNull EasyDonateClientcreate(@NotNull String accessKey, long connectTimeout, long readTimeout, long writeTimeout)Create a new EasyDonate API client instance using a custom timeout values.static @NotNull EasyDonateClientcreate(@NotNull String accessKey, @NotNull String userAgent)Create a new EasyDonate API client instance using a custom User-Agent.static @NotNull EasyDonateClientcreate(@NotNull String accessKey, @NotNull String userAgent, long connectTimeout, long readTimeout, long writeTimeout)Create a new EasyDonate API client instance with maximum of customization@NotNull PendingPaymentBuildercreatePayment()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.@NotNull PendingPaymentcreatePayment(@NotNull PendingPaymentBuilder paymentBuilder)Get the pending payment data using your credentials from pending payment builder.
This method also will be used byPendingPaymentBuilder.create().EasyHttpRequest.BuildercreateRequest(HttpClient.Method method)Get a new HTTP request builder using the API client provided HTTP client.@NotNull StringgetAccessKey()Get a used access key of any shop.@NotNull CouponsListgetCouponsList()Get the list of all coupons.@NotNull CouponsListgetCouponsList(@NotNull ActivityFlag activityFlag)Get the list of all coupons with the activity filter.@NotNull HttpClientgetHttpClient()Get a used HTTP client implementation that was actually registered.@NotNull JsonSerializationServicegetJsonSerialization()Get a used JSON serialization service implementation that was actually registered.@NotNull MassSalesListgetMassSalesList()Get the list of all mass sales.@NotNull MassSalesListgetMassSalesList(@NotNull ActivityFlag activityFlag)Get the list of all mass sales with the activity filter.@NotNull PaymentgetPayment(int paymentId)Get the payment by the #ID.@NotNull PaymentsListgetPaymentsList()Get the list of all finished payments.@NotNull PluginManagergetPluginManager()Get the plugin manager for any plugins related operations performing.@NotNull ProductgetProduct(int productId)Get the shop product by the #ID.@NotNull ProductsListgetProductsList()Get the list of all shop products.@NotNull ServergetServer(int serverId)Get the shop connected server by the #ID.@NotNull ServersListgetServersList()Get the list of all shop connected servers.@NotNull ShopgetShop()Get the shop related data.<T> Trequest(@NotNull Class<? extends ApiResponse<T>> responseObjectType, @NotNull EasyHttpRequest httpRequest)Execute a raw HTTP request and deserialize a response as an object with specified type.<T> @NotNull CompletableFuture<T>requestAsync(@NotNull Class<? extends ApiResponse<T>> responseObjectType, @NotNull EasyHttpRequest httpRequest)Same thatrequest(Class, EasyHttpRequest)but asynchronous.
-
-
-
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.
-
getShop
@NotNull @NotNull Shop getShop() throws HttpRequestException, HttpResponseException
Get the shop related data.- Returns:
- The shop describing object.
- Throws:
HttpRequestException- when any errors with request sending has occured.HttpResponseException- when any errors with response handling has occured.- See Also:
Shop
-
getProduct
@NotNull @NotNull Product getProduct(int productId) throws HttpRequestException, HttpResponseException
Get the shop product by the #ID.- Parameters:
productId- the ID of requested product.- Returns:
- The product describing object.
- Throws:
HttpRequestException- when any errors with request sending has occured.HttpResponseException- when any errors with response handling has occured.- See Also:
Product
-
getProductsList
@NotNull @NotNull ProductsList getProductsList() throws HttpRequestException, HttpResponseException
Get the list of all shop products.- Returns:
- The list of products.
- Throws:
HttpRequestException- when any errors with request sending has occured.HttpResponseException- when any errors with response handling has occured.- See Also:
Product
-
getServer
@NotNull @NotNull Server getServer(int serverId) throws HttpRequestException, HttpResponseException
Get the shop connected server by the #ID.- Parameters:
serverId- the ID of requested connected server.- Returns:
- The connected server describing object.
- Throws:
HttpRequestException- when any errors with request sending has occured.HttpResponseException- when any errors with response handling has occured.- See Also:
Server
-
getServersList
@NotNull @NotNull ServersList getServersList() throws HttpRequestException, HttpResponseException
Get the list of all shop connected servers.- Returns:
- The list of connected servers.
- Throws:
HttpRequestException- when any errors with request sending has occured.HttpResponseException- when any errors with response handling has occured.- See Also:
Server
-
getMassSalesList
@NotNull @NotNull MassSalesList getMassSalesList() throws HttpRequestException, HttpResponseException
Get the list of all mass sales.- Returns:
- The list of mass sales.
- Throws:
HttpRequestException- when any errors with request sending has occured.HttpResponseException- when any errors with response handling has occured.- See Also:
MassSale
-
getMassSalesList
@NotNull @NotNull MassSalesList getMassSalesList(@NotNull @NotNull ActivityFlag activityFlag) throws HttpRequestException, HttpResponseException
Get the list of all mass sales with the activity filter.- Parameters:
activityFlag- the activity flag to filter the list of stored mass sales.- Returns:
- The filtered list of mass sales.
- Throws:
HttpRequestException- when any errors with request sending has occured.HttpResponseException- when any errors with response handling has occured.- See Also:
MassSale,ActivityFlag
-
getCouponsList
@NotNull @NotNull CouponsList getCouponsList() throws HttpRequestException, HttpResponseException
Get the list of all coupons.- Returns:
- The list of coupons.
- Throws:
HttpRequestException- when any errors with request sending has occured.HttpResponseException- when any errors with response handling has occured.- See Also:
Coupon
-
getCouponsList
@NotNull @NotNull CouponsList getCouponsList(@NotNull @NotNull ActivityFlag activityFlag) throws HttpRequestException, HttpResponseException
Get the list of all coupons with the activity filter.- Parameters:
activityFlag- the activity flag to filter the list of stored coupons.- Returns:
- The filtered list of coupons.
- Throws:
HttpRequestException- when any errors with request sending has occured.HttpResponseException- when any errors with response handling has occured.- See Also:
Coupon,ActivityFlag
-
getPayment
@NotNull @NotNull Payment getPayment(int paymentId) throws HttpRequestException, HttpResponseException
Get the payment by the #ID.- Parameters:
paymentId- the ID of requested payment.- Returns:
- The payment describing object.
- Throws:
HttpRequestException- when any errors with request sending has occured.HttpResponseException- when any errors with response handling has occured.- See Also:
Payment,PaymentStatus
-
getPaymentsList
@NotNull @NotNull PaymentsList getPaymentsList() throws HttpRequestException, HttpResponseException
Get the list of all finished payments.- Returns:
- The list of finished payments.
- Throws:
HttpRequestException- when any errors with request sending has occured.HttpResponseException- when any errors with response handling has occured.- See Also:
Payment,PaymentStatus.SUCCESS
-
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
-
createPayment
@NotNull @NotNull PendingPayment createPayment(@NotNull @NotNull PendingPaymentBuilder paymentBuilder) throws HttpRequestException, HttpResponseException
Get the pending payment data using your credentials from pending payment builder.
This method also will be used byPendingPaymentBuilder.create().- Parameters:
paymentBuilder- the further pending payment describing builder instance.- Returns:
- The pending payment describing object.
- Throws:
HttpRequestException- when any errors with request sending has occured.HttpResponseException- when any errors with response handling has occured.- See Also:
PendingPayment,PendingPaymentBuilder,createPayment()
-
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, HttpResponseExceptionExecute 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 thatrequest(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.
-
-