github-tools / github

A higher-level wrapper around the Github API. Intended for the browser.
BSD 3-Clause "New" or "Revised" License
3.6k stars 755 forks source link

isStarred() example, callback errors #585

Closed rontrek closed 4 years ago

rontrek commented 4 years ago

I am trying to do a isStarred() but getting error on callback if true or false, not sure if I am doing the right thing.

var gh = new GitHub({
   token: 'xxxxxxxx'
});

let repo = gh.getRepo({
    user: 'rontrek',
    repo: 'simple'
});

repo.isStarred(function(error, result, request) {
    console.log(request);
    if (error) {
        console.error(error);
        return;
    }
});

Console errors:

GET https://api.github.com/user/starred/[object%20Object] 404 (Not Found)
Error: 404 error making request get https://api.github.com/user/starred/[object Object]: "Not Found"(…)
j-rewerts commented 4 years ago

Which version of the library are you using?

rontrek commented 4 years ago

It's the unpkg dist (2.5.1?)

https://unpkg.com/github-api/dist/GitHub.bundle.min.js

j-rewerts commented 4 years ago

That's a super old release. Could I talk you into migrating to a newer version?

rontrek commented 4 years ago

Yes thanks, I will try it. btw, I assumed it was the latest because it is suggested in the project front page and readme.md

README.md last part..

<!-- just github-api source (5.3kb) -->
<script src="https://unpkg.com/github-api/dist/GitHub.min.js"></script>

<!-- standalone (20.3kb) -->
<script src="https://unpkg.com/github-api/dist/GitHub.bundle.min.js"></script>

Maybe update the cdn as well to the latest to avoid confusion.

j-rewerts commented 4 years ago

Oh nice catch!

j-rewerts commented 4 years ago

Closing. Let us know if you run into this issue in newer releases!