diff options
| author | Glenn Smith <glenn@vector35.com> | 2021-12-07 20:11:59 -0500 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2021-12-07 20:11:59 -0500 |
| commit | 645e0c51e6293874acda429dc5e278b185704d9b (patch) | |
| tree | 8a3548edca456267bd355ccdf352f23de264becd /python/enterprise.py | |
| parent | 1619f845ec5e78e4890138c4fc61cea7b8923510 (diff) | |
[Enterprise] APIs for server name, version, id
Diffstat (limited to 'python/enterprise.py')
| -rw-r--r-- | python/enterprise.py | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/python/enterprise.py b/python/enterprise.py index 7e6ebb18..5ea57f0c 100644 --- a/python/enterprise.py +++ b/python/enterprise.py @@ -86,12 +86,59 @@ def is_authenticated() -> bool: return core.BNIsEnterpriseServerAuthenticated() -def username() -> Optional[None]: +def username() -> Optional[str]: """ Get the username of the currently authenticated user to the Enterprise Server. :return: Username, if authenticated. None, otherwise. """ - return core.BNGetEnterpriseServerUsername() + value = core.BNGetEnterpriseServerUsername() + if value == "": + return None + return value + + +def server_name() -> Optional[str]: + """ + Get the display name of the currently connected server + :return: Display name of the currently connected server, if connected. None, otherwise + """ + value = core.BNGetEnterpriseServerName() + if value == "": + return None + return value + + +def server_id() -> Optional[str]: + """ + Get the internal id of the currently connected server + :return: Id of the currently connected server, if connected. None, otherwise + """ + value = core.BNGetEnterpriseServerId() + if value == "": + return None + return value + + +def server_version() -> Optional[int]: + """ + Get the version number of the currently connected server + :return: Version of the currently connected server, if connected. None, otherwise + """ + value = core.BNGetEnterpriseServerVersion() + if value == 0: + return None + return value + + +def server_build_id() -> Optional[str]: + """ + Get the build id string of the currently connected server + :return: Build id of the currently connected server, if connected. None, otherwise + """ + value = core.BNGetEnterpriseServerBuildId() + if value == "": + return None + return value def reservation_time_limit() -> int: |
