github 4.1.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 74

GitHub for Dart #

Build Status Pub

This is a Client Library for GitHub in Dart. I wrote this out of necessity, and then when I got a great reaction from the Dart community, I decided to put a lot of effort into it.

Please submit issues and pull requests, join my IRC channel (#directcode on irc.esper.net), help out, or just give me encouragement.

Notice: We are looking for major contributors. Contact us by email or on IRC!

Features #

Current #

  • Works on the Server and in the Browser
  • Really Fast
  • Plugable API
  • Supports Authentication
  • Builtin OAuth2 Flow
  • Hook Server Helper

Work in Progress #

  • Support all the GitHub APIs (Progress: 98%)

Getting Started #

First, add the following to your pubspec.yaml:

dependencies:
  github: ^4.0.0

Then import the library and use it:

For the Server

import 'package:github/server.dart';

void main() {
  /* Creates a GitHub Client */
  var github = createGitHubClient();
  
  github.repositories.getRepository(new RepositorySlug("DirectMyFile", "github.dart")).then((Repository repo) {
    /* Do Something */
  });
}

For the Browser

import 'package:github/browser.dart';

void main() {
  /* Creates a GitHub Client */
  var github = createGitHubClient();
  
  github.repositories.getRepository(new RepositorySlug("DirectMyFile", "github.dart")).then((Repository repo) {
    /* Do Something */
  });
}

Authentication #

To use a GitHub token:

var github = createGitHubClient(auth: new Authentication.withToken("YourTokenHere"));

Contacting Us #

You can find us on irc.esper.net and irc.freenode.net at #directcode.

v4.1.0 #

  • Fix return type of RepositoriesService.listContributors.
  • Fix return type of RepositoriesService.createRelease.
  • Fixed RepositoriesService.listContributorStats.
    • Removed unsupported limit parameter.
    • Removed flaky retry logic. Instead, NotReady is thrown, which can be used to decide to retry at the call site.
    • Made associated classes ContributorStatistics and ContributorWeekStatistics immutable. Since these classes are only meant as return values, we're not treating this as a breaking change.
  • Added Stream<CodeSearchResults> github.search.code(...) search API
    • Made CodeSearchResults class to hold search results
    • Made CodeSearchItem class to hold each search result item
    • Added a code search example

v4.0.1 #

  • Fix cast errors in event and issue queries.

v4.0.0 #

  • Make fields in many objects read-only.
  • Initial support for comparing commits.
  • Require at least Dart 2.0.0-dev.36.
  • Fix a number of type issues dealing with JSON.
  • BREAKING Removed ExploreServiceGitHub.explore.
  • BREAKING Removed MiscService.listOctodex.
  • BREAKING Removed BlogService - GitHub.blog.

v3.0.0 #

  • BREAKING Removed a number of top-level methods from the public API.
  • BREAKING Removed markdown.dart library – use the markdown package instead.
  • BREAKING Removed the dates.dart library.

v2.3.2 #

  • Automatically attempt to find GitHub user information in the process environment when running on the standalone VM.
  • Add ref parameter to getReadme method for the repository service.

v2.3.1 #

  • Cache base64 decoded text property in GitHubFile
  • Fix Bug in EventPoller
  • Added id to Milestone

v2.3.0 #

  • Moved CHANGELOG content back to repo.
  • Added rateLimitLimit, rateLimitRemaining and rateLimitReset to GitHub.
  • Added id to Issue
  • Added direction, sort and since optional arguments to IssueService.listByRepo.

v2.1.0 #

NOTICE: This is a major breaking release. This really should have been v2.0.0

  • New Service based API
  • Git Data API Fully Implemented

v2.0.0 #

  • File class renamed to GitHubFile (Breaking Change)
  • New Integration Tests (Tests the actual GitHub API).
  • Unit Testing System fully setup.
  • Git Data API partially implemented (this is a breaking change because of the new service system).
  • Fixes issues in fetching multiple repositories and users (fetching was very unreliable).
  • Adds a Markdown Rendering Helper (for rendering markdown in an element).
  • Team Membership API Implemented.
  • OAuth2 Flow API now uses some methods in the HTTP Library.
  • Organization Membership Updated to new API Changes.
  • Hook Server performance improvements.
  • Commit JSON Parsing now handles errors correctly.
  • Add Issue.toggleState() method which toggles it from open to closed or vice-versa.
  • Add Issue.isOpen and Issue.isClosed getters.

v1.3.1 #

  • A few bug fixes.
  • New Tests
  • Benchmarks
  • Markdown Generation Library

v1.3.0 #

v1.0.1 #

v1.0.0 #

v0.6.7 #

v0.6.6 #

v0.6.5 #

v0.6.4 #

v0.6.3 #

v0.6.2 #

v0.6.1 #

v0.6.0 #

v0.5.9 #

All the things!

v0.3.0 #

v0.2.0 #

v0.1.0 #

Initial Version

Use this package as a library

1. Depend on it

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


dependencies:
  github: ^4.1.0

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:github/browser.dart';
import 'package:github/server.dart';
  
Version Uploaded Documentation Archive
4.1.0 Jan 10, 2019 Go to the documentation of github 4.1.0 Download github 4.1.0 archive
4.0.1 Jan 4, 2019 Go to the documentation of github 4.0.1 Download github 4.0.1 archive
4.0.0 Nov 6, 2018 Go to the documentation of github 4.0.0 Download github 4.0.0 archive
3.0.2 Jul 12, 2017 Go to the documentation of github 3.0.2 Download github 3.0.2 archive
3.0.0 Aug 29, 2016 Go to the documentation of github 3.0.0 Download github 3.0.0 archive
2.3.1+1 Jan 13, 2016 Go to the documentation of github 2.3.1+1 Download github 2.3.1+1 archive
2.3.1 Dec 4, 2015 Go to the documentation of github 2.3.1 Download github 2.3.1 archive
2.3.0 Oct 3, 2015 Go to the documentation of github 2.3.0 Download github 2.3.0 archive
2.2.3+1 Jun 30, 2015 Go to the documentation of github 2.2.3+1 Download github 2.2.3+1 archive
2.2.3 Jun 29, 2015 Go to the documentation of github 2.2.3 Download github 2.2.3 archive

All 51 versions...

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

We analyzed this package on Feb 14, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13

Platforms

Detected platforms: web

Platform components identified in package: html, io.

Health suggestions

Fix lib/src/common/repos_service.dart. (-4.89 points)

Analysis of lib/src/common/repos_service.dart reported 10 hints, including:

line 14 col 19: Use = to separate a named parameter from its default value.

line 15 col 18: Use = to separate a named parameter from its default value.

line 16 col 23: Use = to separate a named parameter from its default value.

line 27 col 19: Use = to separate a named parameter from its default value.

line 28 col 18: Use = to separate a named parameter from its default value.

Fix lib/src/common/activity_service.dart. (-3.45 points)

Analysis of lib/src/common/activity_service.dart reported 7 hints, including:

line 13 col 44: Use = to separate a named parameter from its default value.

line 22 col 17: Use = to separate a named parameter from its default value.

line 125 col 16: Use = to separate a named parameter from its default value.

line 125 col 43: Use = to separate a named parameter from its default value.

line 135 col 16: Use = to separate a named parameter from its default value.

Fix lib/src/common/search_service.dart. (-2.48 points)

Analysis of lib/src/common/search_service.dart reported 5 hints:

line 14 col 72: Use = to separate a named parameter from its default value.

line 75 col 16: Use = to separate a named parameter from its default value.

line 76 col 16: Use = to separate a named parameter from its default value.

line 133 col 30: Use = to separate a named parameter from its default value.

line 133 col 46: Use = to separate a named parameter from its default value.

Fix additional 11 files with analysis or formatting issues. (-9.97 points)

Additional issues in the following files:

  • lib/src/browser/helper.dart (3 hints)
  • lib/src/common/pulls_service.dart (3 hints)
  • lib/src/common/util/pagination.dart (3 hints)
  • lib/src/common/git_service.dart (2 hints)
  • lib/src/common/model/repos_hooks.dart (2 hints)
  • lib/src/common/util/oauth2.dart (2 hints)
  • lib/browser.dart (1 hint)
  • lib/server.dart (1 hint)
  • lib/src/common/gists_service.dart (1 hint)
  • lib/src/common/github.dart (1 hint)
  • lib/src/common/misc_service.dart (1 hint)

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and github.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
http >=0.11.3 <0.13.0 0.12.0+1
http_parser ^3.1.1 3.1.3
json_annotation ^2.0.0 2.0.0
meta ^1.1.0 1.1.7
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
path 1.6.2
source_span 1.5.4
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
build_runner any
build_test any
build_web_compilers any
json_serializable ^2.0.0
mockito ^3.0.0
test ^1.3.0