createAffiliateApplyLink method
Builds an affiliate apply link for this user.
The link carries a short-lived token, so the affiliate the user becomes
is attributed back to them. Request it when the user asks to apply
rather than ahead of time. Omit groupSlug to link to the app's
default affiliate group.
Returns the link to open.
Implementation
Future<String> createAffiliateApplyLink({String? groupSlug}) async {
final request =
UserAffiliateApplyLinkRequest((b) => b..groupSlug = groupSlug);
final response = await _sdk._users.createAffiliateApplyLink(
appUserId: appUserId,
xApiKey: _sdk.apiKey,
userAffiliateApplyLinkRequest: request,
);
final body = response.data ??
(throw StateError(
'createAffiliateApplyLink: response body was empty for user '
'$appUserId.',
));
return body.data.link;
}