api

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2019 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v1.1.0

type Client struct {
	// contains filtered or unexported fields
}

Client is a fasthttp.Client wrapper to dialog with a JSON API.

func NewClient added in v1.1.0

func NewClient(apiUrl string) *Client

Client constructor.

func (*Client) Get added in v1.1.0

func (c *Client) Get(route string, queryValues map[string]string) (*RawResponse, error)

Get wraps the doRequest method to do a GET HTTP request.

func (*Client) Post added in v1.1.0

func (c *Client) Post(route string, queryValues map[string]string, body []byte) (*RawResponse, error)

Post wraps the doRequest method to do a POST HTTP request.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler provides helper methods to send and retrieve transactions without directly interacting with the HTTP Client.

func NewHandler

func NewHandler(apiUrl string) *Handler

Handler constructor.

func (*Handler) RetrieveCertificate added in v1.1.0

func (h *Handler) RetrieveCertificate(companyChainID string, uuid string) (*entityApi.TransactionWrapper, error)

RetrieveCertificate fetches the API and returns a transaction wrapper or an error.

func (*Handler) RetrieveSecrets added in v1.1.0

func (h *Handler) RetrieveSecrets(
	companyChainID string,
	certificateUuid string,
) (*entityApi.TransactionWrappers, error)

RetrieveSecrets fetches the API and returns a transaction wrapper list or an error.

func (*Handler) SendCertificate

func (h *Handler) SendCertificate(transaction *entityApi.Transaction) (*entityApi.TransactionStatus, error)

SendCertificate accepts a transaction and sends it to the appropriate certificate API route.

func (*Handler) SendSecret added in v1.1.0

func (h *Handler) SendSecret(
	transaction *entityApi.Transaction,
	companyChainID string,
	certificateUuid string,
) (*entityApi.TransactionStatus, error)

SendSecret accepts a transaction and sends it to the appropriate secret API route.

func (*Handler) SendTransaction added in v1.1.1

func (h *Handler) SendTransaction(
	route string,
	transaction []byte,
) (*entityApi.TransactionStatus, error)

SendTransaction tries to send a transaction to the API and returns a transaction status or an error.

type RawResponse added in v1.1.0

type RawResponse struct {
	StatusCode int
	Body       []byte
}

Response is a fasthttp.Response wrapper.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL