@@ -51,4 +51,49 @@ public static Task<PurgeResult> PurgeInstancesAsync(
51
51
DateTimeOffset ? createdTo ,
52
52
CancellationToken cancellation = default )
53
53
=> PurgeInstancesAsync ( client , createdFrom , createdTo , null , cancellation ) ;
54
+
55
+ /// <summary>
56
+ /// Starts a new orchestration instance for execution.
57
+ /// </summary>
58
+ /// <param name="client">The client to schedule the orchestration with.</param>
59
+ /// <param name="request">The orchestration request to schedule.</param>
60
+ /// <param name="cancellation">The cancellation token.</param>
61
+ /// <returns>
62
+ /// A task that completes when the orchestration instance is successfully scheduled. The value of this task is the
63
+ /// instance ID the orchestration was scheduled with.
64
+ /// </returns>
65
+ /// <seealso cref="DurableTaskClient.ScheduleNewOrchestrationInstanceAsync(TaskName, object?, CancellationToken)" />
66
+ public static Task < string > StartNewAsync (
67
+ this DurableTaskClient client , IBaseOrchestrationRequest request , CancellationToken cancellation )
68
+ {
69
+ Check . NotNull ( client ) ;
70
+ Check . NotNull ( request ) ;
71
+ TaskName name = request . GetTaskName ( ) ;
72
+ return client . ScheduleNewOrchestrationInstanceAsync ( name , request . GetInput ( ) , cancellation ) ;
73
+ }
74
+
75
+ /// <summary>
76
+ /// Starts a new orchestration instance for execution.
77
+ /// </summary>
78
+ /// <param name="client">The client to schedule the orchestration with.</param>
79
+ /// <param name="request">The orchestration request to schedule.</param>
80
+ /// <param name="options">The options for starting this orchestration with.</param>
81
+ /// <param name="cancellation">The cancellation token.</param>
82
+ /// <returns>
83
+ /// A task that completes when the orchestration instance is successfully scheduled. The value of this task is
84
+ /// the instance ID of the scheduled orchestration instance. If a non-null instance ID was provided via
85
+ /// <paramref name="options" />, the same value will be returned by the completed task.
86
+ /// </returns>
87
+ /// <seealso cref="DurableTaskClient.ScheduleNewOrchestrationInstanceAsync(TaskName, object?, StartOrchestrationOptions?, CancellationToken)" />
88
+ public static Task < string > StartNewAsync (
89
+ this DurableTaskClient client ,
90
+ IBaseOrchestrationRequest request ,
91
+ StartOrchestrationOptions ? options = null ,
92
+ CancellationToken cancellation = default )
93
+ {
94
+ Check . NotNull ( client ) ;
95
+ Check . NotNull ( request ) ;
96
+ TaskName name = request . GetTaskName ( ) ;
97
+ return client . ScheduleNewOrchestrationInstanceAsync ( name , request . GetInput ( ) , options , cancellation ) ;
98
+ }
54
99
}
0 commit comments