ChiriVulpes / scryfall-sdk

A Node.js SDK for https://scryfall.com/docs/api, written in TypeScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add options arbitrary options argument

johnpyp opened this issue · comments

Currently there are options available in the scryfall api like "unique" which allows you to get different versions of cards. If I'm understanding correctly, it seems there is no way to add in these extra options.

I'd like to add an extra paramater accepting an object of arbitrary parameters that will be merged with the request object. For example, instead of search sending just

{q: search} it would send {q: search, ...otherOptions}

Would you accept this PR?

Sure, I didn't even realise that was a thing. I'm assuming it's all the stuff on this page? I have a bit of free time, I can implement it today probably. Unless you've already started a PR

Works awesome, thanks a lot.

This is a very clean API, makes working with Scryfall a lot easier.

I want to try to make a general purpose, opinionated library for working with magic card data in general, using the scryfall API.

It would include adapters for database/memory caching abstracted, and easy price lookups, that sort of thing, in an attempt to make it even easier to interface with magic cards. I imagine it being used as a pain-free way of bootstrapping collection management, deck statistics, and trading sites without having to manually implement a lot of the methods you would need.

I'm thinking things like

mtg.getPrices(searchQuery | set | listOfCards)
mtg.priceHistory(card)
mtg.ev(set | product)

and better searching like a string parser and better json support for searching e.g.

mtg.find('blue with cmc 3+') // q: 'c:u cmc>=3'(maybe a little ambitious)
mtg.find({color: 'blue' || 'u', cmc: '3+' || x => x >= a3})

and utility parsers/helpers like

mtg.collection.remaining(myCards, targetDeck)
// {priceRemainingUsd: 100, cardsRemaining: ListOfCards, ...etc}

mtg.genHtml(cardObject || mtg.find('Karn, Scion of Urza'))
// <a target="_blank" href="scryfallKarnLink">Karn, Scion of Urza - $65.00</a> + a tooltip for art

Is this a project you would be interested in collaborating in?

Probably not, I actually don't even really play magic anymore, I just maintain this sdk because I want to have something well-maintained for my portfolio, lol...

You can feel free to send me a link or ask advice or whatever, I just probably won't have time to commit to another project