getAccountPolicyLayer method

  1. @override
Future<WaasPolicyLayerResponse> getAccountPolicyLayer(
  1. String businessAccountId
)
override

Gets a business account's policy layer.

Implementation

@override
Future<WaasPolicyLayerResponse> getAccountPolicyLayer(String businessAccountId) async {
  Future<WaasPolicyLayerResponse> instrumentationOperation() async {
    final operationScope = _state.flowScope.capture(replace: false);
    await operationScope.ready();
    if (!_state.initialized) {
      throw DynamicStateException("call initialize() before using the client");
    }
    if (_state.token == null) {
      throw DynamicStateException("not authenticated — sign in first");
    }
    operationScope.check();
    final layer = await _api.get<WaasPolicyLayerResponse>(path: "/businessAccounts/${Uri.encodeComponent(businessAccountId)}/policy-layer", token: _state.token, sessionPublicKey: _state.sessionPublicKey, parse: WaasPolicyLayerResponse.fromJson);
    operationScope.check();
    return layer;
  }
  return await _api.instrumentation.runAsync("policyEngine.getAccountPolicyLayer", instrumentationOperation);
}