fromJson static method
Returns a new SIPInboundRoutingRuleResponse instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static SIPInboundRoutingRuleResponse? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
assert(json.containsKey(r'called_numbers'),
'Required key "SIPInboundRoutingRuleResponse[called_numbers]" is missing from JSON.');
assert(json[r'called_numbers'] != null,
'Required key "SIPInboundRoutingRuleResponse[called_numbers]" has a null value in JSON.');
assert(json.containsKey(r'created_at'),
'Required key "SIPInboundRoutingRuleResponse[created_at]" is missing from JSON.');
assert(json[r'created_at'] != null,
'Required key "SIPInboundRoutingRuleResponse[created_at]" has a null value in JSON.');
assert(json.containsKey(r'duration'),
'Required key "SIPInboundRoutingRuleResponse[duration]" is missing from JSON.');
assert(json[r'duration'] != null,
'Required key "SIPInboundRoutingRuleResponse[duration]" has a null value in JSON.');
assert(json.containsKey(r'id'),
'Required key "SIPInboundRoutingRuleResponse[id]" is missing from JSON.');
assert(json[r'id'] != null,
'Required key "SIPInboundRoutingRuleResponse[id]" has a null value in JSON.');
assert(json.containsKey(r'name'),
'Required key "SIPInboundRoutingRuleResponse[name]" is missing from JSON.');
assert(json[r'name'] != null,
'Required key "SIPInboundRoutingRuleResponse[name]" has a null value in JSON.');
assert(json.containsKey(r'trunk_ids'),
'Required key "SIPInboundRoutingRuleResponse[trunk_ids]" is missing from JSON.');
assert(json[r'trunk_ids'] != null,
'Required key "SIPInboundRoutingRuleResponse[trunk_ids]" has a null value in JSON.');
assert(json.containsKey(r'updated_at'),
'Required key "SIPInboundRoutingRuleResponse[updated_at]" is missing from JSON.');
assert(json[r'updated_at'] != null,
'Required key "SIPInboundRoutingRuleResponse[updated_at]" has a null value in JSON.');
return true;
}());
return SIPInboundRoutingRuleResponse(
callConfigs: SIPCallConfigsResponse.fromJson(json[r'call_configs']),
calledNumbers: json[r'called_numbers'] is Iterable
? (json[r'called_numbers'] as Iterable)
.cast<String>()
.toList(growable: false)
: const [],
callerConfigs:
SIPCallerConfigsResponse.fromJson(json[r'caller_configs']),
callerNumbers: json[r'caller_numbers'] is Iterable
? (json[r'caller_numbers'] as Iterable)
.cast<String>()
.toList(growable: false)
: const [],
createdAt: mapDateTime(json, r'created_at', r'')!,
directRoutingConfigs: SIPDirectRoutingRuleCallConfigsResponse.fromJson(
json[r'direct_routing_configs']),
duration: mapValueOfType<String>(json, r'duration')!,
id: mapValueOfType<String>(json, r'id')!,
name: mapValueOfType<String>(json, r'name')!,
pinProtectionConfigs: SIPPinProtectionConfigsResponse.fromJson(
json[r'pin_protection_configs']),
pinRoutingConfigs: SIPInboundRoutingRulePinConfigsResponse.fromJson(
json[r'pin_routing_configs']),
trunkIds: json[r'trunk_ids'] is Iterable
? (json[r'trunk_ids'] as Iterable)
.cast<String>()
.toList(growable: false)
: const [],
updatedAt: mapDateTime(json, r'updated_at', r'')!,
);
}
return null;
}