fromJson static method

IssueCollaborationToken200Response? fromJson(
  1. dynamic value
)

Returns a new IssueCollaborationToken200Response instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static IssueCollaborationToken200Response? 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'token'), 'Required key "IssueCollaborationToken200Response[token]" is missing from JSON.');
      assert(json[r'token'] != null, 'Required key "IssueCollaborationToken200Response[token]" has a null value in JSON.');
      assert(json.containsKey(r'ws_url'), 'Required key "IssueCollaborationToken200Response[ws_url]" is missing from JSON.');
      assert(json[r'ws_url'] != null, 'Required key "IssueCollaborationToken200Response[ws_url]" has a null value in JSON.');
      assert(json.containsKey(r'expires_at'), 'Required key "IssueCollaborationToken200Response[expires_at]" is missing from JSON.');
      assert(json[r'expires_at'] != null, 'Required key "IssueCollaborationToken200Response[expires_at]" has a null value in JSON.');
      assert(json.containsKey(r'expires_in'), 'Required key "IssueCollaborationToken200Response[expires_in]" is missing from JSON.');
      assert(json[r'expires_in'] != null, 'Required key "IssueCollaborationToken200Response[expires_in]" has a null value in JSON.');
      return true;
    }());

    return IssueCollaborationToken200Response(
      token: mapValueOfType<String>(json, r'token')!,
      wsUrl: mapValueOfType<String>(json, r'ws_url')!,
      room: mapValueOfType<String>(json, r'room'),
      expiresAt: mapDateTime(json, r'expires_at', r'')!,
      expiresIn: mapValueOfType<int>(json, r'expires_in')!,
    );
  }
  return null;
}