uwdart 0.0.6

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 50

Pub

UWDart

Waterloo OpenData Client in Dart. UWDart will supports all OpenData endpoints, and will processes all returned data in JSON.

This project is under development at the moment but version 0.0.* versions are released. Supported EndPoints:

  • [x] FoodServices
  • [x] Feds
  • [x] Course
  • [x] Awards
  • [x] News
  • [x] API
  • [ ] Events
  • [ ] Blogs
  • [ ] Opportunities
  • [ ] Services
  • [ ] Weather
  • [ ] Terms
  • [ ] Resources
  • [ ] Codes
  • [ ] Building
  • [ ] Poi
  • [ ] Parking
  • [ ] Transit
  • [ ] Directory
  • [ ] Wireless
  • [ ] Server

In order to use this package, check Dart Package management and search for uwdart package.

The link to the latest version of uwdart is: https://pub.dartlang.org/packages/uwdart

Check ChangeLogs for all the changes being made.

Waterloo OpenData Api Documentation

https://github.com/uWaterloo/api-documentation

License

UWDart is licensed under the MIT License. See the LICENSE file for more information.

Waterloo OpenData is licensed under ODL (Open Data License) Agreement

0.0.6

Added

  • Made compatible with flutter

Modified

  • Switched to Dart 2
  • Switched from dartson (reflection) to built_values for JSON serialization
  • Changed News GetAllNews() method to getNews()
  • Changed Course getCoursePrerequisiteBySubjectCatalog to getCoursePrerequisite
  • Every endpoint returns a DataResponse now and this DataResponse contains meta from the http request and deserialized data
  • APIResponse is now fully serializable.
  • Deleted APIResponse rawString field from APIResponse because there is a toString method for the data field
  • makeRawRequest() now accepts a String for arguments and a map for the parameters
  • Made every endpoint call an explicit async

0.0.5

Added

  • Made compatible with browser and io
  • Added Food Services, Feds, and Awards Endpoints

Modified

  • Generic open, close and makeRequest functions removed
  • Endpoints provided through one class: UWDart

0.0.4

Added

  • Static ResponseParser
  • Added Static types where ever possible.
  • Exported API Endpoint for client to use.

0.0.3

Added

  • Implemented and documented API endpoint.
  • A Generic example added for all the Endpoints since they are similar.
  • Version 0.0.3 published.

Modified

  • Renamed CourseAPI, NewsAPI, UWAPI to CourseEndpoint, NewsEndpoint, and UWEndpoint respectively.
  • Deleted individual examples for course and news endpoints.
  • Internally modified how map data was being deserialize to objects.
  • Added static types for OpenConnection and CloseConnection.

0.0.1

Added

  • News API and Course API implemented and documented.
  • Examples added for CourseAPI and NewsAPI.
  • Initial version published.

example/example.dart

import 'dart:async';
import 'dart:io';
import 'package:uwdart/uwdart_io.dart';

