Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: use file-scope namespace and primary constructor #735

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 81 additions & 82 deletions Client/Api/Commands/IActivateJobsCommandStep1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,93 +16,92 @@
using System.Collections.Generic;
using Zeebe.Client.Api.Responses;

namespace Zeebe.Client.Api.Commands
namespace Zeebe.Client.Api.Commands;

public interface IActivateJobsCommandStep1
{
public interface IActivateJobsCommandStep1
{
/// <summary>
/// Set the type of jobs to work on.
/// </summary>
/// <param name="jobType">the type of jobs (e.g. "payment")</param>
/// <returns>the builder for this command</returns>
IActivateJobsCommandStep2 JobType(string jobType);
}
/// <summary>
/// Set the type of jobs to work on.
/// </summary>
/// <param name="jobType">the type of jobs (e.g. "payment").</param>
/// <returns>the builder for this command..</returns>
IActivateJobsCommandStep2 JobType(string jobType);
}

public interface IActivateJobsCommandStep2
{
/// <summary>
/// Set the maximum of jobs to activate. If less jobs are available for activation the
/// command will return a list with fewer jobs.
/// </summary>
/// <param name="maxJobsToActivate">the maximal number of jobs to activate</param>
/// <returns>the builder for this command</returns>
IActivateJobsCommandStep3 MaxJobsToActivate(int maxJobsToActivate);
}
public interface IActivateJobsCommandStep2
{
/// <summary>
/// Set the maximum of jobs to activate. If less jobs are available for activation the
/// command will return a list with fewer jobs.
/// </summary>
/// <param name="maxJobsToActivate">the maximal number of jobs to activate.</param>
/// <returns>the builder for this command.</returns>
IActivateJobsCommandStep3 MaxJobsToActivate(int maxJobsToActivate);
}

