QEDFile
public struct QEDFile : Codable
A QEDFile represents a media file to be notarized by the QEDSDK
-
Creates a
QEDFileinstance with the providedname,extanddateTakenfor the local file to represent.Declaration
Swift
public init(name: String, extension ext: String, dateTaken: Date)Parameters
nameA string representing the name of the local file without extension
extA string representing the extension of the local file
dateTakenA
Dateinstance representing the date the file was created -
Creates a
QEDFileinstance from a Dictionary from API response.Declaration
Swift
public init?(fromQEDAPIResponseDict dict: [String : Any])Parameters
dictA dictionary representation of a
QEDAPIqualified response with file dataReturn Value
A new
QEDFileinstance based ondict. It must include file_name, hash, slug and original_created_at as a minimum otherwise the instantiation will fail and returnnil.
-
Default storage directory for the
QEDFilerepresented files in the app’s bundle.This directory is used to store the files you want to represent as
QEDFile‘s for notarisation.You can create
QEDFileinstances usinginit(withName:extension:dateTaken:)and the localfileURLlocation will be assumed to be on the root level of this directory.Declaration
Swift
public static var qedDirectory: URL { get }
-
The name for the represented file without extension
Declaration
Swift
public var name: String -
The description for file
Declaration
Swift
public var description: String? -
A string representing the type of file (i.e the extension).
Declaration
Swift
public var ext: String -
The type of content of the file
Declaration
Swift
public var fileType: FileType -
The client date when the file was created.
Declaration
Swift
public var dateTaken: Date -
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? -
An optional arbritary dictionary of additional metadata.
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 report sent to backend as proof of existence of the associated file.
It is recommended to use SHA256 to calculate the hash, and the convenience method
withCalculatedHash()will take care of this for you.Declaration
Swift
public var hash: String? -
Returns a
QEDFileinstance with thehashcalculated from the file atlocalFileLocation.Declaration
Swift
public func withCalculatedHash() -> QEDFileReturn Value
Returns a copy of the current instance where the SHA256
hashhas been calculated from the data in file atlocalFileLocation. If there is no local file (i.e.localFileLocation== nil) or the hash has been previosuly calculated then the same unaffected instance is returned (i.e.self)
-
The URL where the file is meant to be locally stored.
There is no guarantee that a file actually exists at this URL. For existance check use
localFileLocationSeealso
localFileLocationDeclaration
Swift
public var fileURL: URL { get } -
Indicates if the instance references and existing local file at
fileURLDeclaration
Swift
public var hasLocalFile: Bool { get }
-
The status of the file upload to storage servers
Declaration
Swift
public var uploadStatus: UploadStatus -
The remote URL when file is stored on the web
Declaration
Swift
public var remoteUrl: URL? -
Indicates if the
QEDFilecan be uploaded.Declaration
Swift
public var canAttemptFileUpload: Bool { get }Return Value
falseIf the file does not have a local File to upload.falseIf the fileuploadStatus == uploadedsince it is already uploaded.falseIf the fileuploadStatus == externalsince the file is not meant to be uploaded to storate servers.falseIf not enough time has passed since the last upload attempt.trueotherwise. -
Use this method to update the date when a file upload has beet attempted for the QEDFile. This is used in conjuction with
canAttemptFileUploadto control the file upload attempts rate.Declaration
Swift
public func updatingFileUploadAttemptDate(_ date: Date) -> QEDFileReturn Value
A copy of the QEDFile with and updated last upload attempt date
-
Returns a dictionary representation of the instance.
The keys are
Stringinstances as described on QED REST API. Values areStringinstances derived from the respective instance attributes.Declaration
Swift
public func dictionaryRepresentation() -> [String : Any]Return Value
Returns a dictionary compatible with the
QEDAPIreporting functionality.
-
Returns a new
QEDFileinstance by merging the current instance with the providedQEDFileinstance.Declaration
Swift
public func merge(with file: QEDFile) -> QEDFileReturn Value
Returns a new
QEDFileinstance. All the properties of the providedQEDFileinstance that are nonnilwill prevail over the values for the attributes of the current instance. -
Indicates if the instance content and ids are identical to another
Declaration
Swift
public func isIdentical(to file: QEDFile) -> BoolReturn Value
trueifid,name,ext,slug,uploadStatusandmetadataare identical otherwisefalse
-
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 thedateTakenattribute of the instances.Declaration
Swift
public static func < (lhs: QEDFile, rhs: QEDFile) -> Bool -
Returns a Boolean value indicating whether two values are equal.
Two
QEDFileinstances are considered equal if they have the sameslug(i.e. They represent the same file on the backend).If one or both
QEDFile‘s are missing theslug, they are considered equal if they have the sameid.If one or both
QEDFile’s are missing theid, they are considered equal if they have the samenameandext.Declaration
Swift
public static func == (lhs: QEDFile, rhs: QEDFile) -> Bool
QEDFile Structure Reference