Documentation
¶
Index ¶
- Constants
- Variables
- func ContextWithRequestID(parent context.Context, requestID string) context.Context
- func EndpointTravelAddress(endpoint, protocol string) (string, error)
- func ErrorStatus(err error) int
- func RequestIDFromContext(ctx context.Context) (string, bool)
- func ValidationError(err error, errs ...*FieldError) error
- type APIAuthentication
- type APIKey
- type APIKeyList
- type APIv1
- func (s *APIv1) APIKeyDetail(ctx context.Context, keyID ulid.ULID) (out *APIKey, err error)
- func (s *APIv1) Accept(ctx context.Context, transactionID uuid.UUID, in *Envelope) (out *Envelope, err error)
- func (s *APIv1) AcceptPreview(ctx context.Context, transactionID uuid.UUID) (out *Envelope, err error)
- func (s *APIv1) AccountDetail(ctx context.Context, id ulid.ULID) (out *Account, err error)
- func (s *APIv1) Authenticate(ctx context.Context, in *APIAuthentication) (out *LoginReply, err error)
- func (s *APIv1) CounterpartyDetail(ctx context.Context, id ulid.ULID) (out *Counterparty, err error)
- func (s *APIv1) Create(ctx context.Context, endpoint string, in, out interface{}) (err error)
- func (s *APIv1) CreateAPIKey(ctx context.Context, in *APIKey) (out *APIKey, err error)
- func (s *APIv1) CreateAccount(ctx context.Context, in *Account) (out *Account, err error)
- func (s *APIv1) CreateCounterparty(ctx context.Context, in *Counterparty) (out *Counterparty, err error)
- func (s *APIv1) CreateCryptoAddress(ctx context.Context, accountID ulid.ULID, in *CryptoAddress) (out *CryptoAddress, err error)
- func (s *APIv1) CreateTransaction(ctx context.Context, in *Transaction) (out *Transaction, err error)
- func (s *APIv1) CreateUser(ctx context.Context, in *User) (out *User, err error)
- func (s *APIv1) CryptoAddressDetail(ctx context.Context, accountID, cryptoAddressID ulid.ULID) (out *CryptoAddress, err error)
- func (s *APIv1) DecodeTravelAddress(ctx context.Context, in *TravelAddress) (out *TravelAddress, err error)
- func (s *APIv1) DecryptedEnvelopeDetail(ctx context.Context, transactionID uuid.UUID, envID ulid.ULID) (out *Envelope, err error)
- func (s *APIv1) Delete(ctx context.Context, endpoint string) (err error)
- func (s *APIv1) DeleteAPIKey(ctx context.Context, keyID ulid.ULID) error
- func (s *APIv1) DeleteAccount(ctx context.Context, id ulid.ULID) (err error)
- func (s *APIv1) DeleteCounterparty(ctx context.Context, id ulid.ULID) (err error)
- func (s *APIv1) DeleteCryptoAddress(ctx context.Context, accountID, cryptoAddressID ulid.ULID) (err error)
- func (s *APIv1) DeleteSecureEnvelope(ctx context.Context, transactionID uuid.UUID, envID ulid.ULID) error
- func (s *APIv1) DeleteTransaction(ctx context.Context, id uuid.UUID) (err error)
- func (s *APIv1) DeleteUser(ctx context.Context, id ulid.ULID) error
- func (s *APIv1) Detail(ctx context.Context, endpoint string, out interface{}) (err error)
- func (s *APIv1) Do(req *http.Request, data interface{}, checkStatus bool) (rep *http.Response, err error)
- func (s *APIv1) EncodeTravelAddress(ctx context.Context, in *TravelAddress) (out *TravelAddress, err error)
- func (s *APIv1) Export(ctx context.Context, w io.Writer) (err error)
- func (s *APIv1) LatestPayloadEnvelope(ctx context.Context, transactionID uuid.UUID) (out *Envelope, err error)
- func (s *APIv1) List(ctx context.Context, endpoint string, in *PageQuery, out interface{}) (err error)
- func (s *APIv1) ListAPIKeys(ctx context.Context, in *PageQuery) (out *APIKeyList, err error)
- func (s *APIv1) ListAccounts(ctx context.Context, in *PageQuery) (out *AccountsList, err error)
- func (s *APIv1) ListCounterparties(ctx context.Context, in *PageQuery) (out *CounterpartyList, err error)
- func (s *APIv1) ListCryptoAddresses(ctx context.Context, accountID ulid.ULID, in *PageQuery) (out *CryptoAddressList, err error)
- func (s *APIv1) ListSecureEnvelopes(ctx context.Context, transactionID uuid.UUID, in *EnvelopeListQuery) (out *EnvelopesList, err error)
- func (s *APIv1) ListTransactions(ctx context.Context, in *PageQuery) (out *TransactionsList, err error)
- func (s *APIv1) ListUsers(ctx context.Context, in *PageQuery) (out *UserList, err error)
- func (s *APIv1) Login(ctx context.Context, in *LoginRequest) (out *LoginReply, err error)
- func (s *APIv1) NewRequest(ctx context.Context, method, path string, data interface{}, params *url.Values) (req *http.Request, err error)
- func (s *APIv1) Prepare(ctx context.Context, in *Prepare) (out *Prepared, err error)
- func (s *APIv1) Reauthenticate(ctx context.Context, in *ReauthenticateRequest) (out *LoginReply, err error)
- func (s *APIv1) Reject(ctx context.Context, transactionID uuid.UUID, in *Rejection) (out *Envelope, err error)
- func (s *APIv1) Repair(ctx context.Context, transactionID uuid.UUID, in *Envelope) (out *Envelope, err error)
- func (s *APIv1) RepairPreview(ctx context.Context, transactionID uuid.UUID) (out *Repair, err error)
- func (s *APIv1) SearchCounterparties(ctx context.Context, in *SearchQuery) (out *CounterpartyList, err error)
- func (s *APIv1) SecureEnvelopeDetail(ctx context.Context, transactionID uuid.UUID, envID ulid.ULID) (out *SecureEnvelope, err error)
- func (s *APIv1) SendEnvelope(ctx context.Context, transactionID uuid.UUID, in *Envelope) (out *Envelope, err error)
- func (s *APIv1) SendPrepared(ctx context.Context, in *Prepared) (out *Transaction, err error)
- func (s *APIv1) Status(ctx context.Context) (out *StatusReply, err error)
- func (s *APIv1) TransactionDetail(ctx context.Context, id uuid.UUID) (out *Transaction, err error)
- func (s *APIv1) Update(ctx context.Context, endpoint string, in, out interface{}) (err error)
- func (s *APIv1) UpdateAPIKey(ctx context.Context, in *APIKey) (out *APIKey, err error)
- func (s *APIv1) UpdateAccount(ctx context.Context, in *Account) (out *Account, err error)
- func (s *APIv1) UpdateCounterparty(ctx context.Context, in *Counterparty) (out *Counterparty, err error)
- func (s *APIv1) UpdateCryptoAddress(ctx context.Context, accountID ulid.ULID, in *CryptoAddress) (out *CryptoAddress, err error)
- func (s *APIv1) UpdateTransaction(ctx context.Context, in *Transaction) (out *Transaction, err error)
- func (s *APIv1) UpdateUser(ctx context.Context, in *User) (out *User, err error)
- func (s *APIv1) UserDetail(ctx context.Context, id ulid.ULID) (out *User, err error)
- func (s *APIv1) WaitForReady(ctx context.Context) (err error)
- type Account
- type AccountsList
- type Client
- type ClientOption
- type Counterparty
- type CounterpartyList
- type CryptoAddress
- type CryptoAddressList
- type DetailError
- type Envelope
- type EnvelopeListQuery
- type EnvelopeQuery
- type EnvelopesList
- type ErrorDetail
- type FieldError
- type Identification
- type LoginReply
- type LoginRequest
- type PageQuery
- type Person
- type Prepare
- type Prepared
- type ReauthenticateRequest
- type Rejection
- type Repair
- type Reply
- type SearchQuery
- type SecureEnvelope
- type StatusError
- type StatusReply
- type Transaction
- type TransactionQuery
- type TransactionsList
- type Transfer
- type TravelAddress
- type User
- type UserList
- type UserPassword
- type UserQuery
- type ValidationErrors
Examples ¶
Constants ¶
const ( DetailFull = "full" DetailPreview = "preview" )
const ( DetailUser = "user" DetailPassword = "password" )
Variables ¶
var ( Unsuccessful = Reply{Success: false, Version: pkg.Version()} NotFound = Reply{Success: false, Error: "resource not found", Version: pkg.Version()} NotAllowed = Reply{Success: false, Error: "method not allowed", Version: pkg.Version()} )
var ( ErrInvalidTimestamp = errors.New("payload timestamp has invalid string format") ErrInvalidRejection = errors.New("envelope does not contain a rejection/repair error") )
Functions ¶
func ContextWithRequestID ¶
Adds a request ID to the context which is sent with the request in the X-Request-ID header.
func EndpointTravelAddress ¶ added in v0.14.0
func ErrorStatus ¶
ErrorStatus returns the HTTP status code from an error or 500 if the error is not a StatusError.
func RequestIDFromContext ¶
Extracts a request ID from the context.
func ValidationError ¶
func ValidationError(err error, errs ...*FieldError) error
Types ¶
type APIAuthentication ¶
type APIAuthentication struct {
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
}
func (*APIAuthentication) Validate ¶
func (r *APIAuthentication) Validate() (err error)
type APIKey ¶ added in v0.24.1
type APIKey struct {
ID ulid.ULID `json:"id,omitempty"`
Description string `json:"description"`
ClientID string `json:"client_id"`
Secret string `json:"client_secret,omitempty"`
LastSeen *time.Time `json:"last_seen,omitempty"`
Permissions []string `json:"permissions"`
Created time.Time `json:"created,omitempty"`
Modified time.Time `json:"modified,omitempty"`
}
type APIKeyList ¶ added in v0.24.1
func NewAPIKeyList ¶ added in v0.24.1
func NewAPIKeyList(page *models.APIKeyPage) (out *APIKeyList, err error)
type APIv1 ¶
type APIv1 struct {
// contains filtered or unexported fields
}
APIv1 implements the v1 Client interface for making requests to the TRISA SHN.
func (*APIv1) APIKeyDetail ¶ added in v0.24.1
func (*APIv1) AcceptPreview ¶ added in v0.24.0
func (*APIv1) AccountDetail ¶
func (*APIv1) Authenticate ¶
func (s *APIv1) Authenticate(ctx context.Context, in *APIAuthentication) (out *LoginReply, err error)
func (*APIv1) CounterpartyDetail ¶
func (*APIv1) CreateAPIKey ¶ added in v0.24.1
func (*APIv1) CreateAccount ¶
func (*APIv1) CreateCounterparty ¶
func (s *APIv1) CreateCounterparty(ctx context.Context, in *Counterparty) (out *Counterparty, err error)
func (*APIv1) CreateCryptoAddress ¶
func (s *APIv1) CreateCryptoAddress(ctx context.Context, accountID ulid.ULID, in *CryptoAddress) (out *CryptoAddress, err error)
func (*APIv1) CreateTransaction ¶
func (s *APIv1) CreateTransaction(ctx context.Context, in *Transaction) (out *Transaction, err error)
func (*APIv1) CreateUser ¶ added in v0.18.0
func (*APIv1) CryptoAddressDetail ¶
func (*APIv1) DecodeTravelAddress ¶ added in v0.12.0
func (s *APIv1) DecodeTravelAddress(ctx context.Context, in *TravelAddress) (out *TravelAddress, err error)
func (*APIv1) DecryptedEnvelopeDetail ¶
func (*APIv1) DeleteAPIKey ¶ added in v0.24.1
func (*APIv1) DeleteAccount ¶
func (*APIv1) DeleteCounterparty ¶
func (*APIv1) DeleteCryptoAddress ¶
func (*APIv1) DeleteSecureEnvelope ¶
func (*APIv1) DeleteTransaction ¶
func (*APIv1) DeleteUser ¶ added in v0.18.0
func (*APIv1) Do ¶
func (s *APIv1) Do(req *http.Request, data interface{}, checkStatus bool) (rep *http.Response, err error)
Do executes an http request against the server, performs error checking, and deserializes the response data into the specified struct.
func (*APIv1) EncodeTravelAddress ¶ added in v0.12.0
func (s *APIv1) EncodeTravelAddress(ctx context.Context, in *TravelAddress) (out *TravelAddress, err error)
func (*APIv1) LatestPayloadEnvelope ¶ added in v0.24.0
func (*APIv1) ListAPIKeys ¶ added in v0.24.1
func (*APIv1) ListAccounts ¶
func (*APIv1) ListCounterparties ¶
func (*APIv1) ListCryptoAddresses ¶
func (*APIv1) ListSecureEnvelopes ¶
func (s *APIv1) ListSecureEnvelopes(ctx context.Context, transactionID uuid.UUID, in *EnvelopeListQuery) (out *EnvelopesList, err error)
func (*APIv1) ListTransactions ¶
func (*APIv1) Login ¶
func (s *APIv1) Login(ctx context.Context, in *LoginRequest) (out *LoginReply, err error)
func (*APIv1) NewRequest ¶
func (*APIv1) Reauthenticate ¶
func (s *APIv1) Reauthenticate(ctx context.Context, in *ReauthenticateRequest) (out *LoginReply, err error)
func (*APIv1) RepairPreview ¶ added in v0.24.0
func (*APIv1) SearchCounterparties ¶ added in v0.23.0
func (s *APIv1) SearchCounterparties(ctx context.Context, in *SearchQuery) (out *CounterpartyList, err error)
func (*APIv1) SecureEnvelopeDetail ¶
func (*APIv1) SendEnvelope ¶ added in v0.14.0
func (*APIv1) SendPrepared ¶ added in v0.14.0
func (*APIv1) TransactionDetail ¶
func (*APIv1) UpdateAPIKey ¶ added in v0.24.1
func (*APIv1) UpdateAccount ¶
func (*APIv1) UpdateCounterparty ¶
func (s *APIv1) UpdateCounterparty(ctx context.Context, in *Counterparty) (out *Counterparty, err error)
func (*APIv1) UpdateCryptoAddress ¶
func (s *APIv1) UpdateCryptoAddress(ctx context.Context, accountID ulid.ULID, in *CryptoAddress) (out *CryptoAddress, err error)
func (*APIv1) UpdateTransaction ¶
func (s *APIv1) UpdateTransaction(ctx context.Context, in *Transaction) (out *Transaction, err error)
func (*APIv1) UpdateUser ¶ added in v0.18.0
func (*APIv1) UserDetail ¶ added in v0.18.0
func (*APIv1) WaitForReady ¶
Wait for ready polls the node's status endpoint until it responds with an 200 response, retrying with exponential backoff or until the context deadline is expired. If the user does not supply a context with a deadline, then a default deadline of 5 minutes is used so that this method does not block indefinitely. If the node API service is ready (e.g. responds to a status request) then no error is returned, otherwise an error is returned if the node never responds.
NOTE: if the node returns a 503 Service Unavailable because it is in maintenance mode, this method will continue to wait until the deadline for the node to exit from maintenance mode and be ready again.
type Account ¶
type Account struct {
ID ulid.ULID `json:"id,omitempty"`
CustomerID string `json:"customer_id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
TravelAddress string `json:"travel_address,omitempty"`
IVMSRecord string `json:"ivms101,omitempty"`
CryptoAddresses []*CryptoAddress `json:"crypto_addresses"`
Created time.Time `json:"created,omitempty"`
Modified time.Time `json:"modified,omitempty"`
}
type AccountsList ¶
func NewAccountList ¶
func NewAccountList(page *models.AccountsPage) (out *AccountsList, err error)
type Client ¶
type Client interface {
Status(context.Context) (*StatusReply, error)
Login(context.Context, *LoginRequest) (*LoginReply, error)
Authenticate(context.Context, *APIAuthentication) (*LoginReply, error)
Reauthenticate(context.Context, *ReauthenticateRequest) (*LoginReply, error)
// Transactions Resource
ListTransactions(context.Context, *PageQuery) (*TransactionsList, error)
CreateTransaction(context.Context, *Transaction) (*Transaction, error)
TransactionDetail(context.Context, uuid.UUID) (*Transaction, error)
UpdateTransaction(context.Context, *Transaction) (*Transaction, error)
DeleteTransaction(context.Context, uuid.UUID) error
// Transaction Actions
Prepare(context.Context, *Prepare) (*Prepared, error)
SendPrepared(context.Context, *Prepared) (*Transaction, error)
Export(context.Context, io.Writer) error
// Transaction Detail Actions
SendEnvelope(ctx context.Context, transactionID uuid.UUID, in *Envelope) (*Envelope, error)
LatestPayloadEnvelope(ctx context.Context, transactionID uuid.UUID) (*Envelope, error)
AcceptPreview(ctx context.Context, transactionID uuid.UUID) (*Envelope, error)
Accept(ctx context.Context, transactionID uuid.UUID, in *Envelope) (*Envelope, error)
Reject(ctx context.Context, transactionID uuid.UUID, in *Rejection) (*Envelope, error)
RepairPreview(ctx context.Context, transactionID uuid.UUID) (*Repair, error)
Repair(ctx context.Context, transactionID uuid.UUID, in *Envelope) (*Envelope, error)
// SecureEnvelopes Resource
ListSecureEnvelopes(ctx context.Context, transactionID uuid.UUID, in *EnvelopeListQuery) (*EnvelopesList, error)
SecureEnvelopeDetail(ctx context.Context, transactionID uuid.UUID, envID ulid.ULID) (*SecureEnvelope, error)
DecryptedEnvelopeDetail(ctx context.Context, transactionID uuid.UUID, envID ulid.ULID) (*Envelope, error)
DeleteSecureEnvelope(ctx context.Context, transactionID uuid.UUID, envID ulid.ULID) error
// Accounts Resource
ListAccounts(context.Context, *PageQuery) (*AccountsList, error)
CreateAccount(context.Context, *Account) (*Account, error)
AccountDetail(context.Context, ulid.ULID) (*Account, error)
UpdateAccount(context.Context, *Account) (*Account, error)
DeleteAccount(context.Context, ulid.ULID) error
// CryptoAddress Resource
ListCryptoAddresses(ctx context.Context, accountID ulid.ULID, in *PageQuery) (*CryptoAddressList, error)
CreateCryptoAddress(ctx context.Context, accountID ulid.ULID, in *CryptoAddress) (*CryptoAddress, error)
CryptoAddressDetail(ctx context.Context, accountID, cryptoAddressID ulid.ULID) (*CryptoAddress, error)
UpdateCryptoAddress(ctx context.Context, accountID ulid.ULID, in *CryptoAddress) (*CryptoAddress, error)
DeleteCryptoAddress(ctx context.Context, accountID, cryptoAddressID ulid.ULID) error
// Counterparty Resource
SearchCounterparties(context.Context, *SearchQuery) (*CounterpartyList, error)
ListCounterparties(context.Context, *PageQuery) (*CounterpartyList, error)
CreateCounterparty(context.Context, *Counterparty) (*Counterparty, error)
CounterpartyDetail(context.Context, ulid.ULID) (*Counterparty, error)
UpdateCounterparty(context.Context, *Counterparty) (*Counterparty, error)
DeleteCounterparty(context.Context, ulid.ULID) error
// Users Resource
ListUsers(context.Context, *PageQuery) (*UserList, error)
CreateUser(context.Context, *User) (*User, error)
UserDetail(context.Context, ulid.ULID) (*User, error)
UpdateUser(context.Context, *User) (*User, error)
DeleteUser(context.Context, ulid.ULID) error
// APIKey Resource
ListAPIKeys(context.Context, *PageQuery) (*APIKeyList, error)
CreateAPIKey(context.Context, *APIKey) (*APIKey, error)
APIKeyDetail(context.Context, ulid.ULID) (*APIKey, error)
UpdateAPIKey(context.Context, *APIKey) (*APIKey, error)
DeleteAPIKey(context.Context, ulid.ULID) error
// Utilities
EncodeTravelAddress(context.Context, *TravelAddress) (*TravelAddress, error)
DecodeTravelAddress(context.Context, *TravelAddress) (*TravelAddress, error)
}
Client defines the service interface for interacting with the TRISA self-hosted node internal API (e.g. the API that users can integrate with).
type ClientOption ¶
ClientOption allows us to configure the APIv1 client when it is created.
func WithClient ¶
func WithClient(client *http.Client) ClientOption
type Counterparty ¶
type Counterparty struct {
ID ulid.ULID `json:"id,omitempty"`
Source string `json:"source,omitempty"`
DirectoryID string `json:"directory_id,omitempty"`
RegisteredDirectory string `json:"registered_directory,omitempty"`
Protocol string `json:"protocol"`
CommonName string `json:"common_name"`
Endpoint string `json:"endpoint"`
TravelAddress string `json:"travel_address"`
Name string `json:"name"`
Website string `json:"website"`
Country string `json:"country"`
BusinessCategory string `json:"business_category"`
VASPCategories []string `json:"vasp_categories"`
VerifiedOn time.Time `json:"verified_on"`
IVMSRecord string `json:"ivms101,omitempty"`
Created time.Time `json:"created,omitempty"`
Modified time.Time `json:"modified,omitempty"`
}
func NewCounterparty ¶
func NewCounterparty(model *models.Counterparty) (out *Counterparty, err error)
func (*Counterparty) Model ¶
func (c *Counterparty) Model() (model *models.Counterparty, err error)
func (*Counterparty) Validate ¶
func (c *Counterparty) Validate() (err error)
type CounterpartyList ¶
type CounterpartyList struct {
Page *PageQuery `json:"page"`
Counterparties []*Counterparty `json:"counterparties"`
}
func NewCounterpartyList ¶
func NewCounterpartyList(page *models.CounterpartyPage) (out *CounterpartyList, err error)
type CryptoAddress ¶
type CryptoAddress struct {
ID ulid.ULID `json:"id,omitempty"`
CryptoAddress string `json:"crypto_address"`
Network string `json:"network"`
AssetType string `json:"asset_type"`
Tag string `json:"tag"`
TravelAddress string `json:"travel_address,omitempty"`
Created time.Time `json:"created,omitempty"`
Modified time.Time `json:"modified,omitempty"`
}
func NewCryptoAddress ¶
func NewCryptoAddress(model *models.CryptoAddress) (*CryptoAddress, error)
func (*CryptoAddress) Model ¶
func (c *CryptoAddress) Model(acct *models.Account) (*models.CryptoAddress, error)
type CryptoAddressList ¶
type CryptoAddressList struct {
Page *PageQuery `json:"page"`
CryptoAddresses []*CryptoAddress `json:"crypto_addresses"`
}
func NewCryptoAddressList ¶
func NewCryptoAddressList(page *models.CryptoAddressPage) (out *CryptoAddressList, err error)
type DetailError ¶
type Envelope ¶ added in v0.14.0
type Envelope struct {
ID ulid.ULID `json:"id"`
EnvelopeID string `json:"envelope_id,omitempty"`
Direction string `json:"direction"`
Remote string `json:"remote,omitempty"`
ReplyTo ulid.ULID `json:"reply_to,omitempty"`
IsError bool `json:"is_error"`
Error *trisa.Error `json:"error,omitempty"`
Identity *ivms101.IdentityPayload `json:"identity,omitempty"`
Transaction *generic.Transaction `json:"transaction,omitempty"`
Pending *generic.Pending `json:"pending,omitempty"`
SentAt *time.Time `json:"sent_at"`
ReceivedAt *time.Time `json:"received_at,omitempty"`
Timestamp time.Time `json:"timestamp"`
PublicKeySignature string `json:"public_key_signature,omitempty"`
TransferState string `json:"transfer_state,omitempty"`
Original []byte `json:"original,omitempty"`
}
func NewEnvelope ¶ added in v0.14.0
func (*Envelope) ParseTransferState ¶ added in v0.22.0
func (e *Envelope) ParseTransferState() trisa.TransferState
type EnvelopeListQuery ¶
type EnvelopeListQuery struct {
PageQuery
EnvelopeQuery
}
type EnvelopeQuery ¶
type EnvelopesList ¶
type EnvelopesList struct {
Page *PageQuery `json:"page"`
IsDecrypted bool `json:"is_decrypted"`
SecureEnvelopes []*SecureEnvelope `json:"secure_envelopes,omitempty"`
DecryptedEnvelopes []*Envelope `json:"decrypted_envelopes,omitempty"`
}
func NewEnvelopeList ¶ added in v0.21.0
func NewEnvelopeList(page *models.SecureEnvelopePage, envelopes []*envelope.Envelope) (out *EnvelopesList, err error)
func NewSecureEnvelopeList ¶
func NewSecureEnvelopeList(page *models.SecureEnvelopePage) (out *EnvelopesList, err error)
type ErrorDetail ¶
type ErrorDetail []*DetailError
type FieldError ¶
type FieldError struct {
// contains filtered or unexported fields
}
func IncorrectField ¶
func IncorrectField(field, issue string) *FieldError
func MissingField ¶
func MissingField(field string) *FieldError
func OneOfMissing ¶ added in v0.14.0
func OneOfMissing(fields ...string) *FieldError
func OneOfTooMany ¶ added in v0.14.0
func OneOfTooMany(fields ...string) *FieldError
func ReadOnlyField ¶
func ReadOnlyField(field string) *FieldError
func (*FieldError) Error ¶
func (e *FieldError) Error() string
type Identification ¶ added in v0.18.0
type Identification struct {
TypeCode string `json:"type_code"`
Number string `json:"number"`
Country string `json:"country"`
DateOfBirth string `json:"dob"`
BirthPlace string `json:"birth_place"`
}
func (*Identification) NationalIdentifierTypeCode ¶ added in v0.21.0
func (i *Identification) NationalIdentifierTypeCode() ivms101.NationalIdentifierTypeCode
type LoginReply ¶
type LoginRequest ¶
type LoginRequest struct {
Email string `json:"email"`
Password string `json:"password"`
Next string `json:"next"`
}
func (*LoginRequest) Validate ¶
func (r *LoginRequest) Validate() (err error)
type PageQuery ¶
type PageQuery struct {
PageSize int `json:"page_size,omitempty" url:"page_size,omitempty" form:"page_size"`
NextPageToken string `json:"next_page_token,omitempty" url:"next_page_token,omitempty" form:"next_page_token"`
PrevPageToken string `json:"prev_page_token,omitempty" url:"prev_page_token,omitempty" form:"prev_page_token"`
}
PageQuery manages paginated list requests.
type Person ¶
type Person struct {
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
CustomerID string `json:"customer_id"`
Identification *Identification `json:"identification"`
AddrLine1 string `json:"addr_line_1"`
AddrLine2 string `json:"addr_line_2"`
City string `json:"city"`
State string `json:"state"`
PostalCode string `json:"post_code"`
Country string `json:"country"`
CryptoAddress string `json:"crypto_address"`
}
func (*Person) NaturalPerson ¶
type Prepare ¶
type Prepare struct {
TravelAddress string `json:"travel_address"`
Originator *Person `json:"originator"`
Beneficiary *Person `json:"beneficiary"`
Transfer *Transfer `json:"transfer"`
}
func (*Prepare) Transaction ¶
func (p *Prepare) Transaction() *generic.Transaction
type Prepared ¶
type Prepared struct {
TravelAddress string `json:"travel_address"`
Identity *ivms101.IdentityPayload `json:"identity"`
Transaction *generic.Transaction `json:"transaction"`
}
type ReauthenticateRequest ¶
type ReauthenticateRequest struct {
RefreshToken string `json:"refresh_token"`
}
func (*ReauthenticateRequest) Validate ¶
func (r *ReauthenticateRequest) Validate() (err error)
type Rejection ¶ added in v0.14.0
type Rejection struct {
Code string `json:"code"`
Message string `json:"message"`
RequestRetry bool `json:"request_retry"`
}
func NewRejection ¶ added in v0.24.0
func NewRejection(env *models.SecureEnvelope) (out *Rejection, err error)
type Reply ¶
type Reply struct {
Success bool `json:"success"`
Error string `json:"error,omitempty"`
Version string `json:"version,omitempty"`
ErrorDetail ErrorDetail `json:"errors,omitempty"`
}
Reply contains standard fields that are used for generic API responses and errors.
type SearchQuery ¶ added in v0.23.0
type SearchQuery struct {
Query string `json:"query,omitempty" url:"query,omitempty" form:"query"`
Limit int `json:"limit,omitempty" url:"limit,omitempty" form:"limit"`
}
func (*SearchQuery) Model ¶ added in v0.23.0
func (q *SearchQuery) Model() *models.SearchQuery
func (*SearchQuery) Validate ¶ added in v0.23.0
func (q *SearchQuery) Validate() error
type SecureEnvelope ¶
type SecureEnvelope struct {
ID ulid.ULID `json:"id"`
EnvelopeID uuid.UUID `json:"envelope_id"`
Direction string `json:"direction"`
Remote string `json:"remote,omitempty"`
ReplyTo ulid.ULID `json:"reply_to,omitempty"`
Payload []byte `json:"payload,omitempty"`
EncryptionKey []byte `json:"encryption_key,omitempty"`
EncryptionAlgorithm string `json:"encryption_algorithm,omitempty"`
ValidHMAC bool `json:"valid_hmac"`
HMAC []byte `json:"hmac,omitempty"`
HMACSecret []byte `json:"hmac_secret,omitempty"`
HMACAlgorithm string `json:"hmac_algorithm,omitempty"`
IsError bool `json:"is_error"`
Error *trisa.Error `json:"error,omitempty"`
Timestamp time.Time `json:"timestamp"`
Sealed bool `json:"sealed"`
PublicKeySignature string `json:"public_key_signature,omitempty"`
TransferState string `json:"transfer_state,omitempty"`
Original []byte `json:"original,omitempty"`
}
func NewSecureEnvelope ¶
func NewSecureEnvelope(model *models.SecureEnvelope) (out *SecureEnvelope, err error)
type StatusError ¶
StatusError decodes an error response from the TRISA API.
func (*StatusError) Error ¶
func (e *StatusError) Error() string
type StatusReply ¶
type StatusReply struct {
Status string `json:"status"`
Uptime string `json:"uptime,omitempty"`
Version string `json:"version,omitempty"`
}
Returned on status requests.
type Transaction ¶
type Transaction struct {
ID uuid.UUID `json:"id"`
Source string `json:"source"`
Status string `json:"status"`
Counterparty string `json:"counterparty"`
CounterpartyID ulid.ULID `json:"counterparty_id,omitempty"`
Originator string `json:"originator,omitempty"`
OriginatorAddress string `json:"originator_address,omitempty"`
Beneficiary string `json:"beneficiary,omitempty"`
BeneficiaryAddress string `json:"beneficiary_address,omitempty"`
VirtualAsset string `json:"virtual_asset"`
Amount float64 `json:"amount"`
LastUpdate *time.Time `json:"last_update,omitempty"`
EnvelopeCount int64 `json:"envelope_count,omitempty"`
Created time.Time `json:"created"`
Modified time.Time `json:"modified"`
}
func NewTransaction ¶
func NewTransaction(model *models.Transaction) (*Transaction, error)
func (*Transaction) ColorStatus ¶ added in v0.24.0
func (c *Transaction) ColorStatus() string
func (*Transaction) Model ¶
func (c *Transaction) Model() (model *models.Transaction, err error)
func (*Transaction) TitleStatus ¶ added in v0.14.0
func (c *Transaction) TitleStatus() string
func (*Transaction) TooltipStatus ¶ added in v0.24.0
func (c *Transaction) TooltipStatus() string
func (*Transaction) Validate ¶
func (c *Transaction) Validate() (err error)
type TransactionQuery ¶ added in v0.14.0
type TransactionQuery struct {
Detail string `json:"detail" url:"detail,omitempty" form:"detail"`
}
func (*TransactionQuery) Validate ¶ added in v0.14.0
func (q *TransactionQuery) Validate() (err error)
type TransactionsList ¶
type TransactionsList struct {
Page *PageQuery `json:"page"`
Transactions []*Transaction `json:"transactions"`
}
func NewTransactionList ¶
func NewTransactionList(page *models.TransactionPage) (out *TransactionsList, err error)
type TravelAddress ¶ added in v0.12.0
type TravelAddress struct {
Encoded string `json:"encoded,omitempty"`
Decoded string `json:"decoded,omitempty"`
}
func (*TravelAddress) ValidateDecode ¶ added in v0.12.0
func (t *TravelAddress) ValidateDecode() (err error)
func (*TravelAddress) ValidateEncode ¶ added in v0.12.0
func (t *TravelAddress) ValidateEncode() (err error)
type User ¶ added in v0.18.0
type User struct {
ID ulid.ULID `json:"id,omitempty"`
Name string `json:"name"`
Email string `json:"email"`
Password string `json:"password,omitempty"`
Role string `json:"role"`
LastLogin *time.Time `json:"last_login,omitempty"`
Created time.Time `json:"created,omitempty"`
Modified time.Time `json:"modified,omitempty"`
}
type UserPassword ¶ added in v0.18.0
func (UserPassword) Validate ¶ added in v0.18.0
func (u UserPassword) Validate() (err error)
type UserQuery ¶ added in v0.18.0
type UserQuery struct {
Detail string `json:"detail" url:"detail,omitempty" form:"detail"`
}
type ValidationErrors ¶
type ValidationErrors []*FieldError
Example ¶
err := api.ValidationError(
nil,
api.MissingField("name"),
api.IncorrectField("ssn", "ssn should be 8 digits only"),
nil,
api.MissingField("date_of_birth"),
nil,
)
fmt.Println(err)
Output: 3 validation errors occurred: missing name: this field is required invalid field ssn: ssn should be 8 digits only missing date_of_birth: this field is required
func (ValidationErrors) Error ¶
func (e ValidationErrors) Error() string