QEDReport
public struct QEDReport : Codable
A QEDReport
represents a group of files stored that can be time stamped and notarised by the backend
-
Creates a
QEDReport
instance from scratch with a given nameDeclaration
Swift
public init(name: String)
Parameters
name
A String representing the name of the report
-
Creates a
QEDReport
instance from a Dictionary from API response.Declaration
Swift
public init?(fromQEDAPIResponseDict dict: [String : Any])
Parameters
dict
A dictionary representation of a
QEDAPI
qualified response with report dataReturn Value
A new
QEDReport
instance based ondict
. It must include name, slug, hash, created and status values as a minimum otherwise the instantiation will fail and returnnil
.
-
Storage directory for the downloaded PDF files in the app bundle.
Important
When downloading PDF certificates for a
QEDReport
using theQEDAPI
class, they will be automatically stored on the root level of this local directory.Note
You can get the exact PDF url by accessing the
pdfURL
property of theQEDReport
instance.Declaration
Swift
public static var pdfDirectory: URL { get }
-
The name for the stored report
Declaration
Swift
public var name: String
-
The client date when the report was created.
Note
Used only as metadata.Important
Will differ from the timestamp on the blockchain certificate.Declaration
Swift
public var created: Date
-
An optional string with a note about the report.
Declaration
Swift
public var note: String?
-
The array of associated files to the report
Declaration
Swift
public var files: [QEDFile]
-
A unique string that identifies the reported file in the backend.
Note
When initially created, this value isnil
.When using the
QEDAPI.send(_:in:completion:)
method to submit reports, this attribute gets updated based on the response from server.Declaration
Swift
public var slug: String?
-
Indicates if the reported has a slug, i.e. if already been created in the server.
Declaration
Swift
public var hasSlug: Bool { get }
-
The current status of the notarisation on the blockchain as reported by the backend.
Declaration
Swift
public var proofStatus: ProofStatus { get set }
-
An optional arbritary dictionary of additional metadata. The dictionary must be JSON encodable
Declaration
Swift
public var metadata: [String : Any]? { get set }
-
Undocumented
Declaration
Swift
public private(set) var metadataStore: [[String] : AnyCodable]?
-
The hash to be stored on the blockchain as proof of existence of the associated files.
Use the convenience method
withCalculatedHash()
to calculate the hash of the report.Declaration
Swift
public var hash: String?
-
Returns a
QEDReport
instance with thehash
calculated from the hash of the associated files.Important
Will calculate the hash of the associated files that are missing it.Declaration
Swift
public func withCalculatedHash() -> QEDReport
Return Value
Returns a copy of the current instance where the SHA256
hash
has been calculated from the hash of the associated files that have a hash value. If there is no associated files with a hash value then the same unaffected instance is returned (i.e.self
)
-
The URL for the PDF certificate file when locally stored.
Important
This property always holds a URL value without checking if the file actually exist.Seealso
hasLocalPDF
Use
hasLocalPDF
to check for PDF file existenceDeclaration
Swift
public var pdfURL: URL { get }
-
Indicates if the instance references and existing local certificate file at
pdfURL
Declaration
Swift
public var hasLocalPDF: Bool { get }
-
The remote URL when file is stored on the web
Declaration
Swift
public var certificateUrl: URL?
-
Returns a dictionary representation of the instance.
The keys are
String
instances as described on QED REST API. Values areAnyHashable
instances derived from the respective instance attributes.Declaration
Swift
public func dictionaryRepresentation() -> [String : Any]
Return Value
Returns a dictionary compatible with the
QEDAPI
reporting functionality.
-
Returns a new
QEDReport
instance by merging the current instance with the providedQEDReport
instance.Declaration
Swift
public func merge(with report: QEDReport) -> QEDReport
Return Value
Returns a new
QEDReport
instance. All the properties of the providedQEDReport
instance that are nonnil
will prevail over the values for the attributes of the current instance, theproofStatus
is also merged
-
Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.
<
is purely based on the same comparison executed on thecreated
attribute of the instances.Declaration
Swift
public static func < (lhs: QEDReport, rhs: QEDReport) -> Bool
-
Returns a Boolean value indicating whether two values are equal.
Two
QEDReport
instances are considered equal if they have the sameslug
(i.e. They represent the same report on the backend).If one or both
QEDReport
‘s are missing theslug
, they are considered equal if they have the sameid
.If one or both
QEDReport
’s are missing theid
, they are considered equal if they have the samename
.Declaration
Swift
public static func == (lhs: QEDReport, rhs: QEDReport) -> Bool