github 6.0.2

  • Readme
  • Changelog
  • Installing
  • 92

GitHub for Dart #

Pub

This is a library for interacting with GitHub in Dart. It works on all platforms including web, server, and Flutter. Please submit issues and pull requests, help out, or just give encouragement.

Notice: We are looking for contributors. If you're interested or have questions, join the chat at https://gitter.im/SpinlockLabs/community

Features #

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

Getting Started #

First, add the following to your pubspec.yaml:

dependencies:
  github: ^6.0.0

Then import the library

import 'package:github/github.dart';

and then use it:

Example #

import 'package:github/github.dart';

Future<void> main() async {
  /* Create a GitHub Client, with anonymous authentication by default */
  var github = GitHub();

  /*
  or Create a GitHub Client and have it try to find your token or credentials automatically
  In Flutter and in server environments this will search environment variables in this order
  GITHUB_ADMIN_TOKEN
  GITHUB_DART_TOKEN
  GITHUB_API_TOKEN
  GITHUB_TOKEN
  HOMEBREW_GITHUB_API_TOKEN
  MACHINE_GITHUB_API_TOKEN
  and then GITHUB_USERNAME and GITHUB_PASSWORD

  In a browser it will search keys in the same order first through the query string parameters
  and then in window sessionStorage
  */
  var github = GitHub(auth: findAuthenticationFromEnvironment());

  /* or Create a GitHub Client using an auth token */
  var github = GitHub(auth: Authentication.withToken('YourTokenHere'));

  /* or Create a GitHub Client using a username and password */
  var github = GitHub(auth: Authentication.basic('username', 'password'));

  Repository repo = await github.repositories.getRepository(RepositorySlug('user_or_org', 'repo_name'));
  /* Do Something with repo */
}

Contacting Us #

Join our Gitter chat at https://gitter.im/SpinlockLabs/community

v6.0.2 #

  • Fixed GitHubFile.text to properly decode content.

v6.0.1 #

v6.0.0 #

  • There's a single entrypoint now: package:github/github.dart
  • For web: browser specific helper methods have moved. use import package:github/browser_helper.dart (renderMarkdown, and createAvatorImage)
  • createGithubClient(...) has been removed. Just create a GitHub object directly now.
  • findAuthenticationFromEnvironment now works in both server/flutter and web environments
    • On the web, it will check the query string first, then localstorage
  • all static methods are now factory constructors
  • fromJSON is now fromJson everywhere
  • toJSON is now toJson everywhere
  • Use JsonSerializable everywhere
  • removed deprecated items
  • renamed some fields with ID at the end to be Id
  • most model constructors now have named parameters for all properties
  • GitHubFile.content is now exactly the content returned from the JSON API without newlines removed.

v5.5.0 #

v5.4.0 #

v5.3.0 #

  • Add the ability to upload release assets.
  • Add the ability to get an existing release by tag name.

Deprecations:

  • The draft and prerelease properties in the CreateRelease and Release
  • classes have been renamed to isDraft and isPrerelease for clarity.
  • Release.targetCommitsh has been renamed to Release.targetCommitish.
  • The release parameter in RepositoriesService.createRelease has been renamed to createRelease.
  • RepositoriesService.getRelease has been renamed to RepositoriesService.getReleaseById

v5.2.0 #

v5.1.0 #

v5.0.2 #

v5.0.1 #

v5.0.0 #

  • BREAKING RepositoriesService.listCollaborators now returns Stream<Collaborator> instead of Stream<User>.
    • Collaborator is a new type that includes collaborator-specific information.

v4.1.1 #

  • Require at least Dart 2.1.0.

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: ^6.0.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter 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/github.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
83
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
92
Learn more about scoring.

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

  • Dart: 2.6.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:github/github.dart.

Maintenance suggestions

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.3.0 <3.0.0
http ^0.12.0 0.12.0+2
http_parser ^3.1.1 3.1.3
json_annotation >=2.0.0 <4.0.0 3.0.0
meta ^1.1.0 1.1.8
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
path 1.6.4
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
build_runner any
build_test any
build_web_compilers any
json_serializable ^3.2.2
mockito ^3.0.0
pedantic ^1.0.0 1.8.0+1
test ^1.3.0
yaml ^2.2.0