Git Product home page Git Product logo

Comments (44)

tarsius avatar tarsius commented on July 17, 2024 2

Tadaaa https://emacsair.me/2018/03/20/ghub-2.0.

from ghub.

tarsius avatar tarsius commented on July 17, 2024 1

Lets use those terms then.

from ghub.

vermiculus avatar vermiculus commented on July 17, 2024

I'm already working on a GraphQL DSL for v4 of the API; I'll get that uploaded some time this week. (Edit: done.) For the community's sake, that should probably be its own package.

As for the delimiting character, does it have to be printable? I guess so – this would make it easier for folks who manage their netrc by hand. Authentication across ghub/glab/??? should be coherent – even for unknown services. So, we can't really know the username rules for an unknown service, but in reality, all we have to determine is a CHAR that's unlikely to appear in an emacs package name. For a username like come@me-bro on some strange hosted git service, a 'username' netrc field of come@me-bro@my-package can still be easily parsed into come@me-bro and my-package. In the end, all we need to do is place restrictions on the characters that can appear in my-package – this should be easy to do with signals.

My instinct for your third question ("should we use the same format for the ghub package") is yes; it will be simpler to maintain just one method of authentication rather than several. I perceive ghub more as a service; it makes sense to me that ghub would feed back into itself by considering itself a service-consumer (of itself) rather than something special. (It's rather late here, so if that doesn't make sense to someone more alert, I can reword.)

from ghub.

tarsius avatar tarsius commented on July 17, 2024

For the community's sake, that should probably be its own package.

It might even be a good idea to add it to GNU Elpa.

As for the delimiting character, does it have to be printable?

I don't know if that is technically necessary, but it certainly make second-hand debugging easier

we have to determine is a CHAR that's unlikely to appear in an emacs package name ... @ ...

A package names just @ already exists 😝

All the concerns about what character might or might not lead to issues, I was also thinking about what makes sense. Normally @ is used when someone does/has/... something at something else, such as a person having an account at some place. But a user doesn't VERB something at a package, or a package at a user, so I feel something else should be used. ^ makes sense because that's what is commonly used to fake superscript and I feel that makes sense here "USER ^ (here comes additional information) while using PACKAGE".

My instinct for your third question ("should we use the same format for the ghub package") is yes

Same here.

from ghub.

tarsius avatar tarsius commented on July 17, 2024

Should auth be placed earlier?

That's actually the question I really wanted some feedback on. Or more generally, would you change the order of arguments? Why?

from ghub.

vermiculus avatar vermiculus commented on July 17, 2024

Ugh, @.el – always making things difficult 😉

For the parameter-order question, what's the use case for using ghub directly? If there's a use case, we should make it usable; otherwise I don't think it matters.

from ghub.

tarsius avatar tarsius commented on July 17, 2024

For the parameter-order question, what's the use case for using ghub directly?

If your package only needs, say, three GET requests and one POST request, then you might not want to create two wrappers for that and just use ghub-get and ghub-post instead. What do you think about:

-(resource &optional params data headers unpaginate noerror reader username auth host)
+(resource &optional params data headers auth unpaginate noerror reader username host)

from ghub.

tarsius avatar tarsius commented on July 17, 2024

or

-(resource &optional params data headers unpaginate noerror reader username auth host)
+(resource &optional auth params data headers unpaginate noerror reader username host)

or

-(resource &optional params data headers unpaginate noerror reader username auth host)
+(resource &optional params data headers &key unpaginate noerror reader username auth host)

from ghub.

tarsius avatar tarsius commented on July 17, 2024

Or maybe even over-complicate it and do the same thing as define-minor-mode:

  (declare (doc-string 2)
           (debug (&define name string-or-null-p
			   [&optional [&not keywordp] sexp
			    &optional [&not keywordp] sexp
			    &optional [&not keywordp] sexp]
			   [&rest [keywordp sexp]]
			   def-body)))

  ;; Allow skipping the first three args.
  (cond
   ((keywordp init-value)
    (setq body (if keymap `(,init-value ,lighter ,keymap ,@body)
		 `(,init-value ,lighter))
	  init-value nil lighter nil keymap nil))
   ((keywordp lighter)
    (setq body `(,lighter ,keymap ,@body) lighter nil keymap nil))
   ((keywordp keymap) (push keymap body) (setq keymap nil)))

Edit: ... no ...

from ghub.

vermiculus avatar vermiculus commented on July 17, 2024

Edit: ... no ...

...agree. To quote a legend:

Yeah, yeah, but your scientists were so preoccupied with whether or not they could that they didn't stop to think if they should.

Then again, that could be said for a lot of emacs packages 😉


Putting auth first affords good use of apply-partially, though putting it right after the big four seems more 'natural' to me somehow.

I do like the keyed approach. Even if it's a little verbose sometimes, it's explicit and parameters can come in any order a consumer wishes.

from ghub.

tarsius avatar tarsius commented on July 17, 2024

the big four

Is headers one of those? Or should that be a keyword argument too? I cannot remember a resource that requires it (and unfortunately the api docs don't come with a table that would make it easy to look such things up).

from ghub.

vermiculus avatar vermiculus commented on July 17, 2024

/notifications makes a big use of it, but other than that, not really. It's really just the If-Modified-Since header.

I think it's fine if that stays a keyword argument.

from ghub.

tarsius avatar tarsius commented on July 17, 2024

Then it just got demoted to keyword.

from ghub.

tarsius avatar tarsius commented on July 17, 2024

What about params and data - should those switch positions? And maybe params should be a keyword too. Our data is called "Parameters" in the Github documentation, which is a bit unfortunate. What uses params?

from ghub.

tarsius avatar tarsius commented on July 17, 2024

The documentation on this is a bit sparse: https://developer.github.com/v3/#parameters. So we could use params for "Parameters", but only for GET. But I think it is better to just always use data for all methods, for consistency. Which leads to the question of whether params is every really necessary?

from ghub.

vermiculus avatar vermiculus commented on July 17, 2024

Many endpoints use params (e.g. /notifications, /issues, ...) so I do think it's valuable to include it.

I don't think it's a safe assumption that only GET uses ?key=value&key=value and everything else uses a JSON payload.

Re naming, I've found that while the GitHub API documentation is very helpful, it's sometimes incomplete and a little... inconsistent. If we want, I think we can use more descriptive language:

params => query
data   => payload

payload is more descriptive of what data actually is; query is adapted from query string (since it's not a string that we're passing).

from ghub.

tarsius avatar tarsius commented on July 17, 2024

The documentation is confusing. It says "can" and "should" when it should apparently say "must". So what I just said above isn't true, we cannot always use a json payload even for GET.

(list
 (length (ghub-get "/orgs/magit/issues")) ; defaults to assigned
 (length (ghub-get "/orgs/magit/issues" '((filter . "created"))))
 (length (ghub-get "/orgs/magit/issues" nil '((filter . "created")))))
=> (2 30 2)

Here the json payload just gets ignored.

from ghub.

vermiculus avatar vermiculus commented on July 17, 2024

FYI, I edited-in some references to my suggestions of payload and query above. It seems these are the industry-accepted terms (at least as far as IETF is concerned).

from ghub.

tarsius avatar tarsius commented on July 17, 2024

I don't think it's a safe assumption that only GET uses ?key=value&key=value and everything else uses a JSON payload.

That's unfortunate - otherwise we could just use a single argument and then decide how to pass the parameters along based on the method.

from ghub.

tarsius avatar tarsius commented on July 17, 2024

I don't think it's a safe assumption that only GET uses ?key=value&key=value and everything else uses a JSON payload.

Lets get back to that. Really? Why not? It would be soooo nice 😥

from ghub.

vermiculus avatar vermiculus commented on July 17, 2024

My concern is the spec -- I worry that if it's allowed by the technology, there's nothing keeping GitHub from augmenting their API to use query parameters in POST requests (even though it would be weird).

from ghub.

tarsius avatar tarsius commented on July 17, 2024

We could use an optional, dwiming, argument params and add two keyword arguments :query and :payload. If only params is specified, then we would decide how to pass that along based on method. If Github does something weird for one resource, then we could still use :query or :payload to overwrite the dwim behavior. And finally if one of :query and :payload is specified and params too, then just use "the other" for params.

from ghub.

vermiculus avatar vermiculus commented on July 17, 2024

As long as this is called out in the docstring, that should be fine 😄

It seems a little over-engineered to me, but I may be underestimating the value of DWIM.

from ghub.

tarsius avatar tarsius commented on July 17, 2024

The biggest value is in us having talked about it. I have a much clearer picture now - I think.

I also think this would be a nice approach because the Github API documentation, as mentioned, only very briefly, in a hand-wavy fashion, and without using the proper terms, talks about when to use a query and when to use a payload. And for individual resources it only talks about "parameters" without specifying how those "parameters" are to be transmitted.

I don't think I am the only Emacs package author who will be confused by that, so it would be nice if "Github says 'parameters'" would just mean "provide a value as params to ghub-{get,post,...}".

from ghub.

tarsius avatar tarsius commented on July 17, 2024

To summarize:

(resource
 &optional params
 &key query payload headers
 unpaginate noerror reader
 username auth host)

from ghub.

vermiculus avatar vermiculus commented on July 17, 2024

Github says 'parameters' would just mean 'provide a value as params to ghub-get'...

This should be true in the 99% case (even for other services), so it's definitely a useful parallel 😄

(resource &optional params
          &key query payload headers
               unpaginate noerror reader
               username auth host)

Clear and succinct 👍

Given the special behavior params will have, will docstrings be added?

from ghub.

tarsius avatar tarsius commented on July 17, 2024

I intend to extend the documentation some more and then merge this into master (likely today or tomorrow), without tagging a release yet. We can then let linger it for another week and two and fix bugs if any are reported (in addition to #34) and you can start removing support in ghub+ and magithub for the legacy implementation before I release v2.

Does that sound good?

from ghub.

vermiculus avatar vermiculus commented on July 17, 2024

That sounds good to me 👍

from ghub.

tarsius avatar tarsius commented on July 17, 2024

Done.

While working on the documentation (which most likely still contains lots of typos) I noticed some things that should be improved. I could have worked on those before pushing to master, but given how this has played out (looooooooong delays) in the past I have decided to go and push what I have now.

from ghub.

vermiculus avatar vermiculus commented on July 17, 2024

Let me know if there's any way I can help – proofreading/development/etc. 😄

from ghub.

tarsius avatar tarsius commented on July 17, 2024

I just updated apiwrap, ghub+ and magithub and there are still many warning about ghub things, for the most part. Are you keeping v1+ support until v2 is released?

--- [apiwrap] ---

 Creating /home/jonas/.emacs.d/lib/apiwrap/apiwrap-autoloads.el...
Compiling /home/jonas/.emacs.d/lib/apiwrap/apiwrap.el...

In apiwrap-gendefun:
apiwrap.el:293:38:Warning: assignment to free variable ‘around’
apiwrap.el:319:13:Warning: reference to free variable ‘around’
Done (Total of 1 file compiled)

--- [ghub+] ---

 Creating /home/jonas/.emacs.d/lib/ghub+/ghub+-autoloads.el...
Compiling /home/jonas/.emacs.d/lib/ghub+/ghub+.el...

In toplevel form:
ghub+.el:86:17:Warning: Unused lexical variable ‘ghub-base-url’
ghub+.el:86:17:Warning: Unused lexical variable ‘ghub-authenticate’
ghub+.el:86:17:Warning: Unused lexical variable ‘ghub-username’
ghub+.el:86:17:Warning: Unused lexical variable ‘ghub-unpaginate’
ghub+.el:86:17:Warning: Unused lexical variable ‘ghub-extra-headers’

In ghubp-request:
ghub+.el:118:18:Warning: reference to free variable ‘ghub-extra-headers’
ghub+.el:119:18:Warning: reference to free variable ‘ghub-unpaginate’
ghub+.el:120:56:Warning: reference to free variable ‘ghub-username’
ghub+.el:121:56:Warning: reference to free variable ‘ghub-authenticate’
ghub+.el:122:56:Warning: reference to free variable ‘ghub-base-url’

In ghubp--follow:
ghub+.el:221:26:Warning: reference to free variable ‘ghub-base-url’

In ghubp-base-html-url:
ghub+.el:247:14:Warning: reference to free variable ‘ghub-base-url’
Done (Total of 1 file compiled)

--- [magithub] ---

 Creating /home/jonas/.emacs.d/lib/magithub/magithub-autoloads.el...
Compiling /home/jonas/.emacs.d/lib/magithub/magithub-ci.el...
Compiling /home/jonas/.emacs.d/lib/magithub/magithub-comment.el...
Compiling /home/jonas/.emacs.d/lib/magithub/magithub-core.el...

In magithub-debug--ghub-request-wrapper:
magithub-core.el:67:32:Warning: reference to free variable ‘ghub-base-url’

In magithub--api-available-p:
magithub-core.el:391:23:Warning: ghub--token called with 0 arguments, but
    requires 3-4
magithub-core.el:953:1:Warning: Lexical argument shadows the dynamic variable
    values
Compiling /home/jonas/.emacs.d/lib/magithub/magithub-dash.el...
Compiling /home/jonas/.emacs.d/lib/magithub/magithub-edit-mode.el...
Compiling /home/jonas/.emacs.d/lib/magithub/magithub-faces.el...
Compiling /home/jonas/.emacs.d/lib/magithub/magithub-issue-post.el...
Compiling /home/jonas/.emacs.d/lib/magithub/magithub-issue-tricks.el...
Compiling /home/jonas/.emacs.d/lib/magithub/magithub-issue-view.el...
Compiling /home/jonas/.emacs.d/lib/magithub/magithub-issue.el...

In magithub-issue-repo:
magithub-issue.el:221:49:Warning: reference to free variable ‘ghub-base-url’
Compiling /home/jonas/.emacs.d/lib/magithub/magithub-label.el...

In magithub-label-browse:
magithub-label.el:46:20:Warning: reference to free variable ‘ghub-base-url’
Compiling /home/jonas/.emacs.d/lib/magithub/magithub-notification.el...
Compiling /home/jonas/.emacs.d/lib/magithub/magithub-orgs.el...

In magithub-orgs-list:
magithub-orgs.el:32:15:Warning: ghub--username called with 0 arguments, but
    requires 1
Compiling /home/jonas/.emacs.d/lib/magithub/magithub-proxy.el...
Compiling /home/jonas/.emacs.d/lib/magithub/magithub-repo.el...
Compiling /home/jonas/.emacs.d/lib/magithub/magithub-user.el...
Compiling /home/jonas/.emacs.d/lib/magithub/magithub.el...

In magithub-create:
magithub.el:107:41:Warning: ghub--username called with 0 arguments, but
    requires 1

In magithub--read-user-or-org:
magithub.el:143:16:Warning: ghub--username called with 0 arguments, but
    requires 1

In magithub-clone--get-repo:
magithub.el:195:16:Warning: ghub--username called with 0 arguments, but
    requires 1
Done (Total of 17 files compiled)

from ghub.

vermiculus avatar vermiculus commented on July 17, 2024

Doesn't look like you've got the updated versions

from ghub.

tarsius avatar tarsius commented on July 17, 2024

Maybe I am stuck on a branch, let me check.

from ghub.

vermiculus avatar vermiculus commented on July 17, 2024

Build should be clean: https://travis-ci.org/vermiculus/magithub/jobs/310599951#L744

from ghub.

tarsius avatar tarsius commented on July 17, 2024

Doh! I only fetched.

There are still some unrelated warnings though (when using Emacs 26.0.90):

In apiwrap-gendefun:
apiwrap.el:293:38:Warning: assignment to free variable ‘around’
apiwrap.el:319:13:Warning: reference to free variable ‘around’

In toplevel form:
magithub-core.el:976:1:Warning: Lexical argument shadows the dynamic variable
    values

The last one is a bit annoying and not your fault. For Magit I "fixed" it like this: magit/magit@64be29b.

from ghub.

tarsius avatar tarsius commented on July 17, 2024

The values thing has apparently been fixed: magit/magit@64be29b#commitcomment-26004801.

from ghub.

vermiculus avatar vermiculus commented on July 17, 2024

Ah! Thanks :) I patched up apiwrap.el.

from ghub.

tarsius avatar tarsius commented on July 17, 2024
  (ghub-get "/user" nil :auth 'test)
Create and store such a token? (y or n)
  y
Username [for https://[email protected]]: tarsius
  RET
Password:
  wrong password, RET
Username [for https://api.github.com/authorizations]: jonas
  change to tarsius, RET
Password:
  correct password, RET
Unauthorized: "GET", "/authorizations", nil, nil, ((message . "Bad credentials") (documentation_url . "https://developer.github.com/v3"))

  (ghub-get "/user" nil :auth 'test)
Create and store such a token? (y or n)
  y
Save auth info to file ~/.authinfo.gpg? [y/n/N/e/?]
  y
Expected data.

  (ghub-get "/user" nil :auth 'test)
Expected data.
  • Does the second prompt come from the same url-basic-auth?
  • What happens if the username is not corrected at the second prompt?
  • If we decide to invalidate the cache to prevent wrong information from being cached, where would we do that?

from ghub.

tarsius avatar tarsius commented on July 17, 2024

@vermiculus This is ready for release now and I plan to do it in a few days. Could you please update your packages now?

from ghub.

vermiculus avatar vermiculus commented on July 17, 2024

I've made some of the necessary updates to both apiwrap and ghub+, but I'm having some trouble using this on emacs 25.3.1: url-asynchronous doesn't seem to be defined as a function.

Debugger entered--Lisp error: (void-function url-asynchronous)
  (url-asynchronous (progn nil (or (progn nil (and (vectorp req) (>= (length req) 12) (memq (aref req 0) cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (aref req 1)))
  (if (url-asynchronous (progn nil (or (progn nil (and (vectorp req) (>= (length req) 12) (memq (aref req 0) cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (aref req 1))) (set (make-local-variable (quote ghub-response-headers)) headers) (setq-default ghub-response-headers headers))
  (let (headers) (while (re-search-forward "^\\([^:]*\\): \\(.+\\)" url-http-end-of-headers t) (setq headers (cons (cons (match-string 1) (match-string 2)) headers))) (setq headers (nreverse headers)) (if url-http-end-of-headers nil (error "BUG: missing headers %s" (plist-get status :error))) (goto-char (1+ url-http-end-of-headers)) (if (url-asynchronous (progn nil (or (progn nil (and (vectorp req) (>= ... 12) (memq ... cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (aref req 1))) (set (make-local-variable (quote ghub-response-headers)) headers) (setq-default ghub-response-headers headers)) headers)
  ghub--handle-response-headers((:error (error http 404) :peer (:warnings (:insecure :unknown-ca :invalid) :certificate (:version 3 :serial-number "0d:9d:dd:e7:cf:ac:61:9a:c3:86:6f:ae:35:45:8a:94" :issuer "C=US,O=DigiCert Inc,OU=www.digicert.com,CN=DigiCert SHA2 High Assurance Server CA" :valid-from "2017-01-18" :valid-to "2020-04-17" :subject "C=US,ST=California,L=San Francisco,O=GitHub\\, Inc.,CN=*.github.com" :public-key-algorithm "RSA" :certificate-security-level "Medium" :signature-algorithm "RSA-SHA256" :public-key-id "sha1:13:0e:b7:b0:c1:b7:75:40:89:0f:0b:64:20:6b:53:a5:d2:2a:a8:07" :certificate-id "sha1:35:85:74:ef:67:35:a7:ce:40:69:50:f3:c0:f6:80:cf:80:3b:2e:19") :key-exchange "ECDHE-RSA" :protocol "TLS1.2" :cipher "AES-128-GCM" :mac "AEAD")) [cl-struct-ghub--req [cl-struct-url "https" nil nil "api.github.com" nil "/repos/vermiculus/magithu" nil nil t nil t] nil "GET" (closure ((forge) (username . "vermiculus") (auth) (host . "api.github.com") (headers ("Content-Type" . "application/json")) cl-struct-ghub--req-tags url-http-response-status url-http-extra-headers url-http-end-of-headers url-callback-arguments t) nil (if (eq auth (quote basic)) (if (eq forge (quote gitlab)) (error "Gitlab does not support basic authentication") (cons (cons "Authorization" (ghub--basic-auth host username)) headers)) (cons (ghub--auth host auth username forge) headers))) nil nil nil nil nil nil nil])
  (let* ((unpaginate (progn nil (or (progn nil (and (vectorp req) (>= ... 12) (memq ... cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (aref req 5))) (headers (ghub--handle-response-headers status req)) (payload (ghub--handle-response-payload req)) (payload (ghub--handle-response-error status payload req)) (value (nconc (progn nil (or (progn nil (and ... ... ... t)) (signal (quote wrong-type-argument) (list ... req))) (aref req 10)) payload)) (next (cdr (assq (quote next) (ghub-response-link-relations headers))))) (if (numberp unpaginate) (progn (setq unpaginate (1- unpaginate)))) (progn nil (or (progn nil (and (vectorp req) (>= (length req) 12) (memq (aref req 0) cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (let* ((v req)) (aset v 1 (url-generic-parse-url next)))) (progn nil (or (progn nil (and (vectorp req) (>= (length req) 12) (memq (aref req 0) cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (let* ((v req)) (aset v 10 value))) (progn nil (or (progn nil (and (vectorp req) (>= (length req) 12) (memq (aref req 0) cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (let* ((v req)) (aset v 5 unpaginate))) (or (and next unpaginate (or (eq unpaginate t) (> unpaginate 0)) (ghub-continue req)) (let ((callback (progn nil (or (progn nil ...) (signal ... ...)) (aref req 8))) (errorback (progn nil (or (progn nil ...) (signal ... ...)) (aref req 9))) (err (plist-get status :error))) (cond ((and err errorback) (funcall errorback err headers status req)) (callback (funcall callback value headers status req)) (t value)))))
  (progn (set-buffer-multibyte t) (let* ((unpaginate (progn nil (or (progn nil (and ... ... ... t)) (signal (quote wrong-type-argument) (list ... req))) (aref req 5))) (headers (ghub--handle-response-headers status req)) (payload (ghub--handle-response-payload req)) (payload (ghub--handle-response-error status payload req)) (value (nconc (progn nil (or (progn nil ...) (signal ... ...)) (aref req 10)) payload)) (next (cdr (assq (quote next) (ghub-response-link-relations headers))))) (if (numberp unpaginate) (progn (setq unpaginate (1- unpaginate)))) (progn nil (or (progn nil (and (vectorp req) (>= (length req) 12) (memq (aref req 0) cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (let* ((v req)) (aset v 1 (url-generic-parse-url next)))) (progn nil (or (progn nil (and (vectorp req) (>= (length req) 12) (memq (aref req 0) cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (let* ((v req)) (aset v 10 value))) (progn nil (or (progn nil (and (vectorp req) (>= (length req) 12) (memq (aref req 0) cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (let* ((v req)) (aset v 5 unpaginate))) (or (and next unpaginate (or (eq unpaginate t) (> unpaginate 0)) (ghub-continue req)) (let ((callback (progn nil (or ... ...) (aref req 8))) (errorback (progn nil (or ... ...) (aref req 9))) (err (plist-get status :error))) (cond ((and err errorback) (funcall errorback err headers status req)) (callback (funcall callback value headers status req)) (t value))))))
  (unwind-protect (progn (set-buffer-multibyte t) (let* ((unpaginate (progn nil (or (progn nil ...) (signal ... ...)) (aref req 5))) (headers (ghub--handle-response-headers status req)) (payload (ghub--handle-response-payload req)) (payload (ghub--handle-response-error status payload req)) (value (nconc (progn nil (or ... ...) (aref req 10)) payload)) (next (cdr (assq (quote next) (ghub-response-link-relations headers))))) (if (numberp unpaginate) (progn (setq unpaginate (1- unpaginate)))) (progn nil (or (progn nil (and (vectorp req) (>= ... 12) (memq ... cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (let* ((v req)) (aset v 1 (url-generic-parse-url next)))) (progn nil (or (progn nil (and (vectorp req) (>= ... 12) (memq ... cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (let* ((v req)) (aset v 10 value))) (progn nil (or (progn nil (and (vectorp req) (>= ... 12) (memq ... cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (let* ((v req)) (aset v 5 unpaginate))) (or (and next unpaginate (or (eq unpaginate t) (> unpaginate 0)) (ghub-continue req)) (let ((callback (progn nil ... ...)) (errorback (progn nil ... ...)) (err (plist-get status :error))) (cond ((and err errorback) (funcall errorback err headers status req)) (callback (funcall callback value headers status req)) (t value)))))) (if (buffer-live-p buffer) (progn (kill-buffer buffer))))
  (let ((buffer (current-buffer))) (unwind-protect (progn (set-buffer-multibyte t) (let* ((unpaginate (progn nil (or ... ...) (aref req 5))) (headers (ghub--handle-response-headers status req)) (payload (ghub--handle-response-payload req)) (payload (ghub--handle-response-error status payload req)) (value (nconc (progn nil ... ...) payload)) (next (cdr (assq ... ...)))) (if (numberp unpaginate) (progn (setq unpaginate (1- unpaginate)))) (progn nil (or (progn nil (and ... ... ... t)) (signal (quote wrong-type-argument) (list ... req))) (let* ((v req)) (aset v 1 (url-generic-parse-url next)))) (progn nil (or (progn nil (and ... ... ... t)) (signal (quote wrong-type-argument) (list ... req))) (let* ((v req)) (aset v 10 value))) (progn nil (or (progn nil (and ... ... ... t)) (signal (quote wrong-type-argument) (list ... req))) (let* ((v req)) (aset v 5 unpaginate))) (or (and next unpaginate (or (eq unpaginate t) (> unpaginate 0)) (ghub-continue req)) (let ((callback ...) (errorback ...) (err ...)) (cond (... ...) (callback ...) (t value)))))) (if (buffer-live-p buffer) (progn (kill-buffer buffer)))))
  ghub--handle-response((:error (error http 404) :peer (:warnings (:insecure :unknown-ca :invalid) :certificate (:version 3 :serial-number "0d:9d:dd:e7:cf:ac:61:9a:c3:86:6f:ae:35:45:8a:94" :issuer "C=US,O=DigiCert Inc,OU=www.digicert.com,CN=DigiCert SHA2 High Assurance Server CA" :valid-from "2017-01-18" :valid-to "2020-04-17" :subject "C=US,ST=California,L=San Francisco,O=GitHub\\, Inc.,CN=*.github.com" :public-key-algorithm "RSA" :certificate-security-level "Medium" :signature-algorithm "RSA-SHA256" :public-key-id "sha1:13:0e:b7:b0:c1:b7:75:40:89:0f:0b:64:20:6b:53:a5:d2:2a:a8:07" :certificate-id "sha1:35:85:74:ef:67:35:a7:ce:40:69:50:f3:c0:f6:80:cf:80:3b:2e:19") :key-exchange "ECDHE-RSA" :protocol "TLS1.2" :cipher "AES-128-GCM" :mac "AEAD")) [cl-struct-ghub--req [cl-struct-url "https" nil nil "api.github.com" nil "/repos/vermiculus/magithu" nil nil t nil t] nil "GET" (closure ((forge) (username . "vermiculus") (auth) (host . "api.github.com") (headers ("Content-Type" . "application/json")) cl-struct-ghub--req-tags url-http-response-status url-http-extra-headers url-http-end-of-headers url-callback-arguments t) nil (if (eq auth (quote basic)) (if (eq forge (quote gitlab)) (error "Gitlab does not support basic authentication") (cons (cons "Authorization" (ghub--basic-auth host username)) headers)) (cons (ghub--auth host auth username forge) headers))) nil nil nil nil nil nil nil])
  (save-current-buffer (set-buffer (let ((url-registered-auth-schemes (quote (("basic" ghub--basic-auth-errorback . 10))))) (url-retrieve-synchronously url silent))) (ghub--handle-response (car url-callback-arguments) req))
  (if (or (progn nil (or (progn nil (and (vectorp req) (>= (length req) 12) (memq (aref req 0) cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (aref req 8)) (progn nil (or (progn nil (and (vectorp req) (>= (length req) 12) (memq (aref req 0) cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (aref req 9))) (url-retrieve url (quote ghub--handle-response) (list req) silent) (save-current-buffer (set-buffer (let ((url-registered-auth-schemes (quote (...)))) (url-retrieve-synchronously url silent))) (ghub--handle-response (car url-callback-arguments) req)))
  (let ((url-request-extra-headers (let ((headers (progn nil (or ... ...) (aref req 4)))) (if (functionp headers) (funcall headers) headers))) (url-request-method (progn nil (or (progn nil (and (vectorp req) (>= ... 12) (memq ... cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (aref req 3))) (url-request-data payload) (url (progn nil (or (progn nil (and (vectorp req) (>= ... 12) (memq ... cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (aref req 1))) (silent (progn nil (or (progn nil (and (vectorp req) (>= ... 12) (memq ... cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (aref req 2)))) (if (or (progn nil (or (progn nil (and (vectorp req) (>= ... 12) (memq ... cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (aref req 8)) (progn nil (or (progn nil (and (vectorp req) (>= ... 12) (memq ... cl-struct-ghub--req-tags) t)) (signal (quote wrong-type-argument) (list (quote ghub--req) req))) (aref req 9))) (url-retrieve url (quote ghub--handle-response) (list req) silent) (save-current-buffer (set-buffer (let ((url-registered-auth-schemes (quote ...))) (url-retrieve-synchronously url silent))) (ghub--handle-response (car url-callback-arguments) req))))
  ghub--retrieve(nil [cl-struct-ghub--req [cl-struct-url "https" nil nil "api.github.com" nil "/repos/vermiculus/magithu" nil nil t nil t] nil "GET" (closure ((forge) (username . "vermiculus") (auth) (host . "api.github.com") (headers ("Content-Type" . "application/json")) cl-struct-ghub--req-tags url-http-response-status url-http-extra-headers url-http-end-of-headers url-callback-arguments t) nil (if (eq auth (quote basic)) (if (eq forge (quote gitlab)) (error "Gitlab does not support basic authentication") (cons (cons "Authorization" (ghub--basic-auth host username)) headers)) (cons (ghub--auth host auth username forge) headers))) nil nil nil nil nil nil nil])
  (progn (progn (or (or (booleanp unpaginate) (natnump unpaginate)) (cl--assertion-failed (quote (or (booleanp unpaginate) (natnump unpaginate))))) nil) (if (string-prefix-p "/" resource) nil (setq resource (concat "/" resource))) (if host nil (setq host (ghub--host forge))) (if (or username (stringp auth) (eq auth (quote none))) nil (setq username (ghub--username host forge))) (cond ((not params)) ((member method (quote ("GET" "HEAD"))) (if query (progn (error "PARAMS and QUERY are mutually exclusive for METHOD %S" method))) (setq query params)) (t (if payload (progn (error "PARAMS and PAYLOAD are mutually exclusive for METHOD %S" method))) (setq payload params))) (if payload (progn (if (stringp payload) nil (setq payload (json-encode-list payload))) (setq payload (encode-coding-string payload (quote utf-8))))) (if (or callback errorback) (progn (setq noerror t))) (ghub--retrieve payload (ghub--make-req :url (url-generic-parse-url (concat "https://" host resource (and query (concat "?" (ghub--url-encode-params query))))) :silent silent :method (encode-coding-string method (quote utf-8)) :headers (ghub--headers headers host auth username forge) :unpaginate unpaginate :noerror noerror :reader reader :callback callback :errorback errorback :extra extra)))
  (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) (quote (:query :payload :headers :silent :unpaginate :noerror :reader :username :auth :host :forge :callback :errorback :extra :allow-other-keys))) (setq --cl-keys-- (cdr (cdr --cl-keys--)))) ((car (cdr (memq ... --cl-rest--))) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:query :payload :headers :silent :unpaginate :noerror :reader :username :auth :host :forge :callback :errorback :extra)" (car --cl-keys--)))))) (progn (progn (or (or (booleanp unpaginate) (natnump unpaginate)) (cl--assertion-failed (quote (or (booleanp unpaginate) (natnump unpaginate))))) nil) (if (string-prefix-p "/" resource) nil (setq resource (concat "/" resource))) (if host nil (setq host (ghub--host forge))) (if (or username (stringp auth) (eq auth (quote none))) nil (setq username (ghub--username host forge))) (cond ((not params)) ((member method (quote ("GET" "HEAD"))) (if query (progn (error "PARAMS and QUERY are mutually exclusive for METHOD %S" method))) (setq query params)) (t (if payload (progn (error "PARAMS and PAYLOAD are mutually exclusive for METHOD %S" method))) (setq payload params))) (if payload (progn (if (stringp payload) nil (setq payload (json-encode-list payload))) (setq payload (encode-coding-string payload (quote utf-8))))) (if (or callback errorback) (progn (setq noerror t))) (ghub--retrieve payload (ghub--make-req :url (url-generic-parse-url (concat "https://" host resource (and query (concat "?" ...)))) :silent silent :method (encode-coding-string method (quote utf-8)) :headers (ghub--headers headers host auth username forge) :unpaginate unpaginate :noerror noerror :reader reader :callback callback :errorback errorback :extra extra))))
  (let* ((query (car (cdr (plist-member --cl-rest-- (quote :query))))) (payload (car (cdr (plist-member --cl-rest-- (quote :payload))))) (headers (car (cdr (plist-member --cl-rest-- (quote :headers))))) (silent (car (cdr (plist-member --cl-rest-- (quote :silent))))) (unpaginate (car (cdr (plist-member --cl-rest-- (quote :unpaginate))))) (noerror (car (cdr (plist-member --cl-rest-- (quote :noerror))))) (reader (car (cdr (plist-member --cl-rest-- (quote :reader))))) (username (car (cdr (plist-member --cl-rest-- (quote :username))))) (auth (car (cdr (plist-member --cl-rest-- (quote :auth))))) (host (car (cdr (plist-member --cl-rest-- (quote :host))))) (forge (car (cdr (plist-member --cl-rest-- (quote :forge))))) (callback (car (cdr (plist-member --cl-rest-- (quote :callback))))) (errorback (car (cdr (plist-member --cl-rest-- (quote :errorback))))) (extra (car (cdr (plist-member --cl-rest-- (quote :extra)))))) (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) (quote ...)) (setq --cl-keys-- (cdr ...))) ((car (cdr ...)) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:query :payload :headers :silent :unpaginate :noerror :reader :username :auth :host :forge :callback :errorback :extra)" (car --cl-keys--)))))) (progn (progn (or (or (booleanp unpaginate) (natnump unpaginate)) (cl--assertion-failed (quote (or ... ...)))) nil) (if (string-prefix-p "/" resource) nil (setq resource (concat "/" resource))) (if host nil (setq host (ghub--host forge))) (if (or username (stringp auth) (eq auth (quote none))) nil (setq username (ghub--username host forge))) (cond ((not params)) ((member method (quote ("GET" "HEAD"))) (if query (progn (error "PARAMS and QUERY are mutually exclusive for METHOD %S" method))) (setq query params)) (t (if payload (progn (error "PARAMS and PAYLOAD are mutually exclusive for METHOD %S" method))) (setq payload params))) (if payload (progn (if (stringp payload) nil (setq payload (json-encode-list payload))) (setq payload (encode-coding-string payload (quote utf-8))))) (if (or callback errorback) (progn (setq noerror t))) (ghub--retrieve payload (ghub--make-req :url (url-generic-parse-url (concat "https://" host resource (and query ...))) :silent silent :method (encode-coding-string method (quote utf-8)) :headers (ghub--headers headers host auth username forge) :unpaginate unpaginate :noerror noerror :reader reader :callback callback :errorback errorback :extra extra)))))
  (closure (cl-struct-ghub--req-tags url-http-response-status url-http-extra-headers url-http-end-of-headers url-callback-arguments t) (method resource &optional params &rest --cl-rest--) "Make a request for RESOURCE and return the response body.\n\nAlso place the response header in `ghub-response-headers'.\n\nMETHOD is the http method, given as a string.\nRESOURCE is the resource to access, given as a string beginning\n  with a slash.\n\nPARAMS, QUERY, PAYLOAD and HEADERS are alists used to specify\n  data.  The Github API documentation is vague on how data has\n  to be transmitted and for a particular resource usually just\n  talks about \"parameters\".  Generally speaking when the METHOD\n  is \"HEAD\" or \"GET\", then they have to be transmitted as a\n  query, otherwise as a payload.\nUse PARAMS to automatically transmit like QUERY or PAYLOAD would\n  depending on METHOD.\nUse QUERY to explicitly transmit data as a query.\nUse PAYLOAD to explicitly transmit data as a payload.\n  Instead of an alist, PAYLOAD may also be a string, in which\n  case it gets encoded as UTF-8 but is otherwise transmitted as-is.\nUse HEADERS for those rare resources that require that the data\n  is transmitted as headers instead of as a query or payload.\n  When that is the case, then the API documentation usually\n  mentions it explicitly.\n\nIf SILENT is non-nil, then don't message progress reports and\n  the like.\n\nIf UNPAGINATE is t, then make as many requests as necessary to\n  get all values.  If UNPAGINATE is a natural number, then get\n  at most that many pages.  For any other non-nil value raise\n  an error.\nIf NOERROR is non-nil, then do not raise an error if the request\n  fails and return nil instead.  If NOERROR is `return', then\n  return the error payload instead of nil.\nIf READER is non-nil, then it is used to read and return from the\n  response buffer.  The default is `ghub--read-json-payload'.\n  For the very few resources that do not return json, you might\n  want to use `ghub--decode-payload'.\n\nIf USERNAME is non-nil, then make a request on behalf of that\n  user.  It is better to specify the user using the Git variable\n  `github.user' for \"api.github.com\", or `github.HOST.user' if\n  connecting to a Github Enterprise instance.\n\nEach package that uses `ghub' should use its own token. If AUTH\n  is nil, then the generic `ghub' token is used instead.  This\n  is only acceptable for personal utilities.  A packages that\n  is distributed to other users should always use this argument\n  to identify itself, using a symbol matching its name.\n\n  Package authors who find this inconvenient should write a\n  wrapper around this function and possibly for the method\n  specific functions also.\n\n  Some symbols have a special meaning.  `none' means to make an\n  unauthorized request.  `basic' means to make a password based\n  request.  If the value is a string, then it is assumed to be\n  a valid token.  `basic' and an explicit token string are only\n  intended for internal and debugging uses.\n\n  If AUTH is a package symbol, then the scopes are specified\n  using the variable `AUTH-github-token-scopes'.  It is an error\n  if that is not specified.  See `ghub-github-token-scopes' for\n  an example.\n\nIf HOST is non-nil, then connect to that Github instance.  This\n  defaults to \"api.github.com\".  When a repository is connected\n  to a Github Enterprise instance, then it is better to specify\n  that using the Git variable `github.host' instead of using this\n  argument.\n\nIf FORGE is `gitlab', then connect to Gitlab.com or, depending\n  on HOST to another Gitlab instance.  This is only intended for\n  internal use.  Instead of using this argument you should use\n  function `glab-request' and other `glab-*' functions.\n\nIf CALLBACK and/or ERRORBACK is non-nil, then make one or more\n  asynchronous requests and call CALLBACK or ERRORBACK when\n  finished.  If an error occurred, then call ERRORBACK, or if\n  that is nil, then CALLBACK.  When no error occurred then call\n  CALLBACK.  When making asynchronous requests, then no errors\n  are signaled, regardless of the value of NOERROR.\n\nBoth callbacks are called with four arguments.\n  1. For CALLBACK, the combined value of the retrieved pages.\n     For ERRORBACk, the error that occured when retrieving the\n     last page.\n  2. The headers of the last page as an alist.\n  3. Status information provided by `url-retrieve'. Its `:error'\n     property holds the same information as ERRORBACK's first\n     argument.\n  4. A `ghub--req' struct, which can be passed to `ghub-continue'\n     (which see) to retrieve the next page, if any.\n\n(fn METHOD RESOURCE &optional PARAMS &key QUERY PAYLOAD HEADERS SILENT UNPAGINATE NOERROR READER USERNAME AUTH HOST FORGE CALLBACK ERRORBACK EXTRA)" (let* ((query (car (cdr (plist-member --cl-rest-- (quote :query))))) (payload (car (cdr (plist-member --cl-rest-- (quote :payload))))) (headers (car (cdr (plist-member --cl-rest-- (quote :headers))))) (silent (car (cdr (plist-member --cl-rest-- (quote :silent))))) (unpaginate (car (cdr (plist-member --cl-rest-- (quote :unpaginate))))) (noerror (car (cdr (plist-member --cl-rest-- (quote :noerror))))) (reader (car (cdr (plist-member --cl-rest-- (quote :reader))))) (username (car (cdr (plist-member --cl-rest-- (quote :username))))) (auth (car (cdr (plist-member --cl-rest-- (quote :auth))))) (host (car (cdr (plist-member --cl-rest-- (quote :host))))) (forge (car (cdr (plist-member --cl-rest-- (quote :forge))))) (callback (car (cdr (plist-member --cl-rest-- (quote :callback))))) (errorback (car (cdr (plist-member --cl-rest-- (quote :errorback))))) (extra (car (cdr (plist-member --cl-rest-- (quote :extra)))))) (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq ... ...) (setq --cl-keys-- ...)) ((car ...) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:query :payload :headers :silent :unpaginate :noerror :reader :username :auth :host :forge :callback :errorback :extra)" ...))))) (progn (progn (or (or (booleanp unpaginate) (natnump unpaginate)) (cl--assertion-failed (quote ...))) nil) (if (string-prefix-p "/" resource) nil (setq resource (concat "/" resource))) (if host nil (setq host (ghub--host forge))) (if (or username (stringp auth) (eq auth (quote none))) nil (setq username (ghub--username host forge))) (cond ((not params)) ((member method (quote ...)) (if query (progn ...)) (setq query params)) (t (if payload (progn ...)) (setq payload params))) (if payload (progn (if (stringp payload) nil (setq payload ...)) (setq payload (encode-coding-string payload ...)))) (if (or callback errorback) (progn (setq noerror t))) (ghub--retrieve payload (ghub--make-req :url (url-generic-parse-url (concat "https://" host resource ...)) :silent silent :method (encode-coding-string method (quote utf-8)) :headers (ghub--headers headers host auth username forge) :unpaginate unpaginate :noerror noerror :reader reader :callback callback :errorback errorback :extra extra))))))("GET" "/repos/vermiculus/magithu" nil :query nil :payload nil :unpaginate nil :headers nil :username nil :auth nil :host nil)
  apply((closure (cl-struct-ghub--req-tags url-http-response-status url-http-extra-headers url-http-end-of-headers url-callback-arguments t) (method resource &optional params &rest --cl-rest--) "Make a request for RESOURCE and return the response body.\n\nAlso place the response header in `ghub-response-headers'.\n\nMETHOD is the http method, given as a string.\nRESOURCE is the resource to access, given as a string beginning\n  with a slash.\n\nPARAMS, QUERY, PAYLOAD and HEADERS are alists used to specify\n  data.  The Github API documentation is vague on how data has\n  to be transmitted and for a particular resource usually just\n  talks about \"parameters\".  Generally speaking when the METHOD\n  is \"HEAD\" or \"GET\", then they have to be transmitted as a\n  query, otherwise as a payload.\nUse PARAMS to automatically transmit like QUERY or PAYLOAD would\n  depending on METHOD.\nUse QUERY to explicitly transmit data as a query.\nUse PAYLOAD to explicitly transmit data as a payload.\n  Instead of an alist, PAYLOAD may also be a string, in which\n  case it gets encoded as UTF-8 but is otherwise transmitted as-is.\nUse HEADERS for those rare resources that require that the data\n  is transmitted as headers instead of as a query or payload.\n  When that is the case, then the API documentation usually\n  mentions it explicitly.\n\nIf SILENT is non-nil, then don't message progress reports and\n  the like.\n\nIf UNPAGINATE is t, then make as many requests as necessary to\n  get all values.  If UNPAGINATE is a natural number, then get\n  at most that many pages.  For any other non-nil value raise\n  an error.\nIf NOERROR is non-nil, then do not raise an error if the request\n  fails and return nil instead.  If NOERROR is `return', then\n  return the error payload instead of nil.\nIf READER is non-nil, then it is used to read and return from the\n  response buffer.  The default is `ghub--read-json-payload'.\n  For the very few resources that do not return json, you might\n  want to use `ghub--decode-payload'.\n\nIf USERNAME is non-nil, then make a request on behalf of that\n  user.  It is better to specify the user using the Git variable\n  `github.user' for \"api.github.com\", or `github.HOST.user' if\n  connecting to a Github Enterprise instance.\n\nEach package that uses `ghub' should use its own token. If AUTH\n  is nil, then the generic `ghub' token is used instead.  This\n  is only acceptable for personal utilities.  A packages that\n  is distributed to other users should always use this argument\n  to identify itself, using a symbol matching its name.\n\n  Package authors who find this inconvenient should write a\n  wrapper around this function and possibly for the method\n  specific functions also.\n\n  Some symbols have a special meaning.  `none' means to make an\n  unauthorized request.  `basic' means to make a password based\n  request.  If the value is a string, then it is assumed to be\n  a valid token.  `basic' and an explicit token string are only\n  intended for internal and debugging uses.\n\n  If AUTH is a package symbol, then the scopes are specified\n  using the variable `AUTH-github-token-scopes'.  It is an error\n  if that is not specified.  See `ghub-github-token-scopes' for\n  an example.\n\nIf HOST is non-nil, then connect to that Github instance.  This\n  defaults to \"api.github.com\".  When a repository is connected\n  to a Github Enterprise instance, then it is better to specify\n  that using the Git variable `github.host' instead of using this\n  argument.\n\nIf FORGE is `gitlab', then connect to Gitlab.com or, depending\n  on HOST to another Gitlab instance.  This is only intended for\n  internal use.  Instead of using this argument you should use\n  function `glab-request' and other `glab-*' functions.\n\nIf CALLBACK and/or ERRORBACK is non-nil, then make one or more\n  asynchronous requests and call CALLBACK or ERRORBACK when\n  finished.  If an error occurred, then call ERRORBACK, or if\n  that is nil, then CALLBACK.  When no error occurred then call\n  CALLBACK.  When making asynchronous requests, then no errors\n  are signaled, regardless of the value of NOERROR.\n\nBoth callbacks are called with four arguments.\n  1. For CALLBACK, the combined value of the retrieved pages.\n     For ERRORBACk, the error that occured when retrieving the\n     last page.\n  2. The headers of the last page as an alist.\n  3. Status information provided by `url-retrieve'. Its `:error'\n     property holds the same information as ERRORBACK's first\n     argument.\n  4. A `ghub--req' struct, which can be passed to `ghub-continue'\n     (which see) to retrieve the next page, if any.\n\n(fn METHOD RESOURCE &optional PARAMS &key QUERY PAYLOAD HEADERS SILENT UNPAGINATE NOERROR READER USERNAME AUTH HOST FORGE CALLBACK ERRORBACK EXTRA)" (let* ((query (car (cdr (plist-member --cl-rest-- (quote :query))))) (payload (car (cdr (plist-member --cl-rest-- (quote :payload))))) (headers (car (cdr (plist-member --cl-rest-- (quote :headers))))) (silent (car (cdr (plist-member --cl-rest-- (quote :silent))))) (unpaginate (car (cdr (plist-member --cl-rest-- (quote :unpaginate))))) (noerror (car (cdr (plist-member --cl-rest-- (quote :noerror))))) (reader (car (cdr (plist-member --cl-rest-- (quote :reader))))) (username (car (cdr (plist-member --cl-rest-- (quote :username))))) (auth (car (cdr (plist-member --cl-rest-- (quote :auth))))) (host (car (cdr (plist-member --cl-rest-- (quote :host))))) (forge (car (cdr (plist-member --cl-rest-- (quote :forge))))) (callback (car (cdr (plist-member --cl-rest-- (quote :callback))))) (errorback (car (cdr (plist-member --cl-rest-- (quote :errorback))))) (extra (car (cdr (plist-member --cl-rest-- (quote :extra)))))) (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq ... ...) (setq --cl-keys-- ...)) ((car ...) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:query :payload :headers :silent :unpaginate :noerror :reader :username :auth :host :forge :callback :errorback :extra)" ...))))) (progn (progn (or (or (booleanp unpaginate) (natnump unpaginate)) (cl--assertion-failed (quote ...))) nil) (if (string-prefix-p "/" resource) nil (setq resource (concat "/" resource))) (if host nil (setq host (ghub--host forge))) (if (or username (stringp auth) (eq auth (quote none))) nil (setq username (ghub--username host forge))) (cond ((not params)) ((member method (quote ...)) (if query (progn ...)) (setq query params)) (t (if payload (progn ...)) (setq payload params))) (if payload (progn (if (stringp payload) nil (setq payload ...)) (setq payload (encode-coding-string payload ...)))) (if (or callback errorback) (progn (setq noerror t))) (ghub--retrieve payload (ghub--make-req :url (url-generic-parse-url (concat "https://" host resource ...)) :silent silent :method (encode-coding-string method (quote utf-8)) :headers (ghub--headers headers host auth username forge) :unpaginate unpaginate :noerror noerror :reader reader :callback callback :errorback errorback :extra extra)))))) ("GET" "/repos/vermiculus/magithu" nil :query nil :payload nil :unpaginate nil :headers nil :username nil :auth nil :host nil))
  (if (magithub-debug-mode (quote dry-api)) nil (apply oldfun args))
  magithub-debug--ghub-request-wrapper((closure (cl-struct-ghub--req-tags url-http-response-status url-http-extra-headers url-http-end-of-headers url-callback-arguments t) (method resource &optional params &rest --cl-rest--) "Make a request for RESOURCE and return the response body.\n\nAlso place the response header in `ghub-response-headers'.\n\nMETHOD is the http method, given as a string.\nRESOURCE is the resource to access, given as a string beginning\n  with a slash.\n\nPARAMS, QUERY, PAYLOAD and HEADERS are alists used to specify\n  data.  The Github API documentation is vague on how data has\n  to be transmitted and for a particular resource usually just\n  talks about \"parameters\".  Generally speaking when the METHOD\n  is \"HEAD\" or \"GET\", then they have to be transmitted as a\n  query, otherwise as a payload.\nUse PARAMS to automatically transmit like QUERY or PAYLOAD would\n  depending on METHOD.\nUse QUERY to explicitly transmit data as a query.\nUse PAYLOAD to explicitly transmit data as a payload.\n  Instead of an alist, PAYLOAD may also be a string, in which\n  case it gets encoded as UTF-8 but is otherwise transmitted as-is.\nUse HEADERS for those rare resources that require that the data\n  is transmitted as headers instead of as a query or payload.\n  When that is the case, then the API documentation usually\n  mentions it explicitly.\n\nIf SILENT is non-nil, then don't message progress reports and\n  the like.\n\nIf UNPAGINATE is t, then make as many requests as necessary to\n  get all values.  If UNPAGINATE is a natural number, then get\n  at most that many pages.  For any other non-nil value raise\n  an error.\nIf NOERROR is non-nil, then do not raise an error if the request\n  fails and return nil instead.  If NOERROR is `return', then\n  return the error payload instead of nil.\nIf READER is non-nil, then it is used to read and return from the\n  response buffer.  The default is `ghub--read-json-payload'.\n  For the very few resources that do not return json, you might\n  want to use `ghub--decode-payload'.\n\nIf USERNAME is non-nil, then make a request on behalf of that\n  user.  It is better to specify the user using the Git variable\n  `github.user' for \"api.github.com\", or `github.HOST.user' if\n  connecting to a Github Enterprise instance.\n\nEach package that uses `ghub' should use its own token. If AUTH\n  is nil, then the generic `ghub' token is used instead.  This\n  is only acceptable for personal utilities.  A packages that\n  is distributed to other users should always use this argument\n  to identify itself, using a symbol matching its name.\n\n  Package authors who find this inconvenient should write a\n  wrapper around this function and possibly for the method\n  specific functions also.\n\n  Some symbols have a special meaning.  `none' means to make an\n  unauthorized request.  `basic' means to make a password based\n  request.  If the value is a string, then it is assumed to be\n  a valid token.  `basic' and an explicit token string are only\n  intended for internal and debugging uses.\n\n  If AUTH is a package symbol, then the scopes are specified\n  using the variable `AUTH-github-token-scopes'.  It is an error\n  if that is not specified.  See `ghub-github-token-scopes' for\n  an example.\n\nIf HOST is non-nil, then connect to that Github instance.  This\n  defaults to \"api.github.com\".  When a repository is connected\n  to a Github Enterprise instance, then it is better to specify\n  that using the Git variable `github.host' instead of using this\n  argument.\n\nIf FORGE is `gitlab', then connect to Gitlab.com or, depending\n  on HOST to another Gitlab instance.  This is only intended for\n  internal use.  Instead of using this argument you should use\n  function `glab-request' and other `glab-*' functions.\n\nIf CALLBACK and/or ERRORBACK is non-nil, then make one or more\n  asynchronous requests and call CALLBACK or ERRORBACK when\n  finished.  If an error occurred, then call ERRORBACK, or if\n  that is nil, then CALLBACK.  When no error occurred then call\n  CALLBACK.  When making asynchronous requests, then no errors\n  are signaled, regardless of the value of NOERROR.\n\nBoth callbacks are called with four arguments.\n  1. For CALLBACK, the combined value of the retrieved pages.\n     For ERRORBACk, the error that occured when retrieving the\n     last page.\n  2. The headers of the last page as an alist.\n  3. Status information provided by `url-retrieve'. Its `:error'\n     property holds the same information as ERRORBACK's first\n     argument.\n  4. A `ghub--req' struct, which can be passed to `ghub-continue'\n     (which see) to retrieve the next page, if any.\n\n(fn METHOD RESOURCE &optional PARAMS &key QUERY PAYLOAD HEADERS SILENT UNPAGINATE NOERROR READER USERNAME AUTH HOST FORGE CALLBACK ERRORBACK EXTRA)" (let* ((query (car (cdr (plist-member --cl-rest-- (quote :query))))) (payload (car (cdr (plist-member --cl-rest-- (quote :payload))))) (headers (car (cdr (plist-member --cl-rest-- (quote :headers))))) (silent (car (cdr (plist-member --cl-rest-- (quote :silent))))) (unpaginate (car (cdr (plist-member --cl-rest-- (quote :unpaginate))))) (noerror (car (cdr (plist-member --cl-rest-- (quote :noerror))))) (reader (car (cdr (plist-member --cl-rest-- (quote :reader))))) (username (car (cdr (plist-member --cl-rest-- (quote :username))))) (auth (car (cdr (plist-member --cl-rest-- (quote :auth))))) (host (car (cdr (plist-member --cl-rest-- (quote :host))))) (forge (car (cdr (plist-member --cl-rest-- (quote :forge))))) (callback (car (cdr (plist-member --cl-rest-- (quote :callback))))) (errorback (car (cdr (plist-member --cl-rest-- (quote :errorback))))) (extra (car (cdr (plist-member --cl-rest-- (quote :extra)))))) (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq ... ...) (setq --cl-keys-- ...)) ((car ...) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:query :payload :headers :silent :unpaginate :noerror :reader :username :auth :host :forge :callback :errorback :extra)" ...))))) (progn (progn (or (or (booleanp unpaginate) (natnump unpaginate)) (cl--assertion-failed (quote ...))) nil) (if (string-prefix-p "/" resource) nil (setq resource (concat "/" resource))) (if host nil (setq host (ghub--host forge))) (if (or username (stringp auth) (eq auth (quote none))) nil (setq username (ghub--username host forge))) (cond ((not params)) ((member method (quote ...)) (if query (progn ...)) (setq query params)) (t (if payload (progn ...)) (setq payload params))) (if payload (progn (if (stringp payload) nil (setq payload ...)) (setq payload (encode-coding-string payload ...)))) (if (or callback errorback) (progn (setq noerror t))) (ghub--retrieve payload (ghub--make-req :url (url-generic-parse-url (concat "https://" host resource ...)) :silent silent :method (encode-coding-string method (quote utf-8)) :headers (ghub--headers headers host auth username forge) :unpaginate unpaginate :noerror noerror :reader reader :callback callback :errorback errorback :extra extra)))))) "GET" "/repos/vermiculus/magithu" nil :query nil :payload nil :unpaginate nil :headers nil :username nil :auth nil :host nil)
  apply(magithub-debug--ghub-request-wrapper (closure (cl-struct-ghub--req-tags url-http-response-status url-http-extra-headers url-http-end-of-headers url-callback-arguments t) (method resource &optional params &rest --cl-rest--) "Make a request for RESOURCE and return the response body.\n\nAlso place the response header in `ghub-response-headers'.\n\nMETHOD is the http method, given as a string.\nRESOURCE is the resource to access, given as a string beginning\n  with a slash.\n\nPARAMS, QUERY, PAYLOAD and HEADERS are alists used to specify\n  data.  The Github API documentation is vague on how data has\n  to be transmitted and for a particular resource usually just\n  talks about \"parameters\".  Generally speaking when the METHOD\n  is \"HEAD\" or \"GET\", then they have to be transmitted as a\n  query, otherwise as a payload.\nUse PARAMS to automatically transmit like QUERY or PAYLOAD would\n  depending on METHOD.\nUse QUERY to explicitly transmit data as a query.\nUse PAYLOAD to explicitly transmit data as a payload.\n  Instead of an alist, PAYLOAD may also be a string, in which\n  case it gets encoded as UTF-8 but is otherwise transmitted as-is.\nUse HEADERS for those rare resources that require that the data\n  is transmitted as headers instead of as a query or payload.\n  When that is the case, then the API documentation usually\n  mentions it explicitly.\n\nIf SILENT is non-nil, then don't message progress reports and\n  the like.\n\nIf UNPAGINATE is t, then make as many requests as necessary to\n  get all values.  If UNPAGINATE is a natural number, then get\n  at most that many pages.  For any other non-nil value raise\n  an error.\nIf NOERROR is non-nil, then do not raise an error if the request\n  fails and return nil instead.  If NOERROR is `return', then\n  return the error payload instead of nil.\nIf READER is non-nil, then it is used to read and return from the\n  response buffer.  The default is `ghub--read-json-payload'.\n  For the very few resources that do not return json, you might\n  want to use `ghub--decode-payload'.\n\nIf USERNAME is non-nil, then make a request on behalf of that\n  user.  It is better to specify the user using the Git variable\n  `github.user' for \"api.github.com\", or `github.HOST.user' if\n  connecting to a Github Enterprise instance.\n\nEach package that uses `ghub' should use its own token. If AUTH\n  is nil, then the generic `ghub' token is used instead.  This\n  is only acceptable for personal utilities.  A packages that\n  is distributed to other users should always use this argument\n  to identify itself, using a symbol matching its name.\n\n  Package authors who find this inconvenient should write a\n  wrapper around this function and possibly for the method\n  specific functions also.\n\n  Some symbols have a special meaning.  `none' means to make an\n  unauthorized request.  `basic' means to make a password based\n  request.  If the value is a string, then it is assumed to be\n  a valid token.  `basic' and an explicit token string are only\n  intended for internal and debugging uses.\n\n  If AUTH is a package symbol, then the scopes are specified\n  using the variable `AUTH-github-token-scopes'.  It is an error\n  if that is not specified.  See `ghub-github-token-scopes' for\n  an example.\n\nIf HOST is non-nil, then connect to that Github instance.  This\n  defaults to \"api.github.com\".  When a repository is connected\n  to a Github Enterprise instance, then it is better to specify\n  that using the Git variable `github.host' instead of using this\n  argument.\n\nIf FORGE is `gitlab', then connect to Gitlab.com or, depending\n  on HOST to another Gitlab instance.  This is only intended for\n  internal use.  Instead of using this argument you should use\n  function `glab-request' and other `glab-*' functions.\n\nIf CALLBACK and/or ERRORBACK is non-nil, then make one or more\n  asynchronous requests and call CALLBACK or ERRORBACK when\n  finished.  If an error occurred, then call ERRORBACK, or if\n  that is nil, then CALLBACK.  When no error occurred then call\n  CALLBACK.  When making asynchronous requests, then no errors\n  are signaled, regardless of the value of NOERROR.\n\nBoth callbacks are called with four arguments.\n  1. For CALLBACK, the combined value of the retrieved pages.\n     For ERRORBACk, the error that occured when retrieving the\n     last page.\n  2. The headers of the last page as an alist.\n  3. Status information provided by `url-retrieve'. Its `:error'\n     property holds the same information as ERRORBACK's first\n     argument.\n  4. A `ghub--req' struct, which can be passed to `ghub-continue'\n     (which see) to retrieve the next page, if any.\n\n(fn METHOD RESOURCE &optional PARAMS &key QUERY PAYLOAD HEADERS SILENT UNPAGINATE NOERROR READER USERNAME AUTH HOST FORGE CALLBACK ERRORBACK EXTRA)" (let* ((query (car (cdr (plist-member --cl-rest-- (quote :query))))) (payload (car (cdr (plist-member --cl-rest-- (quote :payload))))) (headers (car (cdr (plist-member --cl-rest-- (quote :headers))))) (silent (car (cdr (plist-member --cl-rest-- (quote :silent))))) (unpaginate (car (cdr (plist-member --cl-rest-- (quote :unpaginate))))) (noerror (car (cdr (plist-member --cl-rest-- (quote :noerror))))) (reader (car (cdr (plist-member --cl-rest-- (quote :reader))))) (username (car (cdr (plist-member --cl-rest-- (quote :username))))) (auth (car (cdr (plist-member --cl-rest-- (quote :auth))))) (host (car (cdr (plist-member --cl-rest-- (quote :host))))) (forge (car (cdr (plist-member --cl-rest-- (quote :forge))))) (callback (car (cdr (plist-member --cl-rest-- (quote :callback))))) (errorback (car (cdr (plist-member --cl-rest-- (quote :errorback))))) (extra (car (cdr (plist-member --cl-rest-- (quote :extra)))))) (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq ... ...) (setq --cl-keys-- ...)) ((car ...) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:query :payload :headers :silent :unpaginate :noerror :reader :username :auth :host :forge :callback :errorback :extra)" ...))))) (progn (progn (or (or (booleanp unpaginate) (natnump unpaginate)) (cl--assertion-failed (quote ...))) nil) (if (string-prefix-p "/" resource) nil (setq resource (concat "/" resource))) (if host nil (setq host (ghub--host forge))) (if (or username (stringp auth) (eq auth (quote none))) nil (setq username (ghub--username host forge))) (cond ((not params)) ((member method (quote ...)) (if query (progn ...)) (setq query params)) (t (if payload (progn ...)) (setq payload params))) (if payload (progn (if (stringp payload) nil (setq payload ...)) (setq payload (encode-coding-string payload ...)))) (if (or callback errorback) (progn (setq noerror t))) (ghub--retrieve payload (ghub--make-req :url (url-generic-parse-url (concat "https://" host resource ...)) :silent silent :method (encode-coding-string method (quote utf-8)) :headers (ghub--headers headers host auth username forge) :unpaginate unpaginate :noerror noerror :reader reader :callback callback :errorback errorback :extra extra)))))) ("GET" "/repos/vermiculus/magithu" nil :query nil :payload nil :unpaginate nil :headers nil :username nil :auth nil :host nil))
  ghub-request("GET" "/repos/vermiculus/magithu" nil :query nil :payload nil :unpaginate nil :headers nil :username nil :auth nil :host nil)
  funcall(ghub-request "GET" "/repos/vermiculus/magithu" nil :query nil :payload nil :unpaginate nil :headers nil :username nil :auth nil :host nil)
  (let ((method (encode-coding-string (upcase (symbol-name method)) (quote utf-8))) (params (apiwrap-plist->alist params))) (funcall (or ghubp-request-override-function (function ghub-request)) method resource nil :query params :payload data :unpaginate \.unpaginate :headers \.headers :username \.username :auth \.auth :host \.host))
  (let ((\.unpaginate (cdr (assq (quote unpaginate) alist))) (\.headers (cdr (assq (quote headers) alist))) (\.username (cdr (assq (quote username) alist))) (\.auth (cdr (assq (quote auth) alist))) (\.host (cdr (assq (quote host) alist)))) (let ((method (encode-coding-string (upcase (symbol-name method)) (quote utf-8))) (params (apiwrap-plist->alist params))) (funcall (or ghubp-request-override-function (function ghub-request)) method resource nil :query params :payload data :unpaginate \.unpaginate :headers \.headers :username \.username :auth \.auth :host \.host)))
  (let ((alist (ghubp-get-context))) (let ((\.unpaginate (cdr (assq (quote unpaginate) alist))) (\.headers (cdr (assq (quote headers) alist))) (\.username (cdr (assq (quote username) alist))) (\.auth (cdr (assq (quote auth) alist))) (\.host (cdr (assq (quote host) alist)))) (let ((method (encode-coding-string (upcase (symbol-name method)) (quote utf-8))) (params (apiwrap-plist->alist params))) (funcall (or ghubp-request-override-function (function ghub-request)) method resource nil :query params :payload data :unpaginate \.unpaginate :headers \.headers :username \.username :auth \.auth :host \.host))))
  ghubp-request(get "/repos/vermiculus/magithu" nil nil)
  apply(ghubp-request get "/repos/vermiculus/magithu" (nil nil))
  (condition-case it (apply (function ghubp-request) (quote get) (let ((alist (list (cons (quote repo) repo)))) (let ((\.repo\.owner\.login (cdr (assq ... ...))) (\.repo\.name (cdr (assq ... ...)))) (format "/repos/%s/%s" (apiwrap--encode-url \.repo\.owner\.login) (apiwrap--encode-url \.repo\.name)))) (if (keywordp data) (list (ghubp--pre-process-params (cons data params)) nil) (list (ghubp--pre-process-params params) data))) (ghub-http-error (let* ((val (car it))) (if (eq val (quote ghub-404)) (let nil nil) (let nil (apply (function signal) it))))))
  ghubp-get-repos-owner-repo(((owner (login . "vermiculus")) (name . "magithu")))
  eval((ghubp-get-repos-owner-repo (quote ((owner (login . "vermiculus")) (name . "magithu")))) t)
  pp-eval-expression((ghubp-get-repos-owner-repo (quote ((owner (login . "vermiculus")) (name . "magithu")))))
  pp-eval-last-sexp(nil)
  funcall-interactively(pp-eval-last-sexp nil)
  call-interactively(pp-eval-last-sexp nil nil)
  command-execute(pp-eval-last-sexp)

from ghub.

vermiculus avatar vermiculus commented on July 17, 2024

Does 2.0 drop support for this version or is something just going on with url?

I think I've added the necessary support for these changes in vermiculus/ghub-plus@c24abea – IIUC, only the error-handling has really changed from my point of view.

from ghub.

tarsius avatar tarsius commented on July 17, 2024

url-asynchronous wasn't added until Emacs 26. Fixed in f518c76.

from ghub.

tarsius avatar tarsius commented on July 17, 2024

Does 2.0 drop support for this version

Well not intentionally.

only the error-handling has really changed from my point of view.

Piuuu ;-)

from ghub.

vermiculus avatar vermiculus commented on July 17, 2024

Piuuu

Well, the only breaking change, 😉 (no? because taking out the url-asynchronous accessor gets everything working again)

from ghub.

Related Issues (20)

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.