|
| 1 | +// Copyright © 2024-Present The Serverless Workflow Specification Authors |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"), |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | +// |
| 8 | +// Unless required by applicable law or agreed to in writing, software |
| 9 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | +// See the License for the specific language governing permissions and |
| 12 | +// limitations under the License. |
| 13 | + |
| 14 | +namespace ServerlessWorkflow.Sdk.Builders; |
| 15 | + |
| 16 | +/// <summary> |
| 17 | +/// Defines the fundamentals of a service used to build <see cref="SubscriptionIteratorDefinition"/>s |
| 18 | +/// </summary> |
| 19 | +public interface ISubscriptionIteratorDefinitionBuilder |
| 20 | +{ |
| 21 | + |
| 22 | + /// <summary> |
| 23 | + /// Sets the name of the variable used to store the item being enumerated |
| 24 | + /// </summary> |
| 25 | + /// <param name="item">The name of the variable used to store the item being enumerated</param> |
| 26 | + /// <returns>The configured <see cref="ISubscriptionIteratorDefinitionBuilder"/></returns> |
| 27 | + ISubscriptionIteratorDefinitionBuilder Item(string item); |
| 28 | + |
| 29 | + /// <summary> |
| 30 | + /// Sets the name of the variable used to store the index of the item being enumerated |
| 31 | + /// </summary> |
| 32 | + /// <param name="at">The name of the variable used to store the index of the item being enumerated</param> |
| 33 | + /// <returns>The configured <see cref="ISubscriptionIteratorDefinitionBuilder"/></returns> |
| 34 | + ISubscriptionIteratorDefinitionBuilder At(string at); |
| 35 | + |
| 36 | + /// <summary> |
| 37 | + /// Sets the tasks to execute for each event or message consumed |
| 38 | + /// </summary> |
| 39 | + /// <param name="setup">An <see cref="Action{T}"/> used to configure the tasks to execute for each event or message consumed</param> |
| 40 | + /// <returns>The configured <see cref="ISubscriptionIteratorDefinitionBuilder"/></returns> |
| 41 | + ISubscriptionIteratorDefinitionBuilder Do(Action<ITaskDefinitionMapBuilder> setup); |
| 42 | + |
| 43 | + /// <summary> |
| 44 | + /// Configures the output data of each item |
| 45 | + /// </summary> |
| 46 | + /// <param name="setup">An <see cref="Action{T}"/> used to configure the output data</param> |
| 47 | + /// <returns>The configured <see cref="ISubscriptionIteratorDefinitionBuilder"/></returns> |
| 48 | + ISubscriptionIteratorDefinitionBuilder Output(Action<IOutputDataModelDefinitionBuilder> setup); |
| 49 | + |
| 50 | + /// <summary> |
| 51 | + /// Configures the data exported by each item |
| 52 | + /// </summary> |
| 53 | + /// <param name="setup">An <see cref="Action{T}"/> used to configure the exported data</param> |
| 54 | + /// <returns>The configured <see cref="ISubscriptionIteratorDefinitionBuilder"/></returns> |
| 55 | + ISubscriptionIteratorDefinitionBuilder Export(Action<IOutputDataModelDefinitionBuilder> setup); |
| 56 | + |
| 57 | + /// <summary> |
| 58 | + /// Builds the configured <see cref="SubscriptionIteratorDefinition"/> |
| 59 | + /// </summary> |
| 60 | + /// <returns>A new <see cref="SubscriptionIteratorDefinition"/></returns> |
| 61 | + SubscriptionIteratorDefinition Build(); |
| 62 | + |
| 63 | +} |
0 commit comments