getStatus method

Future<Campaign> getStatus(
  1. InstantlyApiClient client
)

Since Instantly has a weird design, use this function if you got the campaign's name or accounts first and then want to get the status.

Implementation

Future<Campaign> getStatus(InstantlyApiClient client) async {
  // If the status is already set, return a copy of the campaign.
  if (status != null) return copyWith();

  // If the status is not set, get the campaign from the API.
  final campaign = await client.getCampaignStatus(campaignId: id);
  return copyWith(status: campaign?.status);
}