Coder Social home page Coder Social logo

github.dart's People

Contributors

alexv525 avatar andersmholmgren avatar axel-op avatar azenla avatar bsutton avatar daanvandenhoek avatar dependabot[bot] avatar devoncarew avatar directcodebot avatar dnfield avatar dym-sh avatar ekweible avatar filiph avatar hixie avatar johnpryan avatar kevmoo avatar kristinbi avatar lefebvreilyas avatar marcojakob avatar nicolasgarnier avatar pacane avatar pd4d10 avatar piinks avatar pq avatar ricardoamador avatar robbecker-wf avatar robrbecker avatar thinkdigitalsoftware avatar tvolkert avatar xilaizhang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

github.dart's Issues

GitHub.dart v5

GitHub is switching to GraphQL. In order to support this, we should create a new version that supports this also.

This is not just a breaking change, it likely will be a completely different paradigm to use this library.

I'm targeting 3 months to release (Late October), but hope to have this ready sooner.

Fully Document Everything

Description

We need to document EVERYTHING.

Assistants

@TrainerGuy22

Tasks

  • Document GitHub Class
  • Document Model Objects
  • Document Dates Helper
  • Document Utility Library
  • Document Development Process

Unify API

Description

Unify the API Structure

Tasks

  • Ensure that all possible parameters are added to methods
  • Flexible
  • Not Cluttered

Use http package

We should probably use the http package on pub which provides some high-level functions and classes to consume HTTP resources.

This might make the classes http/client.dart, http/request.dart, and http/response.dart superfluous.

IssuesService.get fails, type cast error

The following app fails with 4.0.0 of the github package and the 2.1.0-dev.9.4 version of Dart used by the flutter project:

import 'dart:async';
import 'package:github/server.dart';

void main() {
  GitHub github = createGitHubClient(auth: new Authentication.withToken(myToken));
  RepositorySlug slug = RepositorySlug("flutter", "flutter");
  github.repositories.getRepository(slug).then((Repository repository) {
    github.issues.get(slug, 22781).then((Issue issue) {
      print(issue.htmlUrl);
    });
  });
}

Here's the swan song:


Unhandled exception:
type 'List<dynamic>' is not a subtype of type 'List<Map<String, dynamic>>' in type cast
#0      Issue.fromJSON (... pub.dartlang.org/github-4.0.0/lib/src/common/model/issues.dart:64:34)
#1      GitHub.getJSON (... pub.dartlang.org/github-4.0.0/lib/src/common/github.dart:226:32)
<asynchronous suspension>
#2      IssuesService.get (file:///usr/local/google/home/hansmuller/.pub-cache/hosted/pub.dartlang.org/github-4.0.0/lib/src/common/issues_service.dart:141:15)
#3      main.<anonymous closure> (package:issues/main.dart:9:19)

I tried the app with Dart VM version: 2.0.0-dev.36.0 since the package claims to support that version.

NoSuchMethodError: Attempted to use type 'IOClient' as a function. Since types do not define a method 'call', this is not possible. Did you intend to call the IOClient constructor and forget the 'new' operator?
Receiver: IOClient
Tried calling: IOClient()
#0      Object.noSuchMethod (dart:core-patch/dart:core/object_patch.dart:46)
#1      createClient (package:http/src/io_client.dart:16:38)
#2      new Client (package:http/src/client.dart:35:23)
#3      new GitHub (package:github/src/common/github.dart:48:44)
#4      createGitHubClient (package:github/server.dart:20:14)
#5      main (file:///usr/local/google/home/hansmuller/issues/lib/main.dart:6:19)

Release 4.0.1

There have been a few cast error fixes since 4.0.0; it would be great to get them out in a dot-release.

Listing repos for an org that has multiple page seem to go into a loop forever

On my app GitHub Issue Mover it seems that when trying to list the repos for an org that has lots of repos (multiple pages), like for example the dart-lang org or GoogleChrome or GoogleCloudSamples or google for instance The page 2 is being pulled forever when calling this method:

gitHub.repositories.listUserRepositories(orgName).toList()

When I look at the Network in Chrome dev tab I see the following page downloaded many may times:

Request URL:https://api.github.com/user/1778935/repos?type=owner&sort=full_name&direction=asc&page=2?type=owner&sort=full_name&direction=asc
Request Method:GET

The reponse does contains the following header:

Link:<https://api.github.com/user/1342004/repos?type=owner&sort=full_name&direction=asc&page=2>; rel="next", <https://api.github.com/user/1342004/repos?type=owner&sort=full_name&direction=asc&page=13>; rel="last"

But Page 2 is re-downloaded always.

I did not change anything in the app for month but surely App Engine deployed a new version so it might have downloaded a new version of github.dart. Any idea what could be causing this?

Cheers!

Support Enterprise APIs

Description

GitHub.dart is designed to do everything related to GitHub. This should include supporting GitHub Enterprise.

Unit Tests Needed

We need more unit tests for the following areas:

  • ActivityService
  • AuthorizationService
  • BlogService
  • ExploreService
  • GistsService
  • GitService
  • IssuesService
  • MiscService
  • OrganizationsService
  • PullRequestsService
  • RepositoriesService
  • SearchService
  • UrlShortenerService
  • UsersService

Inspiration for the tests can be taken from the following client libraries:

createComment: String contains invalid characters

The method createComment seems broken with non-ascii character:

import 'package:github/server.dart';

main() async {
  var github = createGitHubClient(auth: new Authentication.withToken('xx'));

  var repoSlug = new RepositorySlug('xx', 'yy');
  await github.issues.createComment(repoSlug, 1, '→');
}

gives

Unhandled exception:
Invalid argument(s): String contains invalid characters.
#0      _UnicodeSubsetEncoder.convert (dart:convert/ascii.dart:94)
#1      Codec.encode (dart:convert/codec.dart:22)
#2      _IOSinkImpl.write (dart:io/io_sink.dart:282)
#3      _HttpOutboundMessage.write (dart:io/http_impl.dart:488)
#4      _IOClient.request.<anonymous closure> (package:github/server.dart:109:13)
#5      _RootZone.runUnary (dart:async/zone.dart:1204)
#6      _FutureListener.handleValue (dart:async/future_impl.dart:131)
#7      _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:637)
#8      _Future._propagateToListeners (dart:async/future_impl.dart:667)
#9      _Future._completeWithValue (dart:async/future_impl.dart:477)
#10     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:528)
#11     _microtaskLoop (dart:async/schedule_microtask.dart:41)
#12     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#13     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:394)
#14     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:414)
#15     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)

or if I replace with à

Unhandled exception:
GitHub Error: Problems parsing JSON
#0      GitHub.handleStatusCode (package:github/src/common/github.dart:331:11)
#1      GitHub.request.<anonymous closure> (package:github/src/common/github.dart:417:9)
#2      _RootZone.runUnary (dart:async/zone.dart:1204)
#3      _FutureListener.handleValue (dart:async/future_impl.dart:131)
#4      _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:637)
#5      _Future._propagateToListeners (dart:async/future_impl.dart:667)
#6      _Future._completeWithValue (dart:async/future_impl.dart:477)
#7      _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:528)
#8      _microtaskLoop (dart:async/schedule_microtask.dart:41)
#9      _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#10     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:394)
#11     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:414)
#12     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)

Quiver version incompatible when using flutter current release

With github.dart@^3.0.0, you get this error:

[mobile_app] flutter packages get
Running "flutter packages get" in mobile_app...
Because every version of flutter_test from sdk depends on quiver 0.29.0+1 and github >=2.1.4 depends on quiver >=0.20.0 <0.25.0, flutter_test from sdk is incompatible with github >=2.1.4.
So, because gitizen_mobile_app depends on both github ^3.0.0 and flutter_test any from sdk, version solving failed.
pub get failed (1)
exit code 1

I'm overriding it like so:

# pubspec.yml
dependency_overrides:
  quiver: ^0.29.0

but I'd prefer not to. Is there a reason newer versions of quiver are restricted?

Error when parse hook

Cause: type 'List<dynamic>' is not a subtype of type 'List<String>' in type cast
#0      Object._as (dart:core/runtime/libobject_patch.dart:67:25)
#1      Hook.fromJSON (file:///Users/jimmy/.pub-cache/hosted/pub.dartlang.org/github-4.0.0/lib/src/common/model/repos_hooks.dart:38:34)
#2      RepositoriesService.createHook.<anonymous closure> (file:///Users/jimmy/.pub-cache/hosted/pub.dartlang.org/github-4.0.0/lib/src/common/repos_service.dart:428:51)
#3      GitHub.postJSON (file:///Users/jimmy/.pub-cache/hosted/pub.dartlang.org/github-4.0.0/lib/src/common/github.dart:283:19)
<asynchronous suspension>
#4      RepositoriesService.createHook (file:///Users/jimmy/.pub-cache/hosted/pub.dartlang.org/github-4.0.0/lib/src/common/repos_service.dart:427:20)

IssueModel null dispatch exception parsing JSON when no issues are logged for an issue

Seen in 4.1. I think this is the case --- I'm still debugging. Here's the call stack:

#1      Issue.fromJSON (file:///usr/local/google/home/rischpater/Projects/Flutter/mine/github.dart/lib/src/common/model/issues.dart:65:25)
#2      GitHub._requestJson (file:///usr/local/google/home/rischpater/Projects/Flutter/mine/github.dart/lib/src/common/github.dart:273:32)
<asynchronous suspension>
#3      GitHub.getJSON (file:///usr/local/google/home/rischpater/Projects/Flutter/mine/github.dart/lib/src/common/github.dart:196:7)
#4      IssuesService.get (file:///usr/local/google/home/rischpater/Projects/Flutter/mine/github.dart/lib/src/common/issues_service.dart:141:15)

I did some hacking and tried to fix it by updating model/issues.dart::65 to read

    List<Map<String, Object>> labels =
        input['labels']?.cast<Map<String, dynamic>>();
    if (labels == null) labels = <Map<String, dynamic>>[];

(note ?.), but now I'm in this weird state where I'm seeing some issues come back with all null fields, and I think I'm messing up something as a Dart newbie with the following .. chaining operations when I do this.

If someone wants to give me pointers as to a better fix, I'm happy to put something together and submit a PR -- I'm finding the package helpful and happy to contribute. Thanks!

When a Permission error happens we get a NullPointer Exception. A meaningful exception should be returned.

If we try to perform an operation on the GitHub API that is not allowed by lack of permission (for instance we authorized only to read public data access but we try to write or create something). We get an error like this:

The null object does not have a method 'map'. NoSuchMethodError: method not found: 'map' Receiver: null Arguments: [Closure: (dynamic) => dynamic]

And a 404 is logged in the JS console:

Failed to load resource: the server responded with a status of 404 (Not Found) https://api.github.com/repos/nicolasgarnier/test2/issues

Ideally we should get a meaningful error thrown instead of the NullPointerException.

FYI fixing this issue might be hard because I believe GitHub should be returning a 403 instead of a 404. This is a bug in the GitHub API and I've let GitHub know about it.

Simple example throws exception when parsing GitHub JSON response.

Consider the following code:

  /* Creates a GitHub Client */
  var github = createGitHubClient();

  github.repositories.getRepository(new RepositorySlug("DirectMyFile", "github.dart")).then((Repository repo) 
  {
    print(repo.description);
  });

When executing this code the following exception is thrown:

Uncaught Unhandled exception: 
FormatException: Unexpected character (at line 2, character 1)
//# sourceURL=https://api.github.com/repos/DirectMyFile/github.dart
^

#0      _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1326)
#1      _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:898)
#2      _parseJson (dart:convert-patch/convert_patch.dart:19)
#3      JsonDecoder.convert (dart:convert/json.dart:501)
#4      JsonCodec.decode (dart:convert/json.dart:129)
#5      GitHub.getJSON.<getJSON_async_body> (package:github/src/common/github.dart:251:21)
#6      _RootZone.runUnary (dart:async/zone.dart:1137)
...

If I set a break point just prior to the crash, I observe this input passed to decode:

{
    "id":22344823,"name":"github.dart","full_name":"DirectMyFile/github.dart",
    ... a lot of reasonable looking JSON ...
}
//# sourceURL=https://api.github.com/repos/DirectMyFile/github.dart

If I inspect the web traffic between my browser and the internet, I see the following HTTP response:

{
    "id":22344823,"name":"github.dart","full_name":"DirectMyFile/github.dart",
    ... a lot of reasonable looking JSON ...
}

Note the lack of the final //.

Flutter Support

I know this is currently for web but how much of this is just pure dart and could support flutter?

I dont mind doing a PR.

RepositoryCommit fails, type cast error

Similar to #124

import 'dart:async';
import 'package:github/server.dart';

void main() async {
  GitHub github =
      createGitHubClient(auth: new Authentication.withToken(myToken));
  RepositorySlug slug = RepositorySlug("flutter", "flutter");
  Stream<RepositoryCommit> commitResults =
      github.repositories.listCommits(slug);

  await for (RepositoryCommit commit in commitResults) {
    print(commit.commit.message);
  }
}

gives:

$ ./bin/github_bug.dart 
Unhandled exception:
type 'List<dynamic>' is not a subtype of type 'List<Map<String, dynamic>>' in type cast
#0      RepositoryCommit.fromJSON (file:///Users/amadison/.pub-cache/git/github.dart-25a5e78f4cc068f9a3dd544cb2d834ecff336972/lib/src/common/model/repos_commits.dart:55:42)
#1      _MapStream._handleData (dart:async/stream_pipe.dart:227:21)

Gists Support

Description

Support for Gists is important. I use Gists all the time!

Tasks

  • Add Model Types
  • Add Requests in GitHub Client

Group API Methods in Separate Service Classes

The Github class is a bit crowded with a lot of API methods. They could be grouped together into individual service classes (see the GitService for an example).

This would also make unittests and integration tests much cleaner.

Possible groups that could result in a separate Serviceinto the following categories:

  • CollaboratorService
  • CommitService
  • ContentsService
  • GitService (already implemented)
  • RepositoryService
  • PullRequestService
  • ... and more ...

An good place for inspiration are the Java and Go GitHub client libraries:

How to get an issue's comments?

How do I retrieve the comments for an issue?

I see there is a class named IssueComment and a property named Issue.commentCount, and so I expected to see something like List<IssueComment> Issue.comments but I'm not finding anything like that...

Hints?

repositories.createIssue() missing

I can't seem to find a way to create an Issue. it seems that repositories.createIssue() is missing.

I built a tool to move Github Issues and would need this function.

My tool: github-issue-mover.appspot.com

I'd like to switch to your Client lib!

Cheers!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.