gistr icon indicating copy to clipboard operation
gistr copied to clipboard

Add endpoint for gist commenting

Open jthomasmock opened this issue 3 years ago • 11 comments

Howdy! Really enjoying the package, any chance that y'all would add the Gist comment endpoint?

Gist comments API

I am successfully using something like the below, but that requires me to use some undocumented internal functions, primarily gistr:::gist_POST(). Primary usecase is adding Imgur hosted-images to gists, given that images aren't supported in upload.

gist_comment <- function(gist_id, body,...) {
  body <- jsonlite::toJSON(list(body= body), auto_unbox = TRUE)
  res <- gistr:::gist_POST(paste0(gistr:::ghbase(), '/gists/', gist_id, "/comments"), gistr::gist_auth(), gistr:::ghead(), body, ...)
  res$body
}

Code in action:


my_comment <- "### Code image at [https://i.imgur.com/rXkoukl.png](https://i.imgur.com/rXkoukl.png): ![](https://i.imgur.com/rXkoukl.png)"
gist_comment("c91a26923377ffdbbee7edbb7e2f4855", my_comment)

#> [1] "### Code image at [https://i.imgur.com/rXkoukl.png](https://i.imgur.com/rXkoukl.png): ![](https://i.imgur.com/rXkoukl.png)"

jthomasmock avatar May 10 '22 20:05 jthomasmock

hi @jthomasmock - thx for the issue. i'm not maintaining this anymore. @maelle is going to put a call out for new maintainers - do you have any interest?

sckott avatar May 12 '22 15:05 sckott

Ah gotcha, sorry for the drive by request!

I'll take a look but not ready to commit to maintaining as of yet. Not very familiar at all with OOP in crul. Would have to think on it. 👍

jthomasmock avatar May 12 '22 23:05 jthomasmock

See #85 (I'll also put it in the newsletter). Thanks @sckott!

FWIW @jthomasmock if you become the maintainer, you can swap dependencies to better fit your preferences. :wink:

maelle avatar May 13 '22 06:05 maelle

Continuing to think this over 😃 - in the meantime, @sckott - do you mind sharing the callback URL you are using for the gistr_oauth app so I can do some local testing?

jthomasmock avatar May 18 '22 22:05 jthomasmock

@jthomasmock I would but I don't see it in my account, it's probably an app in the github org account i'm guessing. @maelle could you look?

sckott avatar May 19 '22 23:05 sckott

I don't see an app whose name looks like it's that. :thinking: (I did clean up recently though :see_no_evil: )

maelle avatar May 20 '22 07:05 maelle

I was able to find the gistr_oauth app in my connections/applications/settings at: https://github.com/settings/connections/applications/89ecf04527f70e0f9730

Not sure if that app ID is a global GUID, but it looks like it may still be under your account @sckott

Screen Shot 2022-05-20 at 10 14 31 AM

jthomasmock avatar May 20 '22 15:05 jthomasmock

Good digging :detective: :ok_hand:

maelle avatar May 20 '22 16:05 maelle

@jthomasmock i found it finally, sorry about the delay. github UI change and I'm totally lost. here's the callback url

http://localhost:1410

sckott avatar May 24 '22 04:05 sckott

@jthomasmock ICYMI https://httr2.r-lib.org/articles/wrapping-apis.html#github-gists-api :-)

maelle avatar May 30 '22 10:05 maelle

Hi Everyone:

I'm writing to let you know that I haven't forgotten about this issue. Rather, in addition to trying to decide out how I should address this issue, I'm also trying to understand where I can start editing in a way so that I don't break the package with my first contributions. I'm going to follow up with @maelle via our Slack channel to get some tips for first time contributors to an rOpenSci package.

ScientificProgrammer avatar Aug 02 '22 15:08 ScientificProgrammer