Skip to content

Filter gists by fileName #3

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 3, 2018 · 4 comments
Closed

Filter gists by fileName #3

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

Comments

@mindrones
Copy link

Just an idea, but it just occurred to me that it could be useful to search for gists containing a file with a specific name, for example a meta file that always has the same name, for example "meta.json" for the Svelte REPL (an example here https://gist.github.com/mindrones/1d8a53bf15e8033a62cca847274286aa#file-meta-json).

@jvcalderon
Copy link
Owner

Could be useful. Maybe I could implement it next week. If you have a concrete idea of implementation, a test defining the interface or something else, feel free to share it by pull request. Thank you!

@mindrones
Copy link
Author

mindrones commented Dec 4, 2018

Basically Svelte REPL saves examples as gists and we're trying to retrieve all public examples that people have written.

For example, this example https://svelte.technology/repl?version=2.15.0&gist=1d8a53bf15e8033a62cca847274286aa is based on this gist https://gist.github.com/mindrones/1d8a53bf15e8033a62cca847274286aa.
As you can see, these gists have a meta.json file currently just containing the object {"svelte": true}, forcing us to search these gists by content, which is proving difficult.

Hence, I'm thinking that we might just change that convention and call that meta file svelte.json so that we wouldn't have to fetch and inspect all files in a gist: we would just have to fetch files named svelte.json and check if they're Svelte REPL meta files.

An example API could could be:

.getAll({
    filterBy: [
        {hasFileWithName: "svelte.json"}, // tier: resource
    ]
})

Being tier resource we wouldn't be able to mix with userName and starred but we can filter the result later on.

Hope this helps, thanks!

@jvcalderon jvcalderon self-assigned this Dec 5, 2018
@jvcalderon
Copy link
Owner

jvcalderon commented Dec 13, 2018

I just added the functionality in this commit Its now available in version 1.1.0. Now you can do (for example):

gistClient.getAll({
      rawContent: true,
      filterBy: [
          {userName: "mindrones"},
          {filename: "data.json5"},
      ]
  })

Thank you for your feedback @mindrones

@mindrones
Copy link
Author

Hi @jvcalderon, I just tried it and works perfectly thanks a lot for implementing it!

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