public interface IActivateJobsCommandStep3 : ITenantIdsCommandStep<IActivateJobsCommandStep3>, IFinalCommandWithRetryStep<IActivateJobsResponse>
{
/// <summary>
/// Set the time for how long a job is exclusively assigned for this subscription.
///
/// <para>In this time, the job can not be assigned by other subscriptions to ensure that only one
/// subscription work on the job. When the time is over then the job can be assigned again by
/// this or other subscription if it's not completed yet.
///
/// </summary>
/// <param name="timeout">the time as time span (e.g. "TimeSpan.FromMinutes(10)")</param>
/// <returns>the builder for this command. Call <see cref="IFinalCommandStep{T}.Send"/> to complete the command and send
/// it to the broker.</returns>
IActivateJobsCommandStep3 Timeout(TimeSpan timeout);
public interface IActivateJobsCommandStep3 : ITenantIdsCommandStep<IActivateJobsCommandStep3>, IFinalCommandWithRetryStep<IActivateJobsResponse>
{
/// <summary>
/// Set the time for how long a job is exclusively assigned for this subscription.
///
/// In this time, the job can not be assigned by other subscriptions to ensure that only one
/// subscription work on the job. When the time is over then the job can be assigned again by
/// this or other subscription if it's not completed yet.
///
/// </summary>
/// <param name="timeout">the time as time span (e.g. "TimeSpan.FromMinutes(10)").</param>
/// <returns>the builder for this command. Call <see cref="IFinalCommandStep{T}.Send(TimeSpan?,System.Threading.CancellationToken)"/> to complete the command and send
/// it to the broker.</returns>
IActivateJobsCommandStep3 Timeout(TimeSpan timeout);

/// <summary>
/// Set the name of the job worker.
///
/// <para>This name is used to identify the worker which activated the jobs. Its main purpose is for
/// monitoring and auditing. Commands on activated jobs do not check the worker name, i.e.
/// complete or fail job.
///
/// </summary>
/// <param name="workerName">the name of the worker (e.g. "payment-service")</param>
/// <returns>the builder for this command. Call <see cref="IFinalCommandStep{T}.Send"/> to complete the command and send
/// it to the broker.</returns>
IActivateJobsCommandStep3 WorkerName(string workerName);
/// <summary>
/// Set the name of the job worker.
///
/// This name is used to identify the worker which activated the jobs. Its main purpose is for
/// monitoring and auditing. Commands on activated jobs do not check the worker name, i.e.
/// complete or fail job.
///
/// </summary>
/// <param name="workerName">the name of the worker (e.g. "payment-service").</param>
/// <returns>the builder for this command. Call <see cref="IFinalCommandStep{T}.Send(System.TimeSpan?,System.Threading.CancellationToken)"/> to complete the command and send
/// it to the broker.</returns>
IActivateJobsCommandStep3 WorkerName(string workerName);

/// <summary>
/// Set a list of variable names which should be fetch on job activation.
///
/// <para>The jobs which are activated by this command will only contain variables from this list.
///
/// <para>This can be used to limit the number of variables of the activated jobs.
/// </summary>
/// <param name="fetchVariables">list of variables names to fetch on activation</param>
/// <returns>the builder for this command. Call <see cref="IFinalCommandStep{T}.Send"/> to complete the command and send
/// it to the broker.</returns>
IActivateJobsCommandStep3 FetchVariables(IList<string> fetchVariables);
/// <summary>
/// Set a list of variable names which should be fetch on job activation.
///
/// The jobs which are activated by this command will only contain variables from this list.
///
/// This can be used to limit the number of variables of the activated jobs.
/// </summary>
/// <param name="fetchVariables">list of variables names to fetch on activation.</param>
/// <returns>the builder for this command. Call <see cref="IFinalCommandStep{T}.Send(TimeSpan?,System.Threading.CancellationToken)"/> to complete the command and send
/// it to the broker.</returns>
IActivateJobsCommandStep3 FetchVariables(IList<string> fetchVariables);

/// <summary>
/// Set the polling timeout.
///
/// <para>The activate jobs request will be completed when at least one job is activated or after the given pollingTimeout.
///
/// </summary>
/// <param name="pollingTimeout">the polling timeout (e.g. "TimeSpan.FromMinutes(10)")
/// </param>
/// <returns>the builder for this command. Call <see cref="IFinalCommandStep{T}.Send"/> to complete the command and send
/// it to the broker.</returns>
IActivateJobsCommandStep3 PollingTimeout(TimeSpan pollingTimeout);
/// <summary>
/// Set the polling timeout.
///
/// The activate jobs request will be completed when at least one job is activated or after the given pollingTimeout.
///
/// </summary>
/// <param name="pollingTimeout">the polling timeout (e.g. "TimeSpan.FromMinutes(10)").
/// </param>
/// <returns>the builder for this command. Call <see cref="IFinalCommandStep{T}.Send(System.TimeSpan?,System.Threading.CancellationToken)"/> to complete the command and send
/// it to the broker.</returns>
IActivateJobsCommandStep3 PollingTimeout(TimeSpan pollingTimeout);

/// <summary>
/// Set a list of variable names which should be fetch on job activation.
///
/// <para>The jobs which are activated by this command will only contain variables from this list.
///
/// <para>This can be used to limit the number of variables of the activated jobs.
/// </summary>
/// <param name="fetchVariables">list of variables names to fetch on activation</param>
/// <returns>
/// the builder for this command. Call <see cref="IFinalCommandStep{T}.Send"/> to complete the command and send
/// it to the broker.
/// </returns>
IActivateJobsCommandStep3 FetchVariables(params string[] fetchVariables);
}
/// <summary>
/// Set a list of variable names which should be fetch on job activation.
///
/// The jobs which are activated by this command will only contain variables from this list.
///
/// This can be used to limit the number of variables of the activated jobs.
/// </summary>
/// <param name="fetchVariables">list of variables names to fetch on activation.</param>
/// <returns>
/// the builder for this command. Call <see cref="IFinalCommandStep{T}.Send(System.TimeSpan?,System.Threading.CancellationToken)"/> to complete the command and send
/// it to the broker.
/// </returns>
IActivateJobsCommandStep3 FetchVariables(params string[] fetchVariables);
}
11 changes: 5 additions & 6 deletions Client/Api/Commands/ICancelProcessInstanceCommandStep1.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using Zeebe.Client.Api.Responses;

namespace Zeebe.Client.Api.Commands
namespace Zeebe.Client.Api.Commands;

public interface ICancelProcessInstanceCommandStep1 : IFinalCommandWithRetryStep<ICancelProcessInstanceResponse>
{
public interface ICancelProcessInstanceCommandStep1 : IFinalCommandWithRetryStep<ICancelProcessInstanceResponse>
{
// the place for new optional parameters
}
}
// the place for new optional parameters
}
23 changes: 11 additions & 12 deletions Client/Api/Commands/ICompleteJobCommandStep1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@
// limitations under the License.
using Zeebe.Client.Api.Responses;

