public class BTCPayServerHTTPSender
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
BTCPayServerHTTPSender.METHOD
Enumeration of available HTTP Metod values.
|
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
baseURL |
static java.lang.String |
DEFAULT_ACCEPT_VERSION |
static java.lang.String |
HEADER_ACCEPT |
static java.lang.String |
HEADER_ACCEPT_VERSION |
static java.lang.String |
HEADER_CONTENT_TYPE |
static java.lang.String |
HEADER_IDENTITY |
static java.lang.String |
HEADER_SIGNATURE |
protected BTCPayServerHelper |
helper |
static java.lang.String |
JSON_CONTENT_TYPE |
protected static Context |
keyCtx |
protected AsymmetricKeyManager |
keyManager |
protected static java.util.logging.Logger |
log |
protected javax.net.ssl.SSLContext |
sslContext |
Constructor and Description |
---|
BTCPayServerHTTPSender(java.lang.String baseURL,
AsymmetricKeyManager keyManager)
Constructor of BTCPayServerHTTPSender when using default SSL Context.
|
BTCPayServerHTTPSender(java.lang.String baseURL,
AsymmetricKeyManager keyManager,
javax.net.ssl.SSLContext sslContext)
Constructor of BTCPayServerHTTPSender when using a custom SSL Context.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
send(BTCPayServerHTTPSender.METHOD method,
java.lang.String endpoint,
boolean sign)
Method to send data to given REST endpoint of BTC Pay Server.
|
byte[] |
send(BTCPayServerHTTPSender.METHOD method,
java.lang.String endpoint,
boolean sign,
java.util.Map<java.lang.String,java.lang.String> queryParams)
Method to send data to given REST endpoint of BTC Pay Server.
|
byte[] |
send(BTCPayServerHTTPSender.METHOD method,
java.lang.String endpoint,
byte[] requestJson,
boolean sign)
Method to send data to given REST endpoint of BTC Pay Server.
|
byte[] |
send(BTCPayServerHTTPSender.METHOD method,
java.lang.String endpoint,
byte[] requestJson,
boolean sign,
java.util.Map<java.lang.String,java.lang.String> queryParams)
Method to send data to given REST endpoint of BTC Pay Server.
|
byte[] |
send(BTCPayServerHTTPSender.METHOD method,
java.lang.String endpoint,
JSONParsable requestJson,
boolean sign)
Method to send data to given REST endpoint of BTC Pay Server.
|
byte[] |
send(BTCPayServerHTTPSender.METHOD method,
java.lang.String endpoint,
JSONParsable requestJson,
boolean sign,
java.util.Map<java.lang.String,java.lang.String> queryParams)
Method to send data to given REST endpoint of BTC Pay Server.
|
public static final java.lang.String HEADER_CONTENT_TYPE
public static final java.lang.String JSON_CONTENT_TYPE
public static final java.lang.String HEADER_ACCEPT
public static final java.lang.String HEADER_ACCEPT_VERSION
public static final java.lang.String DEFAULT_ACCEPT_VERSION
public static final java.lang.String HEADER_IDENTITY
public static final java.lang.String HEADER_SIGNATURE
protected java.lang.String baseURL
protected AsymmetricKeyManager keyManager
protected BTCPayServerHelper helper
protected javax.net.ssl.SSLContext sslContext
protected static final Context keyCtx
protected static java.util.logging.Logger log
public BTCPayServerHTTPSender(java.lang.String baseURL, AsymmetricKeyManager keyManager)
baseURL
- the baseURL for the REST endpoint of BTC Pay Server.keyManager
- the current key manager holding the signing keys.public BTCPayServerHTTPSender(java.lang.String baseURL, AsymmetricKeyManager keyManager, javax.net.ssl.SSLContext sslContext)
baseURL
- the baseURL for the REST endpoint of BTC Pay Server.keyManager
- the current key manager holding the signing keys.sslContext
- the custom SSL Context in order to connect to BTC Pay Server.public byte[] send(BTCPayServerHTTPSender.METHOD method, java.lang.String endpoint, boolean sign) throws InternalErrorException, java.io.IOException
method
- the HTTP method to use.endpoint
- the REST endpoint, i.e '/invoices', starting with "/"sign
- if the request should contain a x-signature header.InternalErrorException
- if internal error occurred setting up communication or BTC Pay Server signaled error.java.io.IOException
- if communication problems occurred.public byte[] send(BTCPayServerHTTPSender.METHOD method, java.lang.String endpoint, byte[] requestJson, boolean sign) throws InternalErrorException, java.io.IOException
method
- the HTTP method to use.endpoint
- the REST endpoint, i.e '/invoices', starting with "/"requestJson
- The JSON data to send, null to not perform any output body. (GET requests)sign
- if the request should contain a x-signature header.InternalErrorException
- if internal error occurred setting up communication or BTC Pay Server signaled error.java.io.IOException
- if communication problems occurred.public byte[] send(BTCPayServerHTTPSender.METHOD method, java.lang.String endpoint, JSONParsable requestJson, boolean sign) throws InternalErrorException, java.io.IOException
method
- the HTTP method to use.endpoint
- the REST endpoint, i.e '/invoices', starting with "/"requestJson
- The JSON data to send, null to not perform any output body. (GET requests)sign
- if the request should contain a x-signature header.InternalErrorException
- if internal error occurred setting up communication or BTC Pay Server signaled error.java.io.IOException
- if communication problems occurred.public byte[] send(BTCPayServerHTTPSender.METHOD method, java.lang.String endpoint, boolean sign, java.util.Map<java.lang.String,java.lang.String> queryParams) throws InternalErrorException, java.io.IOException
method
- the HTTP method to use.endpoint
- the REST endpoint, i.e '/invoices', starting with "/"sign
- if the request should contain a x-signature header.queryParams
- a map of query parameters appended to the URI string.InternalErrorException
- if internal error occurred setting up communication or BTC Pay Server signaled error.java.io.IOException
- if communication problems occurred.public byte[] send(BTCPayServerHTTPSender.METHOD method, java.lang.String endpoint, JSONParsable requestJson, boolean sign, java.util.Map<java.lang.String,java.lang.String> queryParams) throws InternalErrorException, java.io.IOException
method
- the HTTP method to use.endpoint
- the REST endpoint, i.e '/invoices', starting with "/"requestJson
- The JSON data to send, null to not perform any output body. (GET requests)sign
- if the request should contain a x-signature header.queryParams
- a map of query parameters appended to the URI string.InternalErrorException
- if internal error occurred setting up communication or BTC Pay Server signaled error.java.io.IOException
- if communication problems occurred.public byte[] send(BTCPayServerHTTPSender.METHOD method, java.lang.String endpoint, byte[] requestJson, boolean sign, java.util.Map<java.lang.String,java.lang.String> queryParams) throws InternalErrorException, java.io.IOException
method
- the HTTP method to use.endpoint
- the REST endpoint, i.e '/invoices', starting with "/"requestJson
- The JSON data to send, null to not perform any output body. (GET requests)sign
- if the request should contain a x-signature header.queryParams
- a map of query parameters appended to the URI string.InternalErrorException
- if internal error occurred setting up communication or BTC Pay Server signaled error.java.io.IOException
- if communication problems occurred.