getString method

Future<String> getString (Weekday day)

Returns the raw response body for the given day of week.

Implementation

Future<String> getString(Weekday day) async {
  String url;

  switch (day) {
    case Weekday.Monday:
      url = path.join(this._url, 'tag_Mo.xml');
      break;

    case Weekday.Tuesday:
      url = path.join(this._url, 'tag_Di.xml');
      break;

    case Weekday.Wednesday:
      url = path.join(this._url, 'tag_Mi.xml');
      break;

    case Weekday.Thursday:
      url = path.join(this._url, 'tag_Do.xml');
      break;

    case Weekday.Friday:
      url = path.join(this._url, 'tag_Fr.xml');
      break;
  }

  http.Response response;

  if (this._authentication == null) {
    response = await this._client.get(url);
  } else {
    response = await this._client.get(url, headers: { 'Authorization': this._authentication });
  }

  return utf8.decode(response.bodyBytes);
}