import 'dart:convert';

import 'package:http/http.dart' as http;

import 'getHolidaysResponse.dart';

class GetHolidays {
  Future<GetHolidaysResponse> query() async {
    String response = (await http.get(Uri.parse("https://ferien-api.de/api/v1/holidays/HE"))).body;
    return GetHolidaysResponse(
        List<GetHolidaysResponseObject>.from(
            jsonDecode(response).map<GetHolidaysResponseObject>(
                    (dynamic i) => GetHolidaysResponseObject.fromJson(i)
            )
        )
    );
  }
}