Next: , Previous: , Up: Top   [Contents]


3 Using Ghub in Personal Scripts

You can use ghub-request and its wrapper functions in your personal scripts, of course. Unlike when you use Ghub from a package that you distribute for others to use, you don’t have to specify a package in personal scripts.

;; This is perfectly acceptable in personal scripts ...
(ghub-get "/user")

;; ... and actually equal to
(ghub-get "/user" nil :auth 'ghub)

;; In packages you have to specify the package using AUTH.
(ghub-get "/user" nil :auth 'foobar)

When you do not specify the AUTH argument, then a request is made on behalf of the ghub package itself. Like for any package that uses Ghub, ghub has to declare what scopes it needs, using, in this case, the variable ghub-github-token-scopes.

The default value of that variable is (repo) and you might want to add additional scopes. You can later add additional scopes to an existing token, using the web interface at https://github.com/settings/tokens.

If you do that, then you might want to also set the variable accordingly, but note that Ghub only consults that when creating a new token. If you want to know a token’s effective scopes use the command ghub-token-scopes, described in the next section.