Closed x1unix closed 6 years ago
This is a reasonable change, though a more idiomatic way to approach this might be to make the Session fields public by making them upper case.
@cavaliercoder, didn't want to break existing codebase. In the future, I offer to rename NewSession
to Login
and also add session cache feature.
Thanks for being cautious. Making these fields public should be a nondestructive change so I'm happy for you to submit this change.
If you choose to rename NewSession
, maybe consider keeping it around as an alias to the new Login
and noting in the documentation that NewSession
is deprecated. This will ensure it continues to work for legacy users and can be removed one day. I'm curious which naming convention existing popular libraries use for establishing a session with remote APIs. Maybe the AWS SDK or Stripe, etc.
I'm interested to see the session cache feature!
@cavaliercoder, thank you for the feedback. I'll refactor my pull request and make those fields public, also I'll add Login
method alias. Maybe I'll also add session cache sub-system.
Added
BuildSession
method that allows creating session manually.This feature is necessary for Zabbix token caching and re-use.