createSinaSession method

Future<Chat> createSinaSession()

Creates a new chat. Returns the session ID if the API call is successful.

Implementation

Future<Chat> createSinaSession() async {
  final response =
  await callApi(endpoint: 'chats', method: 'post', isSinaAPI: true);
  if (response.statusCode == 201) {
    final responseData = json.decode(response.body);
    final createdUser = Chat.fromJson(responseData);
    return createdUser;
  } else {
    throw Exception(response);
  }
}