@@ -8,13 +8,12 @@ package client
88import (
99 "context"
1010 "crypto/tls"
11- "io"
12-
1311 commonpb "go.temporal.io/api/common/v1"
1412 enumspb "go.temporal.io/api/enums/v1"
1513 historypb "go.temporal.io/api/history/v1"
1614 "go.temporal.io/api/operatorservice/v1"
1715 "go.temporal.io/api/workflowservice/v1"
16+ "io"
1817
1918 "go.temporal.io/sdk/converter"
2019 "go.temporal.io/sdk/internal"
@@ -896,6 +895,80 @@ type (
896895 // Note, this is not related to any general concept of timing out or cancelling a running update, this is only related to the client call itself.
897896 WorkflowUpdateServiceTimeoutOrCanceledError = internal.WorkflowUpdateServiceTimeoutOrCanceledError
898897
898+ // StartActivityOptions contains configuration parameters for starting an activity execution from the client.
899+ // ID and TaskQueue are required. At least one of ScheduleToCloseTimeout or StartToCloseTimeout is required.
900+ // Other parameters are optional.
901+ //
902+ // NOTE: Experimental
903+ StartActivityOptions = internal.ClientStartActivityOptions
904+
905+ // GetActivityHandleOptions contains input for GetActivityHandle call.
906+ // ActivityID and RunID are required.
907+ //
908+ // NOTE: Experimental
909+ GetActivityHandleOptions = internal.ClientGetActivityHandleOptions
910+
911+ // ListActivitiesOptions contains input for ListActivities call.
912+ //
913+ // NOTE: Experimental
914+ ListActivitiesOptions = internal.ClientListActivitiesOptions
915+
916+ // ListActivitiesResult contains the result of the ListActivities call.
917+ //
918+ // NOTE: Experimental
919+ ListActivitiesResult = internal.ClientListActivitiesResult
920+
921+ // CountActivitiesOptions contains input for CountActivities call.
922+ //
923+ // NOTE: Experimental
924+ CountActivitiesOptions = internal.ClientCountActivitiesOptions
925+
926+ // CountActivitiesResult contains the result of the CountActivities call.
927+ //
928+ // NOTE: Experimental
929+ CountActivitiesResult = internal.ClientCountActivitiesResult
930+
931+ // CountActivitiesAggregationGroup contains groups of activities if
932+ // CountActivityExecutions is grouped by a field.
933+ // The list might not be complete, and the counts of each group is approximate.
934+ //
935+ // NOTE: Experimental
936+ CountActivitiesAggregationGroup = internal.ClientCountActivitiesAggregationGroup
937+
938+ // ActivityHandle represents a running or completed standalone activity execution.
939+ // It can be used to get the result, describe, cancel, or terminate the activity.
940+ //
941+ // NOTE: Experimental
942+ ActivityHandle = internal.ClientActivityHandle
943+
944+ // ActivityExecutionInfo contains information about an activity execution.
945+ // This is returned by ListActivities and embedded in ClientActivityExecutionDescription.
946+ //
947+ // NOTE: Experimental
948+ ActivityExecutionInfo = internal.ClientActivityExecutionInfo
949+
950+ // ActivityExecutionDescription contains detailed information about an activity execution.
951+ // This is returned by ClientActivityHandle.Describe.
952+ //
953+ // NOTE: Experimental
954+ ActivityExecutionDescription = internal.ClientActivityExecutionDescription
955+
956+ // DescribeActivityOptions contains options for ClientActivityHandle.Describe call.
957+ // For future compatibility, currently unused.
958+ //
959+ // NOTE: Experimental
960+ DescribeActivityOptions = internal.ClientDescribeActivityOptions
961+
962+ // CancelActivityOptions contains options for ClientActivityHandle.Cancel call.
963+ //
964+ // NOTE: Experimental
965+ CancelActivityOptions = internal.ClientCancelActivityOptions
966+
967+ // TerminateActivityOptions contains options for ClientActivityHandle.Terminate call.
968+ //
969+ // NOTE: Experimental
970+ TerminateActivityOptions = internal.ClientTerminateActivityOptions
971+
899972 // Client is the client for starting and getting information about a workflow executions as well as
900973 // completing activities asynchronously.
901974 Client interface {
@@ -1022,11 +1095,10 @@ type (
10221095 GetWorkflowHistory (ctx context.Context , workflowID string , runID string , isLongPoll bool , filterType enumspb.HistoryEventFilterType ) HistoryEventIterator
10231096
10241097 // CompleteActivity reports activity completed.
1025- // activity Execute method can return activity.ErrResultPending to
1026- // indicate the activity is not completed when it's Execute method returns. In that case, this CompleteActivity() method
1027- // should be called when that activity is completed with the actual result and error. If err is nil, activity task
1028- // completed event will be reported; if err is CanceledError, activity task canceled event will be reported; otherwise,
1029- // activity task failed event will be reported.
1098+ // An activity's implementation can return activity.ErrResultPending to indicate it will be completed asynchronously.
1099+ // In that case, this CompleteActivity() method should be called when the activity is completed with the
1100+ // actual result and error. If err is nil, activity task completed event will be reported; if err is CanceledError,
1101+ // activity task canceled event will be reported; otherwise, activity task failed event will be reported.
10301102 // An activity implementation should use GetActivityInfo(ctx).TaskToken function to get task token to use for completion.
10311103 // Example:-
10321104 // To complete with a result.
@@ -1037,20 +1109,39 @@ type (
10371109 CompleteActivity (ctx context.Context , taskToken []byte , result interface {}, err error ) error
10381110
10391111 // CompleteActivityByID reports activity completed.
1040- // Similar to CompleteActivity, but may save user from keeping taskToken info.
1041- // activity Execute method can return activity.ErrResultPending to
1042- // indicate the activity is not completed when it's Execute method returns. In that case, this CompleteActivityById() method
1043- // should be called when that activity is completed with the actual result and error. If err is nil, activity task
1044- // completed event will be reported; if err is CanceledError, activity task canceled event will be reported; otherwise,
1045- // activity task failed event will be reported.
1112+ // Similar to CompleteActivity, but may save the user from keeping taskToken info.
1113+ // This method works only for workflow activities. workflowID and runID must be set to the workflow ID and workflow run ID
1114+ // of the workflow that started the activity. To complete a standalone activity (not started by workflow),
1115+ // use CompleteActivityByActivityID.
1116+ //
1117+ // An activity's implementation can return activity.ErrResultPending to indicate it will be completed asynchronously.
1118+ // In that case, this CompleteActivityByID() method should be called when the activity is completed with the
1119+ // actual result and error. If err is nil, activity task completed event will be reported; if err is CanceledError,
1120+ // activity task canceled event will be reported; otherwise, activity task failed event will be reported.
10461121 // An activity implementation should use activityID provided in ActivityOption to use for completion.
1047- // namespace name , workflowID, activityID are required, runID is optional.
1122+ // namespace, workflowID and activityID are required, runID is optional.
10481123 // The errors it can return:
10491124 // - ApplicationError
10501125 // - TimeoutError
10511126 // - CanceledError
10521127 CompleteActivityByID (ctx context.Context , namespace , workflowID , runID , activityID string , result interface {}, err error ) error
10531128
1129+ // CompleteActivityByActivityID reports activity completed.
1130+ // Similar to CompleteActivity, but may save the user from keeping taskToken info.
1131+ // This method works only for standalone activities. To complete a workflow activity, use CompleteActivityByID.
1132+ //
1133+ // An activity's implementation can return activity.ErrResultPending to indicate it will be completed asynchronously.
1134+ // In that case, this CompleteActivityByActivityID() method should be called when the activity is completed with the
1135+ // actual result and error. If err is nil, activity task completed event will be reported; if err is CanceledError,
1136+ // activity task canceled event will be reported; otherwise, activity task failed event will be reported.
1137+ // An activity implementation should use activityID provided in ActivityOption to use for completion.
1138+ // namespace and activityID are required, activityRunID is optional.
1139+ // The errors it can return:
1140+ // - ApplicationError
1141+ // - TimeoutError
1142+ // - CanceledError
1143+ CompleteActivityByActivityID (ctx context.Context , namespace , activityID , activityRunID string , result interface {}, err error ) error
1144+
10541145 // RecordActivityHeartbeat records heartbeat for an activity.
10551146 // taskToken - is the value of the binary "TaskToken" field of the "ActivityInfo" struct retrieved inside the activity.
10561147 // details - is the progress you want to record along with heart beat for this activity. If the activity is canceled,
@@ -1306,6 +1397,41 @@ type (
13061397 // if not specified the most recent runID will be used.
13071398 GetWorkflowUpdateHandle (ref GetWorkflowUpdateHandleOptions ) WorkflowUpdateHandle
13081399
1400+ // ExecuteActivity starts a standalone activity execution and returns an ActivityHandle.
1401+ // The user can use this to start using a function or activity type name.
1402+ // Either by
1403+ // ExecuteActivity(ctx, options, "activityTypeName", arg1, arg2, arg3)
1404+ // or
1405+ // ExecuteActivity(ctx, options, activityFn, arg1, arg2, arg3)
1406+ //
1407+ // Returns an ActivityExecutionAlreadyStarted error if an activity with the same ID already exists
1408+ // in this namespace, unless permitted by the specified ID conflict policy.
1409+ //
1410+ // NOTE: Standalone activities are not associated with a workflow execution.
1411+ // They are scheduled directly on a task queue and executed by a worker.
1412+ //
1413+ // NOTE: Experimental
1414+ ExecuteActivity (ctx context.Context , options StartActivityOptions , activity any , args ... any ) (ActivityHandle , error )
1415+
1416+ // GetActivityHandle creates a handle to the referenced activity.
1417+ //
1418+ // NOTE: Experimental
1419+ GetActivityHandle (options GetActivityHandleOptions ) ActivityHandle
1420+
1421+ // ListActivities lists activity executions based on query.
1422+ //
1423+ // Currently, all errors are returned in the iterator and not the base level error.
1424+ //
1425+ // NOTE: Experimental
1426+ ListActivities (ctx context.Context , options ListActivitiesOptions ) (ListActivitiesResult , error )
1427+
1428+ // CountActivities counts activity executions based on query. The result
1429+ // includes the total count and optionally grouped counts if the query includes
1430+ // a GROUP BY clause.
1431+ //
1432+ // NOTE: Experimental
1433+ CountActivities (ctx context.Context , options CountActivitiesOptions ) (* CountActivitiesResult , error )
1434+
13091435 // WorkflowService provides access to the underlying gRPC service. This should only be used for advanced use cases
13101436 // that cannot be accomplished via other Client methods. Unlike calls to other Client methods, calls directly to the
13111437 // service are not configured with internal semantics such as automatic retries.
0 commit comments