addRecords method
addRecords()
- Method Creates New Item(s) on DNS Table
- Returns
true
if successful, false
otherwise
Required : List<DNSRecord>
Implementation
Future<bool> addRecords(List<DNSRecord> records) async {
// Convert Records to Map List
final List<Map<String, dynamic>> mappedRecords = records.map<Map<String, dynamic>>((e) => e.toMap()).toList();
// Build Request
var map = {'records': mappedRecords, 'deleteRecords': []};
var body = jsonEncode(map);
var resp = await put(apiUrl + apiDnsEndpoint, body, headers: authHeaders);
return resp.body != null ? resp.body["success"] : true;
}