1+ /*
2+ * Copyright (c) 2019 BitPay
3+ */
4+
15package com .bitpay .sdk ;
26
37import com .bitpay .sdk .exceptions .*;
5155import java .util .*;
5256
5357/**
58+ * The type Client. Class is responsible for API calls.
59+ *
5460 * @author Antonio Buedo
55- * @version 8.5.2208
56- * See bitpay.com/api for more information.
57- * date 04.03.2022
61+ * @version 8.5.2208 date 04.03.2022
62+ * @see <a href="https:// bitpay.com/api/#rest-api">REST API</a>
63+ *
5864 */
5965
6066public class Client {
@@ -329,7 +335,7 @@ public Invoice getInvoice(String invoiceId, String facade, Boolean signRequest)
329335
330336 return invoice ;
331337 }
332-
338+
333339 /**
334340 * Retrieve a BitPay invoice by guid using the specified facade. The client must have been previously authorized for the specified facade.
335341 *
@@ -1169,7 +1175,7 @@ public PayoutRecipient getPayoutRecipient(String recipientId) throws BitPayExcep
11691175
11701176 return recipient ;
11711177 }
1172-
1178+
11731179 /**
11741180 * Update a Payout Recipient.
11751181 *
@@ -1246,7 +1252,7 @@ public Boolean deletePayoutRecipient(String recipientId)
12461252
12471253 /**
12481254 * Request a payout recipient notification
1249- *
1255+ *
12501256 * @param recipientId String A BitPay recipient ID.
12511257 * @return True if the notification was successfully sent, false otherwise.
12521258 * @throws BitPayException BitPayException class
@@ -1284,7 +1290,7 @@ public Boolean requestPayoutRecipientNotification(String recipientId)
12841290
12851291 return result ;
12861292 }
1287-
1293+
12881294 /**
12891295 * Submit a BitPay Payout.
12901296 *
@@ -1319,7 +1325,7 @@ public Payout submitPayout(Payout payout) throws BitPayException, PayoutCreation
13191325 /**
13201326 * Retrieve a BitPay payout by payout id using. The client must have been
13211327 * previously authorized for the payout facade.
1322- *
1328+ *
13231329 * @param payoutId String The id of the payout to retrieve.
13241330 * @return A BitPay Payout object.
13251331 * @throws BitPayException BitPayException class
@@ -1435,7 +1441,7 @@ public List<Payout> getPayouts(String startDate, String endDate, String status,
14351441
14361442 /**
14371443 * Request a payout notification
1438- *
1444+ *
14391445 * @param payoutId String The id of the payout to notify..
14401446 * @return True if the notification was successfully sent, false otherwise.
14411447 * @throws BitPayException BitPayException class
@@ -1563,7 +1569,7 @@ public List<PayoutBatch> getPayoutBatches(String status) throws BitPayException,
15631569
15641570 return batches ;
15651571 }
1566-
1572+
15671573 /**
15681574 * Retrieve a collection of BitPay payout batches.
15691575 *
@@ -1619,7 +1625,7 @@ public List<PayoutBatch> getPayoutBatches(String startDate, String endDate, Stri
16191625 /**
16201626 * Retrieve a BitPay payout batch by batch id using. The client must have been
16211627 * previously authorized for the payout facade.
1622- *
1628+ *
16231629 * @param payoutBatchId String The id of the batch to retrieve.
16241630 * @return A BitPay PayoutBatch object.
16251631 * @throws BitPayException BitPayException class
@@ -1680,15 +1686,14 @@ public Boolean cancelPayoutBatch(String payoutBatchId) throws BitPayException, P
16801686
16811687 return result ;
16821688 }
1683-
1689+
16841690 /**
16851691 * Request a payout batch notification
1686- *
1692+ *
16871693 * @param payoutBatchId String The id of the payout batch to notify..
16881694 * @return True if the notification was successfully sent, false otherwise.
16891695 * @throws BitPayException BitPayException class
1690- * @throws PayoutBatchNotificationException PayoutBatchNotificationException
1691- * class
1696+ * @throws PayoutBatchNotificationException PayoutBatchNotificationException class
16921697 */
16931698 public Boolean requestPayoutBatchNotification (String payoutBatchId )
16941699 throws BitPayException , PayoutBatchNotificationException {
@@ -1972,10 +1977,27 @@ public String getAccessToken(String key) throws BitPayException {
19721977 }
19731978
19741979
1980+ /**
1981+ * Send GET request.
1982+ *
1983+ * @param uri the uri
1984+ * @param parameters the parameters
1985+ * @return the http response
1986+ * @throws BitPayException the bit pay exception
1987+ */
19751988 public HttpResponse get (String uri , List <BasicNameValuePair > parameters ) throws BitPayException {
19761989 return get (uri , parameters , true );
19771990 }
19781991
1992+ /**
1993+ * Send GET request.
1994+ *
1995+ * @param uri the uri
1996+ * @param parameters the parameters
1997+ * @param signatureRequired the signature required
1998+ * @return the http response
1999+ * @throws BitPayException the bit pay exception
2000+ */
19792001 public HttpResponse get (String uri , List <BasicNameValuePair > parameters , boolean signatureRequired ) throws BitPayException {
19802002 try {
19812003
@@ -2009,6 +2031,13 @@ public HttpResponse get(String uri, List<BasicNameValuePair> parameters, boolean
20092031 }
20102032 }
20112033
2034+ /**
2035+ * Send GET request.
2036+ *
2037+ * @param uri the uri
2038+ * @return the http response
2039+ * @throws BitPayException the bit pay exception
2040+ */
20122041 public HttpResponse get (String uri ) throws BitPayException {
20132042 return this .get (uri , null , false );
20142043 }
@@ -2045,10 +2074,27 @@ private HttpResponse delete(String uri, List<BasicNameValuePair> parameters) thr
20452074 }
20462075 }
20472076
2077+ /**
2078+ * Send POST request.
2079+ *
2080+ * @param uri the uri
2081+ * @param json the json
2082+ * @return the http response
2083+ * @throws BitPayException the bit pay exception
2084+ */
20482085 public HttpResponse post (String uri , String json ) throws BitPayException {
20492086 return this .post (uri , json , false );
20502087 }
20512088
2089+ /**
2090+ * Send POST request.
2091+ *
2092+ * @param uri the uri
2093+ * @param json the json
2094+ * @param signatureRequired the signature required
2095+ * @return the http response
2096+ * @throws BitPayException the bit pay exception
2097+ */
20522098 public HttpResponse post (String uri , String json , boolean signatureRequired ) throws BitPayException {
20532099 try {
20542100 HttpPost post = new HttpPost (_baseUrl + uri );
@@ -2078,6 +2124,14 @@ public HttpResponse post(String uri, String json, boolean signatureRequired) thr
20782124 }
20792125 }
20802126
2127+ /**
2128+ * Send PUT request.
2129+ *
2130+ * @param uri the uri
2131+ * @param json the json
2132+ * @return the http response
2133+ * @throws BitPayException the bit pay exception
2134+ */
20812135 public HttpResponse update (String uri , String json ) throws BitPayException {
20822136 try {
20832137 HttpPut put = new HttpPut (_baseUrl + uri );
@@ -2104,6 +2158,13 @@ public HttpResponse update(String uri, String json) throws BitPayException {
21042158 }
21052159 }
21062160
2161+ /**
2162+ * Convert HttpResponse for Json string.
2163+ *
2164+ * @param response the response
2165+ * @return the string
2166+ * @throws BitPayException the bit pay exception
2167+ */
21072168 public String responseToJsonString (HttpResponse response ) throws BitPayException {
21082169 if (response == null ) {
21092170 throw new BitPayException (null , "Error: HTTP response is null" );
@@ -2187,7 +2248,7 @@ private String getGuid() {
21872248 }
21882249
21892250 /**
2190- * Loads the configuration file (JSON)
2251+ * Loads the configuration file (JSON).
21912252 *
21922253 * @throws BitPayException BitPayException class
21932254 */
@@ -2209,7 +2270,7 @@ public void GetConfig() throws BitPayException {
22092270 }
22102271
22112272 /**
2212- * Builds the configuration object
2273+ * Builds the configuration object.
22132274 *
22142275 * @param privateKey The full path to the securely located private key.
22152276 * @param tokens Env.Tokens object containing the BitPay's API tokens.
@@ -2283,9 +2344,9 @@ private void loadCurrencies() throws BitPayException {
22832344 // No action required
22842345 }
22852346 }
2286-
2287-
2288-
2347+
2348+
2349+
22892350 /**
22902351 * Gets info for specific currency.
22912352 *
0 commit comments