Skip to content
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

Add support for alluser #53

Merged
merged 3 commits into from
Aug 13, 2021
Merged

Add support for alluser #53

merged 3 commits into from
Aug 13, 2021

Conversation

thirdmartini
Copy link
Contributor

Adds ability to get historical Client/User connection information

users.go Outdated
Noted bool `json:"noted,omitempty"`
Blocked bool `json:"blocked,omitempty"`
DevIDOverride int64 `json:"dev_id_override,omitempty"`
FingerprintOverride bool `json:"fingerprint_override,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend FlexBool and FlexInt for booleans and numbers. Ubiquiti is bad about turning booleans and numbers into strings during updates. Those special types avoid errors and crashing when that happens.

This contribution looks pretty solid overall. Thank you for contributing!

Curious if you're trying to use this with unpoller or if you have your own app interacting with the controller?

Copy link
Contributor Author

@thirdmartini thirdmartini Aug 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using it for a little homebrew app for alerting when a new/unknown device gets plugged into the network. It just fires off a webhook to a slack channel when something new shows up. Found your library pretty easy to work with, and just needed add in the historical users/clients piece here.

unifi.go Outdated Show resolved Hide resolved
types.go Outdated Show resolved Hide resolved
unifi.go Outdated Show resolved Hide resolved
users.go Outdated Show resolved Hide resolved
users.go Outdated Show resolved Hide resolved
@davidnewhall
Copy link
Member

Thank you!

@davidnewhall davidnewhall merged commit 82e0d2c into unpoller:master Aug 13, 2021
func (u *Unifi) UniReqPost(apiPath string, params string) (*http.Request, error) {
apiPath = u.path(apiPath)

req, err := http.NewRequest(http.MethodPost, u.URL+apiPath, bytes.NewBufferString("")) //nolint:noctx
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed this method has no post data input. hm.

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

Successfully merging this pull request may close these issues.

2 participants