voteOnProposal method
Casts a vote for a specified ProposalId
on behalf of a
member. The member to vote as, specified by VoterMemberId
,
must be in the same AWS account as the principal that calls the action.
Applies only to Hyperledger Fabric.
May throw InvalidRequestException. May throw IllegalActionException. May throw AccessDeniedException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw InternalServiceErrorException.
Parameter networkId
:
The unique identifier of the network.
Parameter proposalId
:
The unique identifier of the proposal.
Parameter vote
:
The value of the vote.
Parameter voterMemberId
:
The unique identifier of the member casting the vote.
Implementation
Future<void> voteOnProposal({
required String networkId,
required String proposalId,
required VoteValue vote,
required String voterMemberId,
}) async {
ArgumentError.checkNotNull(networkId, 'networkId');
_s.validateStringLength(
'networkId',
networkId,
1,
32,
isRequired: true,
);
ArgumentError.checkNotNull(proposalId, 'proposalId');
_s.validateStringLength(
'proposalId',
proposalId,
1,
32,
isRequired: true,
);
ArgumentError.checkNotNull(vote, 'vote');
ArgumentError.checkNotNull(voterMemberId, 'voterMemberId');
_s.validateStringLength(
'voterMemberId',
voterMemberId,
1,
32,
isRequired: true,
);
final $payload = <String, dynamic>{
'Vote': vote.toValue(),
'VoterMemberId': voterMemberId,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/networks/${Uri.encodeComponent(networkId)}/proposals/${Uri.encodeComponent(proposalId)}/votes',
exceptionFnMap: _exceptionFns,
);
}