list method

Future<ThreadMessagesListModel?> list(
  1. dynamic threadID,
  2. String order, {
  3. String? after,
  4. String? before,
  5. int? limit = 20,
})

LIST A THREAD

Implementation

Future<ThreadMessagesListModel?> list(threadID, String order, {String? after, String? before, int? limit = 20})async{
  Internet net = Internet();
  try{
    var res = await net.openAIAssitantGET("threads/$threadID/messages?limit=$limit", apiKey);

    if(res.statusCode == 200){
      var r = ThreadMessagesListModel.fromJson(jsonDecode(res.body));
      return r;
    }else{
      return null;
    }
  }catch(e){
    if (kDebugMode) {
      print(e.toString());
    }
    return null;
  }
}