unpoller / unifi

Go Library (w/ structures) to grab data from a Ubitquiti UniFi Controller
https://golift.io/discord
MIT License
114 stars 22 forks source link

Misleading function names #31

Closed mabunixda closed 4 years ago

mabunixda commented 5 years ago

Hi,

i am working on a terraform provider to configure the unifi controller. I started with using your library but then realized that all functions are just reporting the stats and not the configuration endpoints.

I forked your lib and gonna do some rewrites based on the api stuff from node-unifi.

I would also like to create a PR after finishing the adding, but i struggle with if a renaming of the existing functions is better than creating wired function names on getSites() and rename the existing to getSitesStats() for example..

davidnewhall commented 5 years ago

This library has been rather single purposed for a long time. I only use it to query statistics that get saved into InfluxDB. I recently removed the influx code from this library and put it back into the cli app. That makes this library less opinionated and provides a better base for adding new features.

Since Go is a heavily typed language and the UniFI API is a poorly typed data source, it gets difficult to reason about some pieces of information. Keep this in mind as you're developing.

Now on to your question. I haven't done any research into "controlling" the controller through the API, but it sounds like that's what you're looking to do. That said, I wonder what "GetSites()" should do in this new feature-filled library? You want to rename the existing functions. Can you explain what the new functions with the existing names will do? Is it possible to combine the stats with the meta data you're looking for? In other words, instead of GetSites() and GetSitesStats() Can we just have one method and fill the struct with both pieces of data?

I checked out https://github.com/mabunixda/unifi but I don't see any commits yet. I work best from examples, so if you can stab in some code for me to look at, it'll help me understand your goals.

Thanks!

davidnewhall commented 4 years ago

Was hoping for a reply by now. 👀

davidnewhall commented 4 years ago

Bump?

mabunixda commented 4 years ago

I switched on using/testing another provider

davidnewhall commented 4 years ago

kk np. That library looks pretty legit!