Documentation
¶
Index ¶
- Constants
- Variables
- func AddrLineRepr(line string) string
- func AddressTypeRepr(t ivms101.AddressTypeCode) string
- func ContextWithRequestID(parent context.Context, requestID string) context.Context
- func CountryName(country string) string
- func EndpointTravelAddress(endpoint, protocol string) (string, error)
- func ErrorStatus(err error) int
- func FindLegalName(person interface{}) int
- func FindPrimaryAddress(person interface{}) *ivms101.Address
- func MakeAddressLines(addr *ivms101.Address) (address []string)
- 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) ArchiveTransaction(ctx context.Context, transactionID uuid.UUID) (err error)
- func (s *APIv1) Authenticate(ctx context.Context, in *APIAuthentication) (out *LoginReply, err error)
- func (s *APIv1) ContactDetail(ctx context.Context, counterpartyID, contactID ulid.ULID) (out *Contact, 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) CreateContact(ctx context.Context, counterpartyID ulid.ULID, in *Counterparty) (out *Contact, 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) DBInfo(ctx context.Context) (out *DBInfo, 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) DeleteContact(ctx context.Context, counterpartyID, contactID 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) ListContacts(ctx context.Context, counterpartyID ulid.ULID, in *PageQuery) (out *ContactList, 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) SendSunrise(ctx context.Context, in *Sunrise) (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) UpdateContact(ctx context.Context, counterpartyID ulid.ULID, in *Counterparty) (out *Contact, 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) ValidateIVMS101(ctx context.Context, in []byte) (out *ivms101.IdentityPayload, err error)
- func (s *APIv1) WaitForReady(ctx context.Context) (err error)
- type Account
- type AccountsList
- type Client
- type ClientOption
- type Contact
- type ContactList
- type Counterparty
- type CounterpartyList
- type CryptoAddress
- type CryptoAddressList
- type DBInfo
- type DetailError
- type EncodingQuery
- func (q *EncodingQuery) Decode(data string) ([]byte, error)
- func (q *EncodingQuery) DetectEncoding(data string) string
- func (q *EncodingQuery) Encode(data []byte) (string, error)
- func (q *EncodingQuery) Marshal(in any) (_ string, err error)
- func (q *EncodingQuery) Unmarshal(in string, v any) (err error)
- func (q *EncodingQuery) Validate() (err error)
- type Envelope
- func (e *Envelope) BeneficiaryVASP() *ivms101.LegalPerson
- func (e *Envelope) Dump() string
- func (e *Envelope) FirstBeneficiary() *ivms101.NaturalPerson
- func (e *Envelope) FirstOriginator() *ivms101.NaturalPerson
- func (e *Envelope) OriginatorVASP() *ivms101.LegalPerson
- func (e *Envelope) ParseTransferState() trisa.TransferState
- func (e *Envelope) Payload() (payload *trisa.Payload, err error)
- func (e *Envelope) TransactionPayload() *generic.Transaction
- func (e *Envelope) Validate() (err error)
- 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 Sunrise
- type SunriseVerification
- 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} NotFound = Reply{Success: false, Error: "resource not found"} NotAllowed = Reply{Success: false, Error: "method not allowed"} )
var ( ErrInvalidTimestamp = errors.New("payload timestamp has invalid string format") ErrInvalidRejection = errors.New("envelope does not contain a rejection/repair error") ErrParsingIVMS101Person = errors.New("unable to parse IVMS101 person record as json or protocol buffers") ErrUnknownEncoding = errors.New("could not detect data encoding please specify and try again") )
Functions ¶
func AddrLineRepr ¶ added in v0.28.0
func AddressTypeRepr ¶ added in v0.28.0
func AddressTypeRepr(t ivms101.AddressTypeCode) string
func ContextWithRequestID ¶
Adds a request ID to the context which is sent with the request in the X-Request-ID header.
func CountryName ¶ added in v0.28.0
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 FindLegalName ¶ added in v0.28.0
func FindLegalName(person interface{}) int
Find the index in the name identifiers of the legal name of either a legal or natural person.
func FindPrimaryAddress ¶ added in v0.28.0
Find primary geographic address of a person in the IVMS101 dataset; the address is returned as a series of address lines to simplify the representation.
func MakeAddressLines ¶ added in v0.28.0
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) ArchiveTransaction ¶ added in v0.29.0
func (*APIv1) Authenticate ¶
func (s *APIv1) Authenticate(ctx context.Context, in *APIAuthentication) (out *LoginReply, err error)
func (*APIv1) ContactDetail ¶ added in v0.28.0
func (*APIv1) CounterpartyDetail ¶
func (*APIv1) CreateAPIKey ¶ added in v0.24.1
func (*APIv1) CreateAccount ¶
func (*APIv1) CreateContact ¶ added in v0.28.0
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) DeleteContact ¶ added in v0.28.0
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) ListContacts ¶ added in v0.28.0
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) SendSunrise ¶ added in v0.28.0
func (*APIv1) TransactionDetail ¶
func (*APIv1) UpdateAPIKey ¶ added in v0.24.1
func (*APIv1) UpdateAccount ¶
func (*APIv1) UpdateContact ¶ added in v0.28.0
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) ValidateIVMS101 ¶ added in v0.29.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,omitempty"` Created time.Time `json:"created,omitempty"` Modified time.Time `json:"modified,omitempty"` // contains filtered or unexported fields }
func NewAccount ¶
func NewAccount(model *models.Account, encoding *EncodingQuery) (out *Account, err error)
func (*Account) SetEncoding ¶ added in v0.26.0
func (a *Account) SetEncoding(encoding *EncodingQuery)
type AccountsList ¶
func NewAccountList ¶
func NewAccountList(page *models.AccountsPage) (out *AccountsList, err error)
type Client ¶
type Client interface { Status(context.Context) (*StatusReply, error) DBInfo(context.Context) (*DBInfo, 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 // Temporary Sunrise Action SendSunrise(context.Context, *Sunrise) (*Transaction, 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) ArchiveTransaction(context.Context, uuid.UUID) 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 // Contacts Resource ListContacts(ctx context.Context, counterpartyID ulid.ULID, in *PageQuery) (*ContactList, error) CreateContact(ctx context.Context, counterpartyID ulid.ULID, in *Counterparty) (*Contact, error) ContactDetail(ctx context.Context, counterpartyID, contactID ulid.ULID) (*Contact, error) UpdateContact(ctx context.Context, counterpartyID ulid.ULID, in *Counterparty) (*Contact, error) DeleteContact(ctx context.Context, counterpartyID, contactID 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) ValidateIVMS101(context.Context, []byte) (*ivms101.IdentityPayload, 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 Contact ¶ added in v0.28.0
type Contact struct { ID ulid.ULID `json:"id,omitempty"` Name string `json:"name"` Email string `json:"email"` Role string `json:"role"` Created time.Time `json:"created,omitempty"` Modified time.Time `json:"modified,omitempty"` }
type ContactList ¶ added in v0.28.0
func NewContactList ¶ added in v0.28.0
func NewContactList(page *models.ContactsPage) (out *ContactList, err error)
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,omitempty"` Endpoint string `json:"endpoint"` TravelAddress string `json:"travel_address,omitempty"` Name string `json:"name"` Website string `json:"website,omitempty"` Country string `json:"country"` BusinessCategory string `json:"business_category,omitempty"` VASPCategories []string `json:"vasp_categories,omitempty"` VerifiedOn *time.Time `json:"verified_on,omitempty"` IVMSRecord string `json:"ivms101,omitempty"` Contacts []*Contact `json:"contacts,omitempty"` Created time.Time `json:"created,omitempty"` Modified *time.Time `json:"modified,omitempty"` // contains filtered or unexported fields }
func NewCounterparty ¶
func NewCounterparty(model *models.Counterparty, encoding *EncodingQuery) (out *Counterparty, err error)
func (*Counterparty) IVMS101 ¶ added in v0.25.0
func (c *Counterparty) IVMS101() (p *ivms101.LegalPerson, err error)
func (*Counterparty) Model ¶
func (c *Counterparty) Model() (model *models.Counterparty, err error)
func (*Counterparty) SetEncoding ¶ added in v0.26.0
func (c *Counterparty) SetEncoding(encoding *EncodingQuery)
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,omitempty"` Tag string `json:"tag,omitempty"` 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)
func (*CryptoAddress) Validate ¶ added in v0.25.0
func (c *CryptoAddress) Validate(create bool) (err 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 DBInfo ¶ added in v0.28.0
type DBInfo struct { MaxOpenConnections int `json:"max_open_connections"` // Maximum number of open connections to the database. OpenConnections int `json:"open_connections"` // The number of established connections both in use and idle. InUse int `json:"in_use"` // The number of connections currently in use. Idle int `json:"idle"` // The number of idle connections. WaitCount int64 `json:"wait_count"` // The total number of connections waited for. WaitDuration string `json:"wait_duration"` // The total time blocked waiting for a new connection. MaxIdleClosed int64 `json:"max_idle_closed"` // The total number of connections closed due to SetMaxIdleConns. MaxIdleTimeClosed int64 `json:"max_idle_time_closed"` // The total number of connections closed due to SetConnMaxIdleTime. MaxLifetimeClosed int64 `json:"max_lifetime_closed"` // The total number of connections closed due to SetConnMaxLifetime. }
A copy of the sql.DBStats struct that implements JSON serialization.
type DetailError ¶
type EncodingQuery ¶ added in v0.26.0
type EncodingQuery struct { Encoding string `json:"encoding,omitempty" url:"encoding,omitempty" form:"encoding"` Format string `json:"format,omitempty" url:"format,omitempty" form:"format"` // contains filtered or unexported fields }
EncodingQuery manages how IVMS101 data is returned.
func (*EncodingQuery) Decode ¶ added in v0.26.0
func (q *EncodingQuery) Decode(data string) ([]byte, error)
func (*EncodingQuery) DetectEncoding ¶ added in v0.26.0
func (q *EncodingQuery) DetectEncoding(data string) string
func (*EncodingQuery) Encode ¶ added in v0.26.0
func (q *EncodingQuery) Encode(data []byte) (string, error)
func (*EncodingQuery) Marshal ¶ added in v0.26.0
func (q *EncodingQuery) Marshal(in any) (_ string, err error)
func (*EncodingQuery) Unmarshal ¶ added in v0.26.0
func (q *EncodingQuery) Unmarshal(in string, v any) (err error)
func (*EncodingQuery) Validate ¶ added in v0.26.0
func (q *EncodingQuery) Validate() (err error)
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"` 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"` Sunrise *generic.Sunrise `json:"sunrise,omitempty"` SentAt *time.Time `json:"sent_at"` ReceivedAt *time.Time `json:"received_at,omitempty"` Timestamp time.Time `json:"timestamp,omitempty"` PublicKeySignature string `json:"public_key_signature,omitempty"` TransferState string `json:"transfer_state,omitempty"` SecureEnvelope *SecureEnvelope `json:"secure_envelope,omitempty"` }
func NewEnvelope ¶ added in v0.14.0
func (*Envelope) BeneficiaryVASP ¶ added in v0.28.0
func (e *Envelope) BeneficiaryVASP() *ivms101.LegalPerson
Retrieves the Beneficiary VASP LegalPerson record
func (*Envelope) FirstBeneficiary ¶ added in v0.28.0
func (e *Envelope) FirstBeneficiary() *ivms101.NaturalPerson
Retrieves first beneficiary account in the identity payload that has a legal name.
func (*Envelope) FirstOriginator ¶ added in v0.28.0
func (e *Envelope) FirstOriginator() *ivms101.NaturalPerson
Retrieves first originator account in the identity payload that has a legal name.
func (*Envelope) OriginatorVASP ¶ added in v0.28.0
func (e *Envelope) OriginatorVASP() *ivms101.LegalPerson
Retrieves the Originator VASP LegalPerson record
func (*Envelope) ParseTransferState ¶ added in v0.22.0
func (e *Envelope) ParseTransferState() trisa.TransferState
func (*Envelope) TransactionPayload ¶ added in v0.28.0
func (e *Envelope) TransactionPayload() *generic.Transaction
Searches for the the transaction payload in the envelope, unwrapping transactions in pending or sunrise messages as a quick helper for transaction details. If no transaction is available or an error occurs, then nil is returned.
type EnvelopeListQuery ¶
type EnvelopeListQuery struct { PageQuery EnvelopeQuery }
type EnvelopeQuery ¶
type EnvelopeQuery struct { Decrypt bool `json:"decrypt" url:"decrypt,omitempty" form:"decrypt"` Archives bool `json:"archives" url:"archives,omitempty" form:"archives"` Direction string `json:"direction,omitempty" url:"direction,omitempty" form:"direction"` }
func (*EnvelopeQuery) Validate ¶ added in v0.30.1
func (q *EnvelopeQuery) Validate() (err error)
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 InvalidIVMS101 ¶ added in v0.26.0
func InvalidIVMS101(err *ivms101.FieldError) *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
func (*FieldError) Subfield ¶ added in v0.27.0
func (e *FieldError) Subfield(parent string) *FieldError
func (*FieldError) SubfieldArray ¶ added in v0.27.0
func (e *FieldError) SubfieldArray(parent string, index int) *FieldError
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"` Retry bool `json:"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"` 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"` }
SearchQuery manages fuzzy string searches.
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() (err 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"` 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 Sunrise ¶ added in v0.28.0
type Sunrise struct { Email string `json:"email"` Counterparty string `json:"counterparty"` Originator *Person `json:"originator"` Beneficiary *Person `json:"beneficiary"` Transfer *Transfer `json:"transfer"` }
func (*Sunrise) Transaction ¶ added in v0.28.0
func (s *Sunrise) Transaction() *generic.Transaction
type SunriseVerification ¶ added in v0.28.0
type SunriseVerification struct { Token string `json:"token,omitempty" url:"token,omitempty" form:"token"` // contains filtered or unexported fields }
Allows the user to pass a verification token via the URL.
func (*SunriseVerification) Validate ¶ added in v0.28.0
func (s *SunriseVerification) Validate() (err error)
func (*SunriseVerification) VerificationToken ¶ added in v0.28.0
func (s *SunriseVerification) VerificationToken() sunrise.VerificationToken
Returns the underlying verification token if it has already been parsed. It parses the token if not, but does not return the error (only) nil. Callers should ensure that Validate() is called first to ensure there will be no parse errors.
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"` Archived bool `json:"archived,omitempty"` ArchivedOn *time.Time `json:"archived_on,omitempty"` 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 ConvertIVMS101Errors ¶ added in v0.29.0
func ConvertIVMS101Errors(err ivms101.ValidationErrors) ValidationErrors
func (ValidationErrors) Error ¶
func (e ValidationErrors) Error() string