Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Elixxir dApps SDK Swift
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
mobile
iOS
Elixxir dApps SDK Swift
Commits
2342343e
Commit
2342343e
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Add GroupSendReport model
parent
d98e0fa0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!102
Release 1.0.0
,
!24
Update Bindings
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Sources/ElixxirDAppsSDK/Models/GroupSendReport.swift
+33
-0
33 additions, 0 deletions
Sources/ElixxirDAppsSDK/Models/GroupSendReport.swift
Tests/ElixxirDAppsSDKTests/Models/GroupSendReportTests.swift
+31
-0
31 additions, 0 deletions
Tests/ElixxirDAppsSDKTests/Models/GroupSendReportTests.swift
with
64 additions
and
0 deletions
Sources/ElixxirDAppsSDK/Models/GroupSendReport.swift
0 → 100644
+
33
−
0
View file @
2342343e
import
Foundation
public
struct
GroupSendReport
:
Equatable
{
public
init
(
roundId
:
UInt64
,
timestamp
:
Int64
,
messageId
:
Data
)
{
self
.
roundId
=
roundId
self
.
timestamp
=
timestamp
self
.
messageId
=
messageId
}
public
var
roundId
:
UInt64
public
var
timestamp
:
Int64
public
var
messageId
:
Data
}
extension
GroupSendReport
:
Codable
{
enum
CodingKeys
:
String
,
CodingKey
{
case
roundId
=
"RoundID"
case
timestamp
=
"Timestamp"
case
messageId
=
"MessageID"
}
public
static
func
decode
(
_
data
:
Data
)
throws
->
Self
{
try
JSONDecoder
()
.
decode
(
Self
.
self
,
from
:
data
)
}
public
func
encode
()
throws
->
Data
{
try
JSONEncoder
()
.
encode
(
self
)
}
}
This diff is collapsed.
Click to expand it.
Tests/ElixxirDAppsSDKTests/Models/GroupSendReportTests.swift
0 → 100644
+
31
−
0
View file @
2342343e
import
CustomDump
import
XCTest
@testable
import
ElixxirDAppsSDK
final
class
GroupSendReportTests
:
XCTestCase
{
func
testCoding
()
throws
{
let
roundId
:
UInt64
=
123
let
timestamp
:
Int64
=
321
let
messageIdB64
=
"EB/70R5HYEw5htZ4Hg9ondrn3+cAc/lH2G0mjQMja3w="
let
jsonString
=
"""
{
"
RoundID
":
\(
roundId
)
,
"
Timestamp
":
\(
timestamp
)
,
"
MessageID
": "
\(
messageIdB64
)
"
}
"""
let
jsonData
=
jsonString
.
data
(
using
:
.
utf8
)
!
let
model
=
try
GroupSendReport
.
decode
(
jsonData
)
XCTAssertNoDifference
(
model
,
GroupSendReport
(
roundId
:
roundId
,
timestamp
:
timestamp
,
messageId
:
Data
(
base64Encoded
:
messageIdB64
)
!
))
let
encodedModel
=
try
model
.
encode
()
let
decodedModel
=
try
GroupSendReport
.
decode
(
encodedModel
)
XCTAssertNoDifference
(
decodedModel
,
model
)
}
}
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