@@ -21,7 +21,7 @@ Please submit issues and pull requests, help out, or just give encouragement.
2121
2222- [ Library Demos] ( http://github.directcode.org/demos/ )
2323- [ Pub Package] ( https://pub.dartlang.org/packages/github )
24- - [ Wiki] ( https://github.com/DirectMyFile /github.dart/wiki )
24+ - [ Wiki] ( https://github.com/SpinlockLabs /github.dart/wiki )
2525- [ Latest API reference] ( https://pub.dev/documentation/github/latest/ )
2626
2727## Getting Started
@@ -30,36 +30,49 @@ First, add the following to your pubspec.yaml:
3030
3131``` yaml
3232dependencies :
33- github : ^5 .0.0
33+ github : ^6 .0.0
3434` ` `
3535
3636Then import the library
3737
38- For the browser use:
3938` ` ` dart
40- import 'package:github/browser.dart';
41- ```
42-
43- and for the server or Flutter use:
44- ``` dart
45- import 'package:github/server.dart';
39+ import 'package:github/github.dart';
4640```
4741
4842and then use it:
4943
5044** Example**
5145``` dart
52- import 'package:github/browser.dart';
53-
54- void main() async {
55- /* Create a GitHub Client */
56- var github = createGitHubClient();
46+ import 'package:github/github.dart';
47+
48+ Future<void> main() async {
49+ /* Create a GitHub Client, with anonymous authentication by default */
50+ var github = GitHub();
51+
52+ /* or Create a GitHub Client and have it try to find your token or credentials automatically
53+ In Flutter and in server environments this will search environment variables in this order
54+ GITHUB_ADMIN_TOKEN
55+ GITHUB_DART_TOKEN
56+ GITHUB_API_TOKEN
57+ GITHUB_TOKEN
58+ HOMEBREW_GITHUB_API_TOKEN
59+ MACHINE_GITHUB_API_TOKEN
60+ and then GITHUB_USERNAME and GITHUB_PASSWORD
61+
62+ In a browser it will search keys in the same order first through the query string parameters
63+ and then in window sessionStorage
64+ */
65+ var github = GitHub(auth: findAuthenticationFromEnvironment());
5766
5867 /* or Create a GitHub Client using an auth token */
59- var github = createGitHubClient(auth: new Authentication.withToken("YourTokenHere"));
68+ var github = GitHub(auth: new Authentication.withToken("YourTokenHere"));
69+
70+ /* or Create a GitHub Client using a username and password */
71+ var github = GitHub(auth: new Authentication.basic('username', 'password'));
6072
6173 Repository repo = await github.repositories.getRepository(new RepositorySlug("user_or_org", "repo_name"));
6274 /* Do Something with repo */
75+
6376}
6477```
6578
0 commit comments