Skip to main content
Version: 3.3

ChargingManager

Handles pay-per-event charging.

Index

Constructors

constructor

Methods

calculateMaxEventChargeCountWithinLimit

  • calculateMaxEventChargeCountWithinLimit(eventName): number
  • How many events of a given type can still be charged for before reaching the limit; If the event is not registered, returns Infinity (free of charge)


    Parameters

    • eventName: string

    Returns number

charge

  • Charge for a specified number of events - sub-operations of the Actor.


    Parameters

    • options: ChargeOptions

      The name of the event to charge for and the number of events to be charged.

    Returns Promise<ChargeResult>

getChargedEventCount

  • getChargedEventCount(eventName): number
  • Get the number of events with given name that the Actor has charged for so far.


    Parameters

    • eventName: string

    Returns number

getMaxTotalChargeUsd

  • getMaxTotalChargeUsd(): number
  • Get the maximum amount of money that the Actor is allowed to charge.


    Returns number

getPricingInfo

init

  • init(): Promise<void>
  • Initialize the ChargingManager by loading pricing information and charging state via Apify API.


    Returns Promise<void>