Package com.github.katenachain.api
Class Handler
- java.lang.Object
-
- com.github.katenachain.api.Handler
-
public class Handler extends Object
Handler provides helper methods to send and retrieve tx without directly interacting with the HTTP Client.
-
-
Constructor Summary
Constructors Constructor Description Handler(String apiUrl, Serializer serializer)Handler constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TxWrapperretrieveCertificate(String id)fetches the API and returns a tx wrapper.TxWrappersretrieveCertificatesHistory(String id)fetches the API and returns a tx wrappers.TxWrappersretrieveSecrets(String id)fetches the API and returns a tx wrapper list.TxStatussendCertificate(Tx tx)accepts a tx and sends it to the appropriate certificate API route.TxStatussendSecret(Tx tx)accepts a tx and sends it to the appropriate API route.TxStatussendTx(String route, Tx tx)tries to send a tx to the API and returns a tx status or throws an api error.
-
-
-
Constructor Detail
-
Handler
public Handler(String apiUrl, Serializer serializer)
Handler constructor.- Parameters:
apiUrl- Stringserializer- Serializer
-
-
Method Detail
-
sendCertificate
public TxStatus sendCertificate(Tx tx) throws IOException
accepts a tx and sends it to the appropriate certificate API route.- Parameters:
tx- Tx- Returns:
- TxStatus tx status
- Throws:
IOException- the io exception
-
sendSecret
public TxStatus sendSecret(Tx tx) throws IOException
accepts a tx and sends it to the appropriate API route.- Parameters:
tx- Tx- Returns:
- TxStatus tx status
- Throws:
IOException- the io exception
-
retrieveCertificate
public TxWrapper retrieveCertificate(String id) throws IOException
fetches the API and returns a tx wrapper.- Parameters:
id- String- Returns:
- TxWrapper tx wrapper
- Throws:
IOException- the io exception
-
retrieveCertificatesHistory
public TxWrappers retrieveCertificatesHistory(String id) throws IOException
fetches the API and returns a tx wrappers.- Parameters:
id- String- Returns:
- TxWrappers tx wrappers
- Throws:
IOException- the io exception
-
retrieveSecrets
public TxWrappers retrieveSecrets(String id) throws IOException
fetches the API and returns a tx wrapper list.- Parameters:
id- String- Returns:
- TxWrappers tx wrappers
- Throws:
IOException- the io exception
-
sendTx
public TxStatus sendTx(String route, Tx tx) throws IOException
tries to send a tx to the API and returns a tx status or throws an api error.- Parameters:
route- Stringtx- Tx- Returns:
- TxStatus tx status
- Throws:
IOException- the io exception
-
-