StoreState

public class StoreState<TStoreFrontItem>: Gloss.Decodable where TStoreFrontItem: BaseStoreStateProduct

Store data model.

  • Contains additional information about the store (ex. best value / most popular products).

    Declaration

    Swift

    public var metadata: [String: Any] = [:]
  • List of products that are apart of the store.

    Declaration

    Swift

    public var products: [TStoreFrontItem] = []
  • Returns TRUE if minimum one product contains a sale id

    Declaration

    Swift

    public var hasSaleItems = false
  • Chronos timer reference for this store state.

    Declaration

    Swift

    public var chronosTimer: TimeSequence? = nil
  • Returns TRUE if the state has a limited time being active.

    Declaration

    Swift

    public var hasChronosTimer: Bool
  • Returns TRUE if there’s a chronos timer reference and it is active.

    Declaration

    Swift

    public var isTimerActive: Bool
  • Initializes a StoreState object from a JSON object.

    Declaration

    Swift

    public required init?(json: JSON)

    Parameters

    json

    The json object to parse.

  • Creates a TValue object from the data in the

    Declaration

    Swift

    public func getMetadataValue<TValue>(key: String, defaultValue: TValue) -> TValue

    Parameters

    key

    The key to lookup.

    defaultValue

    Default value will be returned if the metadata is null or the key does not exist.

    Return Value

    TValue object.

  • Determines how many seconds are remaining in the sale.

    Declaration

    Swift

    public func timeRemainingInState() -> Int64

    Return Value

    Total seconds remaining in the sale as a Unix timestamp UTC.