ZDCUserBill

@interface ZDCUserBill : NSObject

Represents a user’s bill, which is their tally of cloud costs such as:

  • s3 storage consumption
  • sns push notification count
  • lambda cpu usage (in milliseconds)
  • bandwidth usage (in bytes)

Converting a bill to actual user costs is highly app dependent. But this class has tools to provide the tallies & raw cloud costs.

  • The bill metadata gives us information such as the year & month this bill represents.

    Declaration

    Objective-C

    @property (readonly, nonatomic) ZDCUserBillMetadata *_Nonnull metadata;

    Swift

    var metadata: ZDCUserBillMetadata { get }
  • Returns the raw rates dictionary.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSDictionary *_Nonnull rates;

    Swift

    var rates: [AnyHashable : Any] { get }
  • Returns a dictionary, with bills for specific apps (including the totals for all apps).

    The keys in the returned dictionary are treeIDs. For example: com.myCompany.myApp, com.4th-a.ZeroDarkTodo.

    If you want to know the totals (for all apps), use the key *.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        NSDictionary<NSString *, ZDCAppBill *> *_Nonnull apps;

    Swift

    var apps: [String : ZDCAppBill] { get }
  • Calculates the raw cloud costs for a given app, or the totals for all apps. If you want to know the totals (for all apps), you can pass *.

    This method invokes -calculateCost:zdcFee:, and passes the standard zdcFee of 5% (0.05).

    Declaration

    Objective-C

    - (nullable ZDCAppCost *)calculateCost:(nonnull NSString *)treeID;

    Swift

    func calculateCost(_ treeID: String) -> ZDCAppCost?

    Parameters

    treeID

    A ZeroDark.cloud treeID, as registered in the dashboard. For example: com.myCompany.myApp, com.4th-a.ZeroDarkTodo. If you want to know the totals (for all apps), you can pass *.

  • Calculates the raw cloud costs for a given app, or the totals for all apps. If you want to know the totals (for all apps), you can pass *.

    Declaration

    Objective-C

    - (nullable ZDCAppCost *)calculateCost:(nonnull NSString *)treeID
                                    zdcFee:(double)percentage;

    Swift

    func calculateCost(_ treeID: String, zdcFee percentage: Double) -> ZDCAppCost?

    Parameters

    treeID

    A ZeroDark.cloud treeID, as registered in the dashboard. For example: com.myCompany.myApp, com.4th-a.ZeroDarkTodo. If you want to know the totals (for all apps), you can pass *.

    percentage

    The zdcFee being applied. This is typically 5% (i.e. 0.05).