createPolicy method
Create a new policy.
Sign the provided TCreatePolicyBody with the client's stamp function and submit the request (POST /public/v1/submit/create_policy).
See also: stampCreatePolicy.
Implementation
Future<TCreatePolicyResponse> createPolicy({
required TCreatePolicyBody input,
}) async {
final body = packActivityBody(
bodyJson: input.toJson(),
fallbackOrganizationId: input.organizationId ??
config.organizationId ??
(throw Exception(
"Missing organization ID, please pass in a sub-organizationId or instantiate the client with one.")),
activityType: 'ACTIVITY_TYPE_CREATE_POLICY_V3',
);
return await request<Map<String, dynamic>, TCreatePolicyResponse>(
"/public/v1/submit/create_policy",
body,
(json) => TCreatePolicyResponse.fromJson(
transformActivityResponse(json, 'CreatePolicy')));
}