getEntity method

Future getEntity({
  1. required Uri uri,
  2. Map<String, String> headers = const {},
  3. ApptiveGridHalVersion? halVersion,
  4. ApptiveGridLayout layout = ApptiveGridLayout.field,
  5. bool isRetry = false,
})

Get a specific entity via a uri

headers will be added in addition to ApptiveGridClient.defaultHeaders halVersion describes what Hal Version of ApptiveGrid should be used.

This will return a Map of fieldIds and the respective values To know what DataType they are you need to Load a Grid via loadGrid and compare Grid.fields with the ids

The entity will be layed out according to layout The id of the entity can be accessed via ['_id']

Implementation

Future<dynamic> getEntity({
  required Uri uri,
  Map<String, String> headers = const {},
  ApptiveGridHalVersion? halVersion,
  ApptiveGridLayout layout = ApptiveGridLayout.field,
  bool isRetry = false,
}) async {
  return performApptiveLink(
    link: ApptiveLink(
      uri: uri.replace(
        queryParameters: {
          'layout': layout.queryParameter,
        },
      ),
      method: 'get',
    ),
    headers: headers,
    halVersion: halVersion,
    isRetry: isRetry,
    parseResponse: (response) async => response.body,
  );
}