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 name

    Declaration

    Swift

    public init(name: String)

    Parameters

    name

    A String representing the name of the report

    Return Value

    A new QEDReport instance with the given name and a created date set to the current time. The initial value of status is undefined.

  • 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 data

    Return Value

    A new QEDReport instance based on dict. It must include name, slug, hash, created and status values as a minimum otherwise the instantiation will fail and return nil.

  • Storage directory for the downloaded PDF files in the app bundle.

    Important

    When downloading PDF certificates for a QEDReport using the QEDAPI 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 the QEDReport 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 is nil.

    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.

    Note

    This value must not be nil when issuing a report with the QEDAPI.send(_:in:completion:) method

    Use the convenience method withCalculatedHash() to calculate the hash of the report.

    Declaration

    Swift

    public var hash: String?
  • Returns a QEDReport instance with the hash 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 existence

    Declaration

    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 are AnyHashable 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 provided QEDReport instance.

    Declaration

    Swift

    public func merge(with report: QEDReport) -> QEDReport

    Return Value

    Returns a new QEDReport instance. All the properties of the provided QEDReport instance that are non nil will prevail over the values for the attributes of the current instance, the proofStatus 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 the created 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 same slug (i.e. They represent the same report on the backend).

    If one or both QEDReport‘s are missing the slug, they are considered equal if they have the same id.

    If one or both QEDReport’s are missing the id, they are considered equal if they have the same name.

    Declaration

    Swift

    public static func == (lhs: QEDReport, rhs: QEDReport) -> Bool