Future main() async {
  String apiKey = await new File('key.txt').readAsString();

  // Create the client
  UWDart uwClient = new UWDart(apiKey);

  // create raw requests
  uwClient.makeRawRequest('courses/CS/245').then((data) {
    print(data.data);
    print('------------------------------------------------------');
    print('------------------------------------------------------\n');
  });

  final courses = await uwClient.course.getAllCourses();

  // The request to the api returns meta data which can be used by the user
  print(courses.meta);

  // For actual endpoint data, get it using data getter
  final courseData = courses.data;

  print('------------------------------------------------------');
  print('------------------------------------------------------\n');

  for (int i = 0; i < 50; i++) {
    String catalogNum = courseData[i].catalogNumber;
    String subject = courseData[i].subject;

    final courseSubject = await uwClient.course.getCourseBySubjectCatalog(subject, catalogNum);

    print('Course Name: ${courseData[i].title}');
    print('Course Subject: ${courseData[i].subject}');
    print('Course Catalog: ${courseData[i].catalogNumber}');
    print('Course ID: ${courseSubject.data.courseId}');
    print('Course Url: ${courseSubject.data.url}');
    print('------------------------------------------------------');
  }
  print('------------------------------------------------------\n');

  final news = await uwClient.news.getNews();

  for (final article in news.data) {
    String articleTitle = article.title;
    int articleID = article.id;
    String articleSite = article.site;
    String articleLink = article.link;

    print('News Article Title: ${articleTitle}');
    print('News Article ID: ${articleID}');
    print('News Article Site: ${articleSite}');
    print('News Article Link: ${articleLink}');
    print('------------------------------------------------------');
  }

  // close the connection when all done
  uwClient.close();
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  uwdart: "^0.0.6"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


      import 'package:uwdart/uwdart_browser.dart';

      import 'package:uwdart/uwdart_io.dart';
  
Version Uploaded Documentation Archive
0.0.6 May 2, 2018 Go to the documentation of uwdart 0.0.6 Download uwdart 0.0.6 archive
0.0.5 Apr 27, 2018 Go to the documentation of uwdart 0.0.5 Download uwdart 0.0.5 archive
0.0.4 Apr 10, 2018 Go to the documentation of uwdart 0.0.4 Download uwdart 0.0.4 archive
0.0.3 Apr 10, 2018 Go to the documentation of uwdart 0.0.3 Download uwdart 0.0.3 archive
0.0.2 Apr 7, 2018 Go to the documentation of uwdart 0.0.2 Download uwdart 0.0.2 archive
0.0.1 Apr 7, 2018 Go to the documentation of uwdart 0.0.1 Download uwdart 0.0.1 archive

Analysis

We analyzed this package on Jun 19, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
99 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
99 / 100
Overall score:
Weighted score of the above. [more]
50
Learn more about scoring.

Platforms

Detected platforms: web

Platform components identified in package: html.

Suggestions

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 65 hints.

    Run dartfmt to format lib/src/base/models/serializers.dart.

    Run dartfmt to format lib/src/base/models/serializers.g.dart.

    Similar analysis of the following files failed:

    • lib/src/base/models/uw_day.g.dart (hint)
    • lib/src/base/models/uw_image.dart (hint)
    • lib/src/base/models/uw_image.g.dart (hint)
    • lib/src/base/models/uw_open_hours.dart (hint)
    • lib/src/base/models/uw_open_hours.g.dart (hint)
    • lib/src/base/models/uw_special_day.dart (hint)
    • lib/src/base/models/uw_special_day.g.dart (hint)
    • lib/src/base/uwdart_base.dart (hint)
    • lib/src/data/api_request.dart (hint)
    • lib/src/data/model/api_response.g.dart (hint)
    • lib/src/data/model/meta.g.dart (hint)
    • lib/src/endpoints/api/api_endpoint.dart (hint)
    • lib/src/endpoints/api/model/api_changelog.dart (hint)
    • lib/src/endpoints/api/model/api_changelog.g.dart (hint)
    • lib/src/endpoints/api/model/api_method.g.dart (hint)
    • lib/src/endpoints/api/model/api_service.dart (hint)
    • lib/src/endpoints/api/model/api_service.g.dart (hint)
    • lib/src/endpoints/api/model/api_usage.g.dart (hint)
    • lib/src/endpoints/api/model/api_version.g.dart (hint)
    • lib/src/endpoints/awards/awards_endpoint.dart (hint)
    • lib/src/endpoints/awards/models/award.dart (hint)
    • lib/src/endpoints/awards/models/award.g.dart (hint)
    • lib/src/endpoints/course/course_endpoint.dart (hint)
    • lib/src/endpoints/course/models/course.g.dart (hint)
    • lib/src/endpoints/course/models/course_detailed.dart (hint)
    • lib/src/endpoints/course/models/course_detailed.g.dart (hint)
    • lib/src/endpoints/course/models/course_exam_schedule.dart (hint)
    • lib/src/endpoints/course/models/course_exam_schedule.g.dart (hint)
    • lib/src/endpoints/course/models/course_prerequisite.dart (hint)
    • lib/src/endpoints/course/models/course_prerequisite.g.dart (hint)
    • lib/src/endpoints/course/models/course_schedule.dart (hint)
    • lib/src/endpoints/course/models/course_schedule.g.dart (hint)
    • lib/src/endpoints/course/models/course_subject.dart (hint)
    • lib/src/endpoints/course/models/course_subject.g.dart (hint)
    • lib/src/endpoints/feds/feds_endpoint.dart (hint)
    • lib/src/endpoints/feds/models/feds_event.dart (hint)
    • lib/src/endpoints/feds/models/feds_event.g.dart (hint)
    • lib/src/endpoints/feds/models/feds_events_detailed.dart (hint)
    • lib/src/endpoints/feds/models/feds_events_detailed.g.dart (hint)
    • lib/src/endpoints/feds/models/feds_location.dart (hint)
    • lib/src/endpoints/feds/models/feds_location.g.dart (hint)
    • lib/src/endpoints/foodservices/foodservices_endpoint.dart (hint)
    • lib/src/endpoints/foodservices/models/foodservices_annoucement.dart (hint)
    • lib/src/endpoints/foodservices/models/foodservices_annoucement.g.dart (hint)
    • lib/src/endpoints/foodservices/models/foodservices_diet.dart (hint)
    • lib/src/endpoints/foodservices/models/foodservices_diet.g.dart (hint)
    • lib/src/endpoints/foodservices/models/foodservices_location.dart (hint)
    • lib/src/endpoints/foodservices/models/foodservices_location.g.dart (hint)
    • lib/src/endpoints/foodservices/models/foodservices_menu.dart (hint)
    • lib/src/endpoints/foodservices/models/foodservices_menu.g.dart (hint)
    • lib/src/endpoints/foodservices/models/foodservices_note.dart (hint)
    • lib/src/endpoints/foodservices/models/foodservices_note.g.dart (hint)
    • lib/src/endpoints/foodservices/models/foodservices_outlet.dart (hint)
    • lib/src/endpoints/foodservices/models/foodservices_outlet.g.dart (hint)
    • lib/src/endpoints/foodservices/models/foodservices_product.dart (hint)
    • lib/src/endpoints/foodservices/models/foodservices_product.g.dart (hint)
    • lib/src/endpoints/foodservices/models/foodservices_watcard_vendor.dart (hint)
    • lib/src/endpoints/foodservices/models/foodservices_watcard_vendor.g.dart (hint)
    • lib/src/endpoints/news/model/news.g.dart (hint)
    • lib/src/endpoints/news/model/news_detailed.dart (hint)
    • lib/src/endpoints/news/model/news_detailed.g.dart (hint)
    • lib/src/endpoints/news/model/news_site.g.dart (hint)
    • lib/src/endpoints/news/news_endpoint.dart (hint)
  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.32 <2.0.0
built_collection >=2.0.0 <4.0.0 3.1.1
built_value ^5.4.3 5.5.2
http ^0.11.3+16 0.11.3+16
Transitive dependencies
async 2.0.7
charcode 1.1.1
collection 1.14.10
fixnum 0.10.7
http_parser 3.1.2
matcher 0.12.3
meta 1.1.5
path 1.6.1
quiver 0.29.0+1
source_span 1.4.0
stack_trace 1.9.2
string_scanner 1.0.2
typed_data 1.1.5
Dev dependencies
build_runner ^0.8.6
built_value_generator ^5.4.3