getSubscription method

Future<Map<String, dynamic>> getSubscription(
  1. String projectId
)

Corresponds to: GET /accounts/projects/{project_id}/sessions/{session_id} Returns a JSON dict: {"id","room_name","created_at"}

Implementation

Future<Map<String, dynamic>> getSubscription(String projectId) async {
  final uri = Uri.parse('$baseUrl/accounts/projects/$projectId/subscription');
  final response = await http.get(uri, headers: _getHeaders());

  if (response.statusCode >= 400) {
    throw MeshagentException(
      'Failed to get session. '
      'Status code: ${response.statusCode}, body: ${response.body}',
    );
  }
  return jsonDecode(response.body);
}