deleteConfig method

Future<Response> deleteConfig(
  1. String path, {
  2. Map<String, String> additionalHeaderFields = const <String, String>{},
})

Generates an authorized DELETE to the Config-API.

The path should starts with a /. For more information see https://config.s3i.vswf.dev/apidoc/#/. If you need to add additional information to the header, use additionalHeaderFields.

Throws a FormatException if the path could not be parsed to a valid Uri. Throws a NetworkAuthenticationException if AuthenticationManager.getAccessToken throws an exception. If there is no internet connection available a SocketException is thrown.

Implementation

Future<Response> deleteConfig(String path,
    {Map<String, String> additionalHeaderFields =
        const <String, String>{}}) async {
  String originalToken = '';
  try {
    final AccessToken token = await authManager.getAccessToken();
    originalToken = token.originalToken;
  } on Exception catch (e) {
    throw NetworkAuthenticationException(e);
  }
  final Map<String, String> headers = <String, String>{
    'Content-Type': 'application/json'
  }
    ..addAll(<String, String>{'Authorization': 'Bearer $originalToken'})
    ..addAll(additionalHeaderFields);
  return Client().delete(Uri.parse(configApiUrl + path), headers: headers);
}