farmOS / farmOS.js

A JavaScript library for working with farmOS data structures and interacting with farmOS servers.
MIT License
17 stars 13 forks source link

Add .area.geojson() method #15

Closed jgaehring closed 4 years ago

jgaehring commented 4 years ago

This will be required for farmOS/farmOS-client#353. I considered just doing this manually from within Field Kit, but talking with @paul121 I realized it's still complicated enough—handing the OAuth tokens, adding them to the headers, refreshing them if necessary, error handling, etc—that it's just better to build it into farmOS.js.

Some consideration to the API: it'd be nice to accept parameters to only fetch an area type, such as fields, beds, etc. That'd be simple enough by appending it to the endpoint, but I don't need it for my immediate use case. I need all the areas, which is what you get when you append nothing to the main endpoint, so I'm not going to deal with any parameters now. Just do farm.area.geojson(), that's it. That should make it possible to add an options parameter in the future.

jgaehring commented 4 years ago

Resolved by #14.