fetchRequestConfig method

Future<Map<String, dynamic>> fetchRequestConfig()

Fetch the request configuration and progress from the backend. Equivalent to the React fetchRequestConfig.

Implementation

Future<Map<String, dynamic>> fetchRequestConfig() async {
  final url = Uri.parse(
    '${config.baseUrl}/individuals/${config.sessionId}/config',
  );

  final response = await _client.post(
    url,
    headers: _gatewayHeaders,
    body: jsonEncode({'request_id': config.sessionId}),
  );

  if (response.statusCode != 200) {
    throw DataleonApiException(
      'Failed to fetch request config',
      statusCode: response.statusCode,
    );
  }

  return jsonDecode(response.body) as Map<String, dynamic>;
}