Skip to content

Commit b9824f1

Browse files
committed
add new type
1 parent a41c592 commit b9824f1

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

workflow/client.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ type Client struct {
3131
taskHubClient *durabletaskclient.TaskHubGrpcClient
3232
}
3333

34+
type WorkflowIdReusePolicy struct {
35+
OperationStatus []api.OrchestrationStatus
36+
Action api.CreateOrchestrationAction
37+
}
38+
3439
// WithInstanceID is an option to set an InstanceID when scheduling a new workflow.
3540
func WithInstanceID(id string) api.NewOrchestrationOptions {
3641
return api.WithInstanceID(api.InstanceID(id))
@@ -53,8 +58,11 @@ func WithStartTime(time time.Time) api.NewOrchestrationOptions {
5358
return api.WithStartTime(time)
5459
}
5560

56-
func WithReuseIDPolicy(policy *api.OrchestrationIdReusePolicy) api.NewOrchestrationOptions {
57-
return api.WithOrchestrationIdReusePolicy(policy)
61+
func WithReuseIDPolicy(policy WorkflowIdReusePolicy) api.NewOrchestrationOptions {
62+
return api.WithOrchestrationIdReusePolicy(&api.OrchestrationIdReusePolicy{
63+
OperationStatus: policy.OperationStatus,
64+
Action: policy.Action,
65+
})
5866
}
5967

6068
// WithFetchPayloads is an option to return the payload from a workflow.

workflow/client_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func TestClientMethods(t *testing.T) {
5555
}
5656
ctx := context.Background()
5757
t.Run("ScheduleNewWorkflow - empty wf name", func(t *testing.T) {
58-
id, err := testClient.ScheduleNewWorkflow(ctx, "", WithReuseIDPolicy(&api.OrchestrationIdReusePolicy{
58+
id, err := testClient.ScheduleNewWorkflow(ctx, "", WithReuseIDPolicy(WorkflowIdReusePolicy{
5959
OperationStatus: []api.OrchestrationStatus{api.RUNTIME_STATUS_COMPLETED},
6060
Action: api.REUSE_ID_ACTION_IGNORE,
6161
}))

0 commit comments

Comments
 (0)