Aller au contenu

RewardsAPI

Ce contenu n’est pas encore disponible dans votre langue.

struct RewardsAPI

Campaigns and reward selection. Obtained from FrakClient.rewards.

Conforms to Swift.Sendable

Defined in: Sources/FrakSDK/RewardsAPI.swift:4

func best(
_ request: RewardRequest = RewardRequest(),
forceRefresh: Bool = false
) async throws -> BestReward?

The best reward worth advertising for request, formatted server-side. One call answers for the whole set it describes and cannot say which item earned it, so a listing screen calls this once for every visible product rather than once per row.

  • Parameters:
    • request: what to look the reward up for; products is advisory ranking context.
    • forceRefresh: skips the cache and the backoff.
  • Returns: nil when nothing matches.
  • Throws: FrakError when the lookup itself fails.
func campaigns(forceRefresh: Bool = false) async throws -> [Campaign]

Active campaigns for this merchant, highest priority first.