github.com/hyperledger/aries-framework-go@v0.3.2/pkg/didcomm/protocol/legacyconnection/event.go (about) 1 /* 2 Copyright Avast Software. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package legacyconnection 8 9 // connectionEvent implements connection.Event interface. 10 type connectionEvent struct { 11 connectionID string 12 invitationID string 13 } 14 15 // ConnectionID returns Connection connectionID. 16 func (ex *connectionEvent) ConnectionID() string { 17 return ex.connectionID 18 } 19 20 // InvitationID returns Connection invitationID. 21 func (ex *connectionEvent) InvitationID() string { 22 return ex.invitationID 23 } 24 25 // connectionEventError for sending events with processing error. 26 type connectionEventError struct { 27 connectionEvent 28 err error 29 } 30 31 // Error implements error interface. 32 func (ex *connectionEventError) Error() string { 33 if ex.err != nil { 34 return ex.err.Error() 35 } 36 37 return "" 38 } 39 40 // All implements EventProperties interface. 41 func (ex *connectionEvent) All() map[string]interface{} { 42 return map[string]interface{}{ 43 "connectionID": ex.ConnectionID(), 44 "invitationID": ex.InvitationID(), 45 } 46 } 47 48 // All implements EventProperties interface. 49 func (ex *connectionEventError) All() map[string]interface{} { 50 return map[string]interface{}{ 51 "connectionID": ex.ConnectionID(), 52 "invitationID": ex.InvitationID(), 53 "error": ex.Error(), 54 } 55 }