octokat.js icon indicating copy to clipboard operation
octokat.js copied to clipboard

Get list of organization repositories

Open tbrand opened this issue 8 years ago • 3 comments
trafficstars

Hi there!

I got an error when I try to get a list of repositories belong to an organization. The code is like

const repos = await octokat.orgs(ORG_NAME).repos.fetchAll();

I got a correct result, however, octokat.js prints out a validation error.

Octokat BUG: Invalid Path. If this is actually a valid path then please update the URL_VALIDATOR. path=https://.../api/v3/organizations/.../repos?page=2

Could you fix this? Thanks!

tbrand avatar Sep 19 '17 10:09 tbrand

I have the same issue, this is because for the calls after the first, the url for the next page returned from github is:

https://github.example.com/api/v3/organizations/49/repos?page=2

So that is organizations instead of orgs, which the first page uses. The first call does not fail the url validation.

The same url pattern need to be repeated for organizations url, the same as for orgs url https://github.com/philschatz/octokat.js/blob/41ddab98b3a58c86b88c08dd68ffb4b9ad8775ea/src/grammar/url-validator.coffee#L51-L59

mokkabonna avatar Dec 14 '17 14:12 mokkabonna

@mokkabonna I'm hitting this same problem but unsure how to apply your suggested solution. Is there any chance you can raise a PR with the change in?

artdevgame avatar Dec 18 '17 12:12 artdevgame

Was this ever fixed? I'm attempting to do this now with 0.10.0 and am seeing the Octokat BUG: Invalid Path. error

davewongillies avatar Dec 05 '18 01:12 davewongillies