namespace Zeebe.Client.Api.Commands
namespace Zeebe.Client.Api.Commands;

public interface ICompleteJobCommandStep1 : IFinalCommandWithRetryStep<ICompleteJobResponse>
{
public interface ICompleteJobCommandStep1 : IFinalCommandWithRetryStep<ICompleteJobResponse>
{
/// <summary>
/// Set the variables to complete the job with.
/// </summary>
/// <param name="variables">the variables (JSON) as String.</param>
/// <returns>the builder for this command. Call <see cref="IFinalCommandWithRetryStep{T}.Send"/> to complete the command and send it
/// to the broker.</returns>
ICompleteJobCommandStep1 Variables(string variables);
}
}
/// <summary>
/// Set the variables to complete the job with.
/// </summary>
/// <param name="variables">the variables (JSON) as String.</param>
/// <returns>the builder for this command. Call <see cref="IFinalCommandStep{T}.Send(System.TimeSpan?,System.Threading.CancellationToken)"/> to complete the command and send it
/// to the broker.</returns>
ICompleteJobCommandStep1 Variables(string variables);
}
147 changes: 77 additions & 70 deletions Client/Api/Commands/ICreateProcessInstanceCommandStep1.cs
Original file line number Diff line number Diff line change
@@ -1,81 +1,88 @@
using System.Collections.Generic;
using Zeebe.Client.Api.Responses;

namespace Zeebe.Client.Api.Commands
namespace Zeebe.Client.Api.Commands;

public interface ICreateProcessInstanceCommandStep1
{
public interface ICreateProcessInstanceCommandStep1
{
/// <summary>
/// Set the BPMN process id of the process to create an instance of. This is the static id of the
/// process in the BPMN XML (i.e. "&#60;bpmn:process id='my-process'&#62;").
/// </summary>
/// <param name="bpmnProcessId">the BPMN process id of the process</param>
/// <returns>the builder for this command</returns>
ICreateProcessInstanceCommandStep2 BpmnProcessId(string bpmnProcessId);
/// <summary>
/// Set the BPMN process id of the process to create an instance of. This is the static id of the
/// process in the BPMN XML (i.e. "&#60;bpmn:process id='my-process'&#62;").
/// </summary>
/// <param name="bpmnProcessId">the BPMN process id of the process.</param>
/// <returns>the builder for this command.</returns>
ICreateProcessInstanceCommandStep2 BpmnProcessId(string bpmnProcessId);

/// <summary>
/// Set the key of the process to create an instance of. The key is assigned by the broker while
/// deploying the process. It can be picked from the deployment or process event.
/// </summary>
/// <param name="processDefinitionKey">the key of the process</param>
/// <returns>the builder for this command</returns>
ICreateProcessInstanceCommandStep3 ProcessDefinitionKey(long processDefinitionKey);
}
/// <summary>
/// Set the key of the process to create an instance of. The key is assigned by the broker while
/// deploying the process. It can be picked from the deployment or process event.
/// </summary>
/// <param name="processDefinitionKey">the key of the process.</param>
/// <returns>the builder for this command.</returns>
ICreateProcessInstanceCommandStep3 ProcessDefinitionKey(long processDefinitionKey);
}

public interface ICreateProcessInstanceCommandStep2
{
/// <summary>
/// Set the version of the process to create an instance of. The version is assigned by the
/// broker while deploying the process. It can be picked from the deployment or process event.
/// </summary>
/// <param name="version">the version of the process</param>
/// <returns>the builder for this command</returns>
ICreateProcessInstanceCommandStep3 Version(int version);
public interface ICreateProcessInstanceCommandStep2
{
/// <summary>
/// Set the version of the process to create an instance of. The version is assigned by the
/// broker while deploying the process. It can be picked from the deployment or process event.
/// </summary>
/// <param name="version">the version of the process.</param>
/// <returns>the builder for this command.</returns>
ICreateProcessInstanceCommandStep3 Version(int version);

/// <summary>
/// Use the latest version of the process to create an instance of.
/// <para>
/// If the latest version was deployed few moments before then it can happen that the new
/// instance is created of the previous version.
/// </para>
/// </summary>
/// <returns>the builder for this command</returns>
ICreateProcessInstanceCommandStep3 LatestVersion();
}
/// <summary>
/// Use the latest version of the process to create an instance of.
/// <para>
/// If the latest version was deployed few moments before then it can happen that the new
/// instance is created of the previous version.
/// </para>
/// </summary>
/// <returns>the builder for this command.</returns>
ICreateProcessInstanceCommandStep3 LatestVersion();
}

public interface ICreateProcessInstanceCommandStep3 : IFinalCommandWithRetryStep<IProcessInstanceResponse>, ITenantIdCommandStep<ICreateProcessInstanceCommandStep3>
{
/// <summary>
/// Set the initial variables of the process instance.
/// </summary>
/// <param name="variables">the variables (JSON) as String</param>
/// <returns>the builder for this command. Call <see cref="IFinalCommandWithRetryStep{T}.Send"/> to complete the command and send
/// it to the broker.</returns>
ICreateProcessInstanceCommandStep3 Variables(string variables);
public interface ICreateProcessInstanceCommandStep3 : IFinalCommandWithRetryStep<IProcessInstanceResponse>,
ITenantIdCommandStep<ICreateProcessInstanceCommandStep3>
{
/// <summary>
/// Set the initial variables of the process instance.
/// </summary>
/// <param name="variables">the variables (JSON) as String.</param>
/// <returns>the builder for this command.
/// Call <see cref="IFinalCommandStep{T}.Send(System.TimeSpan?,System.Threading.CancellationToken)"/>
/// to complete the command and send it to the broker.</returns>
ICreateProcessInstanceCommandStep3 Variables(string variables);

/// <summary>
/// When this method is called, the response to the command will be received after the process
/// is completed. The response consists of a set of variables.
/// </summary>
/// <returns>the builder for this command. Call <see cref="IFinalCommandStep{T}.Send"/> to complete the command and send it to the broker</returns>
ICreateProcessInstanceWithResultCommandStep1 WithResult();
}
/// <summary>
/// When this method is called, the response to the command will be received after the process
/// is completed. The response consists of a set of variables.
/// </summary>
/// <returns>the builder for this command.
/// Call <see cref="IFinalCommandStep{T}.Send(System.TimeSpan?,System.Threading.CancellationToken)"/> to complete
/// the command and send it to the broker.</returns>
ICreateProcessInstanceWithResultCommandStep1 WithResult();
}

public interface ICreateProcessInstanceWithResultCommandStep1
: IFinalCommandWithRetryStep<IProcessInstanceResult>
{
/// <summary>
/// Set a list of variables names which should be fetched in the response.
/// </summary>
/// <param name="fetchVariables">set of names of variables to be included in the response</param>
/// <returns>the builder for this command. Call <see cref="IFinalCommandStep{T}.Send"/> to complete the command and send it to the broker</returns>
ICreateProcessInstanceWithResultCommandStep1 FetchVariables(IList<string> fetchVariables);
public interface ICreateProcessInstanceWithResultCommandStep1
: IFinalCommandWithRetryStep<IProcessInstanceResult>
{
/// <summary>
/// Set a list of variables names which should be fetched in the response.
/// </summary>
/// <param name="fetchVariables">set of names of variables to be included in the response.</param>
/// <returns>the builder for this command.
/// Call <see cref="IFinalCommandStep{T}.Send(System.TimeSpan?,System.Threading.CancellationToken)"/> to complete
/// the command and send it to the broker.</returns>
ICreateProcessInstanceWithResultCommandStep1 FetchVariables(IList<string> fetchVariables);

/// <summary>
/// Set a list of variables names which should be fetched in the response.
/// </summary>
/// <param name="fetchVariables">set of names of variables to be included in the response</param>
/// <returns>the builder for this command. Call <see cref="IFinalCommandStep{T}.Send"/> to complete the command and send it to the broker</returns>
ICreateProcessInstanceWithResultCommandStep1 FetchVariables(params string[] fetchVariables);
}
}
/// <summary>
/// Set a list of variables names which should be fetched in the response.
/// </summary>
/// <param name="fetchVariables">set of names of variables to be included in the response.</param>
/// <returns>the builder for this command.
/// Call <see cref="IFinalCommandStep{T}.Send(System.TimeSpan?,System.Threading.CancellationToken)"/> to complete
/// the command and send it to the broker.</returns>
ICreateProcessInstanceWithResultCommandStep1 FetchVariables(params string[] fetchVariables);
}
Loading
Loading