# RewardsAPI

```swift
struct RewardsAPI
```

Campaigns and reward selection. Obtained from `FrakClient.rewards`.

**Conforms to** `Swift.Sendable`

Defined in: [Sources/FrakSDK/RewardsAPI.swift:4](https://github.com/frak-id/wallet/blob/35995d05c807efe1e0d6319fdede3ad363124d1e/sdk/ios/Sources/FrakSDK/RewardsAPI.swift#L4)

## Methods

### best(_:forceRefresh:)

```swift
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.

### campaigns(forceRefresh:)

```swift
func campaigns(forceRefresh: Bool = false) async throws -> [Campaign]
```

Active campaigns for this merchant, highest priority first.