generateAccountUrl static method

Future<String> generateAccountUrl(
  1. String integrationId,
  2. Request request, {
  3. Link? graphLink,
})

Implementation

static Future<String> generateAccountUrl(
    String integrationId, Request request,
    {Link? graphLink}) async {
  if (graphLink == null) graphLink = GraphLinkCreator.create(request);
  final req = GgenerateAccountLinkingUrl(
      (b) => b..vars.integrationId = integrationId);
  final res = await graphLink
      .request(
          gql.Request(operation: req.operation, variables: req.vars.toJson()))
      .first;
  final errors = res.errors;
  if (errors != null && errors.isNotEmpty) {
    throw errors.first;
  }

  return GgenerateAccountLinkingUrlData.fromJson(res.data!)!
      .generateAccountLinkingUrl
      .url;
}