/* * InfluxDB OSS API Service * * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. * * OpenAPI spec version: 2.0.0 * * Generated by: https://github.com/openapitools/openapi-generator.git */ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Threading; using RestSharp; using InfluxDB.Client.Api.Client; using InfluxDB.Client.Api.Domain; namespace InfluxDB.Client.Api.Service { /// /// Represents a collection of functions to interact with the API endpoints /// public interface IRulesService : IApiAccessor { #region Synchronous Operations /// /// Retrieve a notification rule query /// /// /// /// /// Thrown when fails to make API call /// The notification rule ID. /// OpenTracing span context (optional) /// FluxResponse FluxResponse GetNotificationRulesIDQuery(string ruleID, string zapTraceSpan = null); /// /// Retrieve a notification rule query /// /// /// /// /// Thrown when fails to make API call /// The notification rule ID. /// OpenTracing span context (optional) /// ApiResponse of FluxResponse ApiResponse GetNotificationRulesIDQueryWithHttpInfo(string ruleID, string zapTraceSpan = null); #endregion Synchronous Operations #region Asynchronous Operations /// /// Retrieve a notification rule query /// /// /// /// /// Thrown when fails to make API call /// The notification rule ID. /// OpenTracing span context (optional) /// Cancellation token /// Task of FluxResponse System.Threading.Tasks.Task GetNotificationRulesIDQueryAsync(string ruleID, string zapTraceSpan = null, CancellationToken cancellationToken = default); /// /// Retrieve a notification rule query /// /// /// /// /// Thrown when fails to make API call /// The notification rule ID. /// OpenTracing span context (optional) /// Cancellation token /// Task of ApiResponse (FluxResponse) System.Threading.Tasks.Task> GetNotificationRulesIDQueryAsyncWithHttpInfo( string ruleID, string zapTraceSpan = null, CancellationToken cancellationToken = default); #endregion Asynchronous Operations } /// /// Represents a collection of functions to interact with the API endpoints /// public partial class RulesService : IRulesService { private ExceptionFactory _exceptionFactory = (name, response) => null; /// /// Initializes a new instance of the class. /// /// public RulesService(string basePath) { Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = Configuration.DefaultExceptionFactory; } /// /// Initializes a new instance of the class /// using Configuration object /// /// An instance of Configuration /// public RulesService(Configuration configuration = null) { if (configuration == null) // use the default one in Configuration { Configuration = Configuration.Default; } else { Configuration = configuration; } ExceptionFactory = Configuration.DefaultExceptionFactory; } /// /// Gets the base path of the API client. /// /// The base path public string GetBasePath() { return Configuration.ApiClient.RestClientOptions.BaseUrl.ToString(); } /// /// Sets the base path of the API client. /// /// The base path [Obsolete( "SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")] public void SetBasePath(string basePath) { // do nothing } /// /// Gets or sets the configuration object /// /// An instance of the Configuration public Configuration Configuration { get; set; } /// /// Provides a factory method hook for the creation of exceptions. /// public ExceptionFactory ExceptionFactory { get { if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) { throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); } return _exceptionFactory; } set => _exceptionFactory = value; } /// /// Gets the default header. /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] public IDictionary DefaultHeader() { return new ReadOnlyDictionary(Configuration.DefaultHeader); } /// /// Add default header. /// /// Header field name. /// Header field value. /// [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] public void AddDefaultHeader(string key, string value) { Configuration.AddDefaultHeader(key, value); } /// /// Retrieve a notification rule query /// /// Thrown when fails to make API call /// The notification rule ID. /// OpenTracing span context (optional) /// FluxResponse public FluxResponse GetNotificationRulesIDQuery(string ruleID, string zapTraceSpan = null) { var localVarResponse = GetNotificationRulesIDQueryWithHttpInfo(ruleID, zapTraceSpan); return localVarResponse.Data; } /// /// Retrieve a notification rule query /// /// Thrown when fails to make API call /// The notification rule ID. /// OpenTracing span context (optional) /// ApiResponse of FluxResponse public ApiResponse GetNotificationRulesIDQueryWithHttpInfo(string ruleID, string zapTraceSpan = null) { // verify the required parameter 'ruleID' is set if (ruleID == null) { throw new ApiException(400, "Missing required parameter 'ruleID' when calling RulesService->GetNotificationRulesIDQuery"); } var localVarPath = "/api/v2/notificationRules/{ruleID}/query"; var localVarPathParams = new Dictionary(); var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); object localVarPostBody = null; // to determine the Content-Type header var localVarHttpContentTypes = new string[] { }; var localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); if (ruleID != null) { localVarPathParams.Add("ruleID", Configuration.ApiClient.ParameterToString(ruleID)); // path parameter } if (zapTraceSpan != null) { localVarHeaderParams.Add("Zap-Trace-Span", Configuration.ApiClient.ParameterToString(zapTraceSpan)); // header parameter } // to determine the Accept header var localVarHttpHeaderAccepts = new string[] { "application/json" }; var localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null && !localVarHeaderParams.ContainsKey("Accept")) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } // make the HTTP request var localVarResponse = (RestResponse)Configuration.ApiClient.CallApi(localVarPath, Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); var localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { var exception = ExceptionFactory("GetNotificationRulesIDQuery", localVarResponse); if (exception != null) { throw exception; } } return new ApiResponse(localVarStatusCode, localVarResponse.Headers.Select(h => (h.Name, h.Value)), (FluxResponse)Configuration.ApiClient.Deserialize(localVarResponse, typeof(FluxResponse))); } /// /// Retrieve a notification rule query /// /// Thrown when fails to make API call /// The notification rule ID. /// OpenTracing span context (optional) /// Cancellation token /// ApiResponse of FluxResponse public async System.Threading.Tasks.Task GetNotificationRulesIDQueryWithIRestResponseAsync( string ruleID, string zapTraceSpan = null, CancellationToken cancellationToken = default) { // verify the required parameter 'ruleID' is set if (ruleID == null) { throw new ApiException(400, "Missing required parameter 'ruleID' when calling RulesService->GetNotificationRulesIDQuery"); } var localVarPath = "/api/v2/notificationRules/{ruleID}/query"; var localVarPathParams = new Dictionary(); var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); object localVarPostBody = null; // to determine the Content-Type header var localVarHttpContentTypes = new string[] { }; var localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); if (ruleID != null) { localVarPathParams.Add("ruleID", Configuration.ApiClient.ParameterToString(ruleID)); // path parameter } if (zapTraceSpan != null) { localVarHeaderParams.Add("Zap-Trace-Span", Configuration.ApiClient.ParameterToString(zapTraceSpan)); // header parameter } // to determine the Accept header var localVarHttpHeaderAccepts = new string[] { "application/json" }; var localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null && !localVarHeaderParams.ContainsKey("Accept")) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } // make the HTTP request var localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType, cancellationToken).ConfigureAwait(false); var localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { var exception = ExceptionFactory("GetNotificationRulesIDQuery", localVarResponse); if (exception != null) { throw exception; } } return localVarResponse; } /// /// Retrieve a notification rule query /// /// Thrown when fails to make API call /// The notification rule ID. /// OpenTracing span context (optional) /// ApiResponse of FluxResponse public RestResponse GetNotificationRulesIDQueryWithIRestResponse(string ruleID, string zapTraceSpan = null) { // verify the required parameter 'ruleID' is set if (ruleID == null) { throw new ApiException(400, "Missing required parameter 'ruleID' when calling RulesService->GetNotificationRulesIDQuery"); } var localVarPath = "/api/v2/notificationRules/{ruleID}/query"; var localVarPathParams = new Dictionary(); var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); object localVarPostBody = null; // to determine the Content-Type header var localVarHttpContentTypes = new string[] { }; var localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); if (ruleID != null) { localVarPathParams.Add("ruleID", Configuration.ApiClient.ParameterToString(ruleID)); // path parameter } if (zapTraceSpan != null) { localVarHeaderParams.Add("Zap-Trace-Span", Configuration.ApiClient.ParameterToString(zapTraceSpan)); // header parameter } // to determine the Accept header var localVarHttpHeaderAccepts = new string[] { "application/json" }; var localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null && !localVarHeaderParams.ContainsKey("Accept")) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } // make the HTTP request var localVarResponse = (RestResponse)Configuration.ApiClient.CallApi(localVarPath, Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); var localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { var exception = ExceptionFactory("GetNotificationRulesIDQuery", localVarResponse); if (exception != null) { throw exception; } } return localVarResponse; } /// /// Retrieve a notification rule query /// /// Thrown when fails to make API call /// The notification rule ID. /// OpenTracing span context (optional) /// ApiResponse of FluxResponse public RestRequest GetNotificationRulesIDQueryWithRestRequest(string ruleID, string zapTraceSpan = null) { // verify the required parameter 'ruleID' is set if (ruleID == null) { throw new ApiException(400, "Missing required parameter 'ruleID' when calling RulesService->GetNotificationRulesIDQuery"); } var localVarPath = "/api/v2/notificationRules/{ruleID}/query"; var localVarPathParams = new Dictionary(); var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); object localVarPostBody = null; // to determine the Content-Type header var localVarHttpContentTypes = new string[] { }; var localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); if (ruleID != null) { localVarPathParams.Add("ruleID", Configuration.ApiClient.ParameterToString(ruleID)); // path parameter } if (zapTraceSpan != null) { localVarHeaderParams.Add("Zap-Trace-Span", Configuration.ApiClient.ParameterToString(zapTraceSpan)); // header parameter } // to determine the Accept header var localVarHttpHeaderAccepts = new string[] { "application/json" }; var localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null && !localVarHeaderParams.ContainsKey("Accept")) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } return Configuration.ApiClient.PrepareRequest(localVarPath, Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); } /// /// Retrieve a notification rule query /// /// Thrown when fails to make API call /// The notification rule ID. /// OpenTracing span context (optional) /// Cancellation token /// Task of FluxResponse public async System.Threading.Tasks.Task GetNotificationRulesIDQueryAsync(string ruleID, string zapTraceSpan = null, CancellationToken cancellationToken = default) { var localVarResponse = await GetNotificationRulesIDQueryAsyncWithHttpInfo(ruleID, zapTraceSpan, cancellationToken) .ConfigureAwait(false); return localVarResponse.Data; } /// /// Retrieve a notification rule query /// /// Thrown when fails to make API call /// The notification rule ID. /// OpenTracing span context (optional) /// Cancellation token /// Task of ApiResponse (FluxResponse) public async System.Threading.Tasks.Task> GetNotificationRulesIDQueryAsyncWithHttpInfo(string ruleID, string zapTraceSpan = null, CancellationToken cancellationToken = default) { // make the HTTP request var localVarResponse = await GetNotificationRulesIDQueryAsyncWithIRestResponse(ruleID, zapTraceSpan, cancellationToken) .ConfigureAwait(false); var localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { var exception = ExceptionFactory("GetNotificationRulesIDQuery", localVarResponse); if (exception != null) { throw exception; } } return new ApiResponse(localVarStatusCode, localVarResponse.Headers.Select(h => (h.Name, h.Value)), (FluxResponse)Configuration.ApiClient.Deserialize(localVarResponse, typeof(FluxResponse))); } /// /// Retrieve a notification rule query /// /// Thrown when fails to make API call /// The notification rule ID. /// OpenTracing span context (optional) /// Cancellation token /// Task of RestResponse (FluxResponse) public async System.Threading.Tasks.Task GetNotificationRulesIDQueryAsyncWithIRestResponse( string ruleID, string zapTraceSpan = null, CancellationToken cancellationToken = default) { // verify the required parameter 'ruleID' is set if (ruleID == null) { throw new ApiException(400, "Missing required parameter 'ruleID' when calling RulesService->GetNotificationRulesIDQuery"); } var localVarPath = "/api/v2/notificationRules/{ruleID}/query"; var localVarPathParams = new Dictionary(); var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); object localVarPostBody = null; // to determine the Content-Type header var localVarHttpContentTypes = new string[] { }; var localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); if (ruleID != null) { localVarPathParams.Add("ruleID", Configuration.ApiClient.ParameterToString(ruleID)); // path parameter } if (zapTraceSpan != null) { localVarHeaderParams.Add("Zap-Trace-Span", Configuration.ApiClient.ParameterToString(zapTraceSpan)); // header parameter } // to determine the Accept header var localVarHttpHeaderAccepts = new string[] { "application/json" }; var localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null && !localVarHeaderParams.ContainsKey("Accept")) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } // make the HTTP request var localVarResponse = (RestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType, cancellationToken).ConfigureAwait(false); if (ExceptionFactory != null) { var exception = ExceptionFactory("GetNotificationRulesIDQuery", localVarResponse); if (exception != null) { throw exception; } } return localVarResponse; } } }