CgsResult
The outcome of a one-shot call that can fail: either Success with a value, or Failure with a CgsError saying why.
Calls that return this do not throw for expected failures — a lost connection, a rejected token — so there is nothing to wrap in try/catch:
when (val result = CGS.auth().authenticate(hostToken)) {
is CgsResult.Success -> proceed()
is CgsResult.Failure -> showError(result.cgsError)
}Content copied to clipboard
Sealed, so a when over it needs no else and stops compiling if the SDK ever adds a case.
Parameters
T
what a successful call returns; Unit when it returns nothing.