using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using InfluxDB.Client.Api.Domain;
using InfluxDB.Client.Api.Service;
using InfluxDB.Client.Core;
namespace InfluxDB.Client
{
public interface ITasksApi
{
///
/// Creates a new task. The has to have defined a cron or a every repetition
/// by the option statement.
///
/// This sample shows how to specify every repetition
///
/// option task = {
/// name: "mean",
/// every: 1h,
/// }
///
/// from(bucket:"metrics/autogen")
/// |> range(start:-task.every)
/// |> group(columns:["level"])
/// |> mean()
/// |> yield(name:"mean")
///
///
///
/// task to create (required)
/// Cancellation token
/// Created Task
///
Task CreateTaskAsync(TaskType task, CancellationToken cancellationToken = default);
///
/// Create a new task.
///
/// task to create (required)
/// Cancellation token
/// Created Task
Task CreateTaskAsync(TaskCreateRequest taskCreateRequest,
CancellationToken cancellationToken = default);
///
/// Creates a new task with task repetition by cron. The is without a cron or a every
/// repetition.
/// The repetition is automatically append to the option statement.
///
/// description of the task
/// the Flux script to run for this task
/// a task repetition schedule in the form '* * * * * *'
/// the organization that owns this Task
/// Cancellation token
///
///
Task CreateTaskCronAsync(string name, string flux, string cron,
Organization organization, CancellationToken cancellationToken = default);
///
/// Creates a new task with task repetition by cron. The is without a cron or a every
/// repetition.
/// The repetition is automatically append to the option statement.
///
/// description of the task
/// the Flux script to run for this task
/// a task repetition schedule in the form '* * * * * *'
/// the organization ID that owns this Task
/// Cancellation token
///
///
Task CreateTaskCronAsync(string name, string flux, string cron,
string orgId, CancellationToken cancellationToken = default);
///
/// Creates a new task with task repetition by duration expression ("1h", "30s"). The is
/// without a cron or a every repetition.
/// The repetition is automatically append to the option statement.
///
/// description of the task
/// the Flux script to run for this task
/// a task repetition by duration expression
/// the organization that owns this Task
/// Cancellation token
/// Created Task
///
Task CreateTaskEveryAsync(string name, string flux, string every,
Organization organization, CancellationToken cancellationToken = default);
///
/// Creates a new task with task repetition by duration expression ("1h", "30s"). The is
/// without a cron or a every repetition.
/// The repetition is automatically append to the option statement.
///
/// description of the task
/// the Flux script to run for this task
/// a task repetition by duration expression
/// the organization ID that owns this Task
/// Cancellation token
/// Created Task
///
Task CreateTaskEveryAsync(string name, string flux, string every,
string orgId, CancellationToken cancellationToken = default);
///
/// Update a task. This will cancel all queued runs.
///
/// task update to apply
/// Cancellation token
/// task updated
Task UpdateTaskAsync(TaskType task, CancellationToken cancellationToken = default);
///
/// Update a task. This will cancel all queued runs.
///
/// ID of task to get
/// task update to apply
/// Cancellation token
/// task updated
Task UpdateTaskAsync(string taskId, TaskUpdateRequest request,
CancellationToken cancellationToken = default);
///
/// Delete a task.
///
/// ID of task to delete
/// Cancellation token
/// task deleted
Task DeleteTaskAsync(string taskId, CancellationToken cancellationToken = default);
///
/// Delete a task.
///
/// task to delete
/// Cancellation token
/// task deleted
Task DeleteTaskAsync(TaskType task, CancellationToken cancellationToken = default);
///
/// Clone a task.
///
/// ID of task to clone
/// Cancellation token
/// cloned task
Task CloneTaskAsync(string taskId, CancellationToken cancellationToken = default);
///
/// Clone a task.
///
/// task to clone
/// Cancellation token
/// cloned task
Task CloneTaskAsync(TaskType task, CancellationToken cancellationToken = default);
///
/// Retrieve a task.
///
/// ID of task to get
/// Cancellation token
/// task details
Task FindTaskByIdAsync(string taskId, CancellationToken cancellationToken = default);
///
/// Lists tasks, limit 100.
///
/// filter tasks to a specific user
/// Cancellation token
/// A list of tasks
Task> FindTasksByUserAsync(User user, CancellationToken cancellationToken = default);
///
/// Lists tasks, limit 100.
///
/// filter tasks to a specific user ID
/// Cancellation token
/// A list of tasks
Task> FindTasksByUserIdAsync(string userId, CancellationToken cancellationToken = default);
///
/// Lists tasks, limit 100.
///
/// filter tasks to a specific organization
/// Cancellation token
/// A list of tasks
Task> FindTasksByOrganizationAsync(Organization organization,
CancellationToken cancellationToken = default);
///
/// Lists tasks, limit 100.
///
/// filter tasks to a specific organization ID
/// Cancellation token
/// A list of tasks
Task> FindTasksByOrganizationIdAsync(string orgId,
CancellationToken cancellationToken = default);
///
/// Lists tasks, limit 100.
///
/// returns tasks after specified ID
/// filter tasks to a specific user ID
/// filter tasks to a specific organization ID
/// Filter tasks to a specific organization name. (optional)
/// Returns task with a specific name. (optional)
/// The number of tasks to return (optional, default to 100)
/// Cancellation token
/// A list of tasks
Task> FindTasksAsync(string afterId = null, string userId = null,
string orgId = null, string org = null, string name = null, int? limit = null,
CancellationToken cancellationToken = default);
///
/// List all members of a task.
///
/// task of the members
/// Cancellation token
/// the List all members of a task
Task> GetMembersAsync(TaskType task, CancellationToken cancellationToken = default);
///
/// List all members of a task.
///
/// ID of task to get members
/// Cancellation token
/// the List all members of a task
Task> GetMembersAsync(string taskId,
CancellationToken cancellationToken = default);
///
/// Add a task member.
///
/// the member of a task
/// the task of a member
/// Cancellation token
/// created mapping
Task AddMemberAsync(User member, TaskType task,
CancellationToken cancellationToken = default);
///
/// Add a task member.
///
/// the ID of a member
/// the ID of a task
/// Cancellation token
/// created mapping
Task AddMemberAsync(string memberId, string taskId,
CancellationToken cancellationToken = default);
///
/// Removes a member from a task.
///
/// the member of a task
/// the task of a member
/// Cancellation token
/// member removed
Task DeleteMemberAsync(User member, TaskType task, CancellationToken cancellationToken = default);
///
/// Removes a member from a task.
///
/// the ID of a member
/// the ID of a task
/// Cancellation token
/// member removed
Task DeleteMemberAsync(string memberId, string taskId, CancellationToken cancellationToken = default);
///
/// List all owners of a task.
///
/// task of the owners
/// Cancellation token
/// the List all owners of a task
Task> GetOwnersAsync(TaskType task, CancellationToken cancellationToken = default);
///
/// List all owners of a task.
///
/// ID of a task to get owners
/// Cancellation token
/// the List all owners of a task
Task> GetOwnersAsync(string taskId,
CancellationToken cancellationToken = default);
///
/// Add a task owner.
///
/// the owner of a task
/// the task of a owner
/// Cancellation token
/// created mapping
Task AddOwnerAsync(User owner, TaskType task,
CancellationToken cancellationToken = default);
///
/// Add a task owner.
///
/// the ID of a owner
/// the ID of a task
/// Cancellation token
/// created mapping
Task AddOwnerAsync(string ownerId, string taskId,
CancellationToken cancellationToken = default);
///
/// Removes a owner from a task.
///
/// the owner of a task
/// the task of a owner
/// Cancellation token
/// owner removed
Task DeleteOwnerAsync(User owner, TaskType task, CancellationToken cancellationToken = default);
///
/// Removes a owner from a task.
///
/// the ID of a owner
/// the ID of a task
/// Cancellation token
/// owner removed
Task DeleteOwnerAsync(string ownerId, string taskId, CancellationToken cancellationToken = default);
///
/// Retrieve all logs for a task.
///
/// task to get logs for
/// Cancellation token
/// the list of all logs for a task
Task> GetLogsAsync(TaskType task, CancellationToken cancellationToken = default);
///
/// Retrieve all logs for a task.
///
/// ID of task to get logs for
/// Cancellation token
/// the list of all logs for a task
Task> GetLogsAsync(string taskId, CancellationToken cancellationToken = default);
///
/// Retrieve list of run records for a task.
///
/// task to get runs for
/// Cancellation token
/// the list of run records for a task
Task> GetRunsAsync(TaskType task, CancellationToken cancellationToken = default);
///
/// Retrieve list of run records for a task.
///
/// task to get runs for
/// filter runs to those scheduled after this time
/// filter runs to those scheduled before this time
/// the number of runs to return. Default value: 20.
/// Cancellation token
/// the list of run records for a task
Task> GetRunsAsync(TaskType task, DateTime? afterTime,
DateTime? beforeTime, int? limit, CancellationToken cancellationToken = default);
///
/// Retrieve list of run records for a task.
///
/// ID of task to get runs for
/// Cancellation token
/// the list of run records for a task
Task> GetRunsAsync(string taskId, CancellationToken cancellationToken = default);
///
/// Retrieve list of run records for a task.
///
/// ID of task to get runs for
/// filter runs to those scheduled after this time
/// filter runs to those scheduled before this time
/// the number of runs to return. Default value: 20.
/// Cancellation token
/// the list of run records for a task
Task> GetRunsAsync(string taskId,
DateTime? afterTime, DateTime? beforeTime, int? limit, CancellationToken cancellationToken = default);
///
/// Retrieve a single run record for a task.
///
/// ID of task to get runs for
/// ID of run
/// Cancellation token
/// a single run record for a task
Task GetRunAsync(string taskId, string runId, CancellationToken cancellationToken = default);
///
/// Retry a task run.
///
/// the run to retry
/// Cancellation token
/// the executed run
Task RetryRunAsync(Run run, CancellationToken cancellationToken = default);
///
/// Retry a task run.
///
/// ID of task with the run to retry
/// ID of run to retry
/// Cancellation token
/// the executed run
Task RetryRunAsync(string taskId, string runId, CancellationToken cancellationToken = default);
///
/// Cancels a currently running run.
///
/// the run to cancel
/// Cancellation token
///
Task CancelRunAsync(Run run, CancellationToken cancellationToken = default);
///
/// Cancels a currently running run.
///
/// ID of task with the run to cancel
/// ID of run to cancel
/// Cancellation token
///
Task CancelRunAsync(string taskId, string runId, CancellationToken cancellationToken = default);
///
/// Retrieve all logs for a run.
///
/// the run to gets logs for it
/// Cancellation token
/// the list of all logs for a run
Task> GetRunLogsAsync(Run run, CancellationToken cancellationToken = default);
///
/// Retrieve all logs for a run.
///
/// ID of task to get run logs for it
/// ID of run to get logs for it
/// Cancellation token
/// the list of all logs for a run
Task> GetRunLogsAsync(string taskId, string runId,
CancellationToken cancellationToken = default);
///
/// List all labels of a Task.
///
/// a Task of the labels
/// Cancellation token
/// the List all labels of a Task
Task> GetLabelsAsync(TaskType task, CancellationToken cancellationToken = default);
///
/// List all labels of a Task.
///
/// ID of a Task to get labels
/// Cancellation token
/// the List all labels of a Task
Task> GetLabelsAsync(string taskId, CancellationToken cancellationToken = default);
///
/// Add a Task label.
///
/// the label of a Task
/// a Task of a label
/// Cancellation token
/// added label
Task