uwdart 0.0.6

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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.32 <2.0.0

Admin