getEditLink method

Future<Uri> getEditLink({
  1. required Uri uri,
  2. required String formId,
  3. Map<String, String> headers = const {},
  4. bool isRetry = false,
})

Creates and returns a Uri pointing to a Form filled with the Data represented for a given entitiy

headers will be added in addition to ApptiveGridClient.defaultHeaders

Requires Authorization throws Response if the request fails

Implementation

Future<Uri> getEditLink({
  required Uri uri,
  required String formId,
  Map<String, String> headers = const {},
  bool isRetry = false,
}) async {
  return (await performApptiveLink<Uri>(
    link: ApptiveLink(uri: uri, method: 'post'),
    body: jsonEncode({
      'formId': formId,
    }),
    headers: headers,
    isRetry: isRetry,
    parseResponse: (response) async => Uri.parse(
      ((json.decode(response.body) as Map)['uri'] as String)
          .replaceAll(RegExp('/r/'), '/a/'),
    ),
  ))!;
}