Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch? #89

Closed
RichardLitt opened this issue Jan 19, 2016 · 9 comments
Closed

Patch? #89

RichardLitt opened this issue Jan 19, 2016 · 9 comments

Comments

@RichardLitt
Copy link
Contributor

How do I use a PATCH method?

Example: octo.repos(result.owner.login, result.name).update({
description: 'test'
})

Thanks.

@philschatz
Copy link
Owner

It depends on if you are using callbacks or promises.

With promises:

octo.repos(result.owner.login, result.name).update({description: 'test'})
.then(function(updatedObject) {
  console.log(updatedObject);
});

With callbacks:

function cb(err, updatedObject) {
  console.log(updatedObj);
};
octo.repos(result.owner.login, result.name).update({description: 'test'}, cb);

@RichardLitt
Copy link
Contributor Author

Hmm. I've tried that.

Repo: https://github.com/RichardLitt/gh-description

node cli.js RichardLitt/awesome-nomad test

It's still not working. :/ Thoughts?

@philschatz
Copy link
Owner

Ah, according to https://developer.github.com/v3/repos/#edit it seems GitHub requires the name to be provided as well. Without the name I got a 422 response but once I added the name the description updated.

@RichardLitt
Copy link
Contributor Author

So, I tried that, and it still is returning this:

{ [Error: {"message":"Not Found","documentation_url":"https://developer.github.com/v3"}]
  status: 404,
  json: 
   { message: 'Not Found',
     documentation_url: 'https://developer.github.com/v3' } }

I'm still not sure if this is my fault.

@RichardLitt
Copy link
Contributor Author

The only difference between a working call and a failing one is turning .fetch() into .update({'name': 'test-repo', 'description: 'test'}). Doesn't look like it is a problem on my end.

@philschatz
Copy link
Owner

It seems the OAuth scope for the key that is generated is "public access" which is not enough to edit repo details. It would need to have either public_repo or repo. See https://developer.github.com/v3/oauth/#scopes for more details.

@RichardLitt
Copy link
Contributor Author

Fixed by deleting the config file and then adding scopes. Didn't work previously due to not overwriting the ghauth config file. Thanks!

@RichardLitt
Copy link
Contributor Author

I have the same Not Found bug again, and I have no idea how to diagnose it. How can I find out what URL is being used to hit the GitHub server?

@RichardLitt
Copy link
Contributor Author

Fixed by deleting the config file and then adding scopes. Didn't work previously due to not overwriting the ghauth config file. Thanks!

Did the same thing. Not sure why I keep running up against this. Not this module's bug at all.

<3 thank you for helping. Sorry for being a bit obstinate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants