Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
goshimmer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iota-imt
goshimmer
Commits
af691344
Unverified
Commit
af691344
authored
4 years ago
by
Jonas Theis
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add message metadata to message/findById (#363)
parent
b848bb75
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/webapi/message/plugin.go
+22
-4
22 additions, 4 deletions
plugins/webapi/message/plugin.go
with
22 additions
and
4 deletions
plugins/webapi/message/plugin.go
+
22
−
4
View file @
af691344
...
...
@@ -6,10 +6,9 @@ import (
"github.com/iotaledger/goshimmer/packages/binary/messagelayer/message"
"github.com/iotaledger/goshimmer/plugins/messagelayer"
"github.com/iotaledger/goshimmer/plugins/webapi"
"github.com/labstack/echo"
"github.com/iotaledger/hive.go/logger"
"github.com/iotaledger/hive.go/node"
"github.com/labstack/echo"
)
// PluginName is the name of the web API message endpoint plugin.
...
...
@@ -51,19 +50,31 @@ func findMessageById(c echo.Context) error {
if
!
msgObject
.
Exists
()
{
continue
}
msgMetadataObject
:=
messagelayer
.
Tangle
.
MessageMetadata
(
msgId
)
if
!
msgMetadataObject
.
Exists
()
{
continue
}
msg
:=
msgObject
.
Unwrap
()
msgMetadata
:=
msgMetadataObject
.
Unwrap
()
msgResp
:=
Message
{
Metadata
:
Metadata
{
Solid
:
msgMetadata
.
IsSolid
(),
SolidificationTime
:
msgMetadata
.
SoldificationTime
()
.
Unix
(),
},
Id
:
msg
.
Id
()
.
String
(),
TrunkId
:
msg
.
TrunkId
()
.
String
(),
BranchId
:
msg
.
BranchId
()
.
String
(),
IssuerPublicKey
:
msg
.
IssuerPublicKey
()
.
String
(),
IssuingTime
:
msg
.
IssuingTime
()
.
String
(),
IssuingTime
:
msg
.
IssuingTime
()
.
Unix
(),
SequenceNumber
:
msg
.
SequenceNumber
(),
Payload
:
msg
.
Payload
()
.
Bytes
(),
Signature
:
msg
.
Signature
()
.
String
(),
}
result
=
append
(
result
,
msgResp
)
msgMetadataObject
.
Release
()
msgObject
.
Release
()
}
...
...
@@ -83,12 +94,19 @@ type Request struct {
// Message contains information about a given message.
type
Message
struct
{
Metadata
`json:"metadata,omitempty"`
Id
string
`json:"Id,omitempty"`
TrunkId
string
`json:"trunkId,omitempty"`
BranchId
string
`json:"branchId,omitempty"`
IssuerPublicKey
string
`json:"issuerPublicKey,omitempty"`
IssuingTime
string
`json:"issuingTime,omitempty"`
IssuingTime
int64
`json:"issuingTime,omitempty"`
SequenceNumber
uint64
`json:"sequenceNumber,omitempty"`
Payload
[]
byte
`json:"payload,omitempty"`
Signature
string
`json:"signature,omitempty"`
}
// Metadata contains metadata information of a message.
type
Metadata
struct
{
Solid
bool
`json:"solid,omitempty"`
SolidificationTime
int64
`json:"solidificationTime,omitempty"`
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment