import 'dart:convert';

import '../../../requestCache.dart';
import 'getMessages.dart';
import 'getMessagesResponse.dart';

class GetMessagesCache extends RequestCache<GetMessagesResponse> {
  GetMessagesCache({onUpdate, renew}) : super(RequestCache.cacheMinute, onUpdate, renew: renew) {
    start('message');
  }

  @override
  GetMessagesResponse onLocalData(String json) => GetMessagesResponse.fromJson(jsonDecode(json));

  @override
  Future<GetMessagesResponse> onLoad() => GetMessages().run();
}