@@ -73,6 +73,11 @@ type (
73
73
// ParentClosePolicy defines the behavior performed on a child workflow when its parent is closed
74
74
ParentClosePolicy = internal.ParentClosePolicy
75
75
76
+ // CancelOption values are functional options for the CancelWorkflow method.
77
+ // Supported values can be created with:
78
+ // - WithCancelReason(...)
79
+ CancelOption = internal.Option
80
+
76
81
// Client is the client for starting and getting information about a workflow executions as well as
77
82
// completing activities asynchronously.
78
83
Client interface {
@@ -162,7 +167,7 @@ type (
162
167
// - BadRequestError
163
168
// - InternalServiceError
164
169
// - WorkflowExecutionAlreadyCompletedError
165
- CancelWorkflow (ctx context.Context , workflowID string , runID string , opts ... internal. Option ) error
170
+ CancelWorkflow (ctx context.Context , workflowID string , runID string , opts ... CancelOption ) error
166
171
167
172
// TerminateWorkflow terminates a workflow execution.
168
173
// workflowID is required, other parameters are optional.
@@ -516,3 +521,10 @@ func IsWorkflowError(err error) bool {
516
521
}
517
522
return false
518
523
}
524
+
525
+ // WithCancelReason can be passed to Client.CancelWorkflow to provide an explicit cancellation reason,
526
+ // which will be recorded in the cancellation event in the workflow's history, similar to termination reasons.
527
+ // This is purely informational, and does not influence Cadence behavior at all.
528
+ func WithCancelReason (reason string ) CancelOption {
529
+ return internal .WithCancelReason (reason )
530
+ }
0 commit comments