Skip to content

Is a token required for public gists? #1

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

Closed
mindrones opened this issue Dec 2, 2018 · 4 comments
Closed

Is a token required for public gists? #1

mindrones opened this issue Dec 2, 2018 · 4 comments
Assignees

Comments

@mindrones
Copy link

mindrones commented Dec 2, 2018

Hi, related to sveltejs/v2.svelte.dev#382, I'm trying to retrieve public gists containing the word "svelte":

const GistClient = require("gist-client");
const gistClient = new GistClient();

gistClient
.getAll({
    rawContent: true,
    filterBy: [
        {public: true},
        {content: "svelte"},
        {since: "2018-11-01T00:00:01Z"}
    ]
})
.then(gistList => {
    console.log(JSON.stringify(gistList))
})
.catch(err => {
    console.log(err)
});

but I get the error Error: You need to set token before by setToken() method.
According to https://github.com/jvcalderon/gist-client#get-a-gist-list it seemed that this should work without a token? Thanks!

@jvcalderon
Copy link
Owner

This commit solves the problem. It was an unnecessary token check. Now (v.1.0.8) you can use getAll method without token, to retrieve public gists. Thank you for your feedback @mindrones

@jvcalderon jvcalderon self-assigned this Dec 3, 2018
@mindrones
Copy link
Author

Cool, worked perfectly to retrieve my own gists with this (no token):

.getAll({
    filterBy: [
        {userName: "mindrones"},
    ]
})

Thanks!

Note aside, this one:

.getAll({
    rawContent: true,
    filterBy: [
        {userName: "mindrones"},
        {content: "svelte"},
    ]
})

fails with a

TypeError: _.get(...).match is not a function
node_modules/gist-client/lib/gistClient.js:223:61

Not sure if that's supposed to work or wrong config. If needed can open a new issue.

@jvcalderon
Copy link
Owner

jvcalderon commented Dec 4, 2018

@mindrones I just published v.1.0.9 it solves a bug when gists files contained JSON files. You can see the change in this commit

@mindrones
Copy link
Author

Works! Thanks a lot for these quick fixes, closing :)

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