SudoEntitlementsClient
public protocol SudoEntitlementsClient : AnyObject
Client used to interface with the Sudo Entitlements Platform service.
It is recommended to code to this interface, rather than the implementation class (DefaultSudoEntitlementsClient) as
the implementation class is only meant to be used for initializing an instance of the client.
-
Clear all locally cached data
Declaration
Swift
func reset() throws
-
getEntitlementsConsumption()AsynchronousGet the current set of entitlements and their consumption for the user
Throws
Declaration
Swift
func getEntitlementsConsumption() async throws -> EntitlementsConsumptionReturn Value
- Success: The set of entitlements the user currently has and consumption information for the user and its sub-resource consumers, if any
-
getExternalId()AsynchronousGet the external ID as determined by the entitlements service. Useful for automated tests
Throws
Declaration
Swift
func getExternalId() async throws -> StringReturn Value
- The external ID of the authenticated user
-
redeemEntitlements()AsynchronousRedeem the entitlements for the user.
Throws
SudoEntitlementsError.Declaration
Swift
func redeemEntitlements() async throws -> EntitlementsSetReturn Value
- The current set of entitlements the user has after the redemption has completed.
-
consumeBooleanEntitlements(entitlementNames:Asynchronous) Record consumption of a set of boolean entitlements.
This is to support services that want a record of usage recorded but have no service side enforcement point.
Throws
Throws:
NotSignedInExceptionUser is not signed inInsufficientEntitlementsExceptionUser is not entitled to one or more of the boolean entitlements. Check entitlements and that redeemEntitlements has been called for the user.InvalidArgumentExceptionOne or more of the specified entitlement names does not correspond to a boolean entitlement defined to the entitlements serviceServiceExceptionAn error occurred within the entitlements service that indicates an issue with the configuration or operation of the service.
Declaration
Swift
func consumeBooleanEntitlements(entitlementNames: [String]) async throwsParameters
entitlementNamesBoolean entitlement names to record consumption of
SudoEntitlementsClient Protocol Reference