/* * 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.Linq; using System.IO; using System.Text; using System.Text.RegularExpressions; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using OpenAPIDateConverter = InfluxDB.Client.Api.Client.OpenAPIDateConverter; namespace InfluxDB.Client.Api.Domain { /// /// Query influx using the Flux language /// [DataContract] public partial class Query : IEquatable { /// /// The type of query. Must be \"flux\". /// /// The type of query. Must be \"flux\". [JsonConverter(typeof(StringEnumConverter))] public enum TypeEnum { /// /// Enum Flux for value: flux /// [EnumMember(Value = "flux")] Flux = 1 } /// /// The type of query. Must be \"flux\". /// /// The type of query. Must be \"flux\". [DataMember(Name = "type", EmitDefaultValue = false)] public TypeEnum? Type { get; set; } /// /// Initializes a new instance of the class. /// [JsonConstructorAttribute] protected Query() { } /// /// Initializes a new instance of the class. /// /// _extern. /// Query script to execute. (required). /// The type of query. Must be \"flux\".. /// Enumeration of key/value pairs that respresent parameters to be injected into query (can only specify either this field or extern and not both). /// dialect. /// Specifies the time that should be reported as \"now\" in the query. Default is the server's now time.. public Query(File _extern = default, string query = default, TypeEnum? type = default, Dictionary _params = default, Dialect dialect = default, DateTime? now = default) { // to ensure "query" is required (not null) if (query == null) { throw new InvalidDataException("query is a required property for Query and cannot be null"); } _Query = query; Extern = _extern; Type = type; Params = _params; Dialect = dialect; Now = now; } /// /// Gets or Sets Extern /// [DataMember(Name = "extern", EmitDefaultValue = false)] public File Extern { get; set; } /// /// Query script to execute. /// /// Query script to execute. [DataMember(Name = "query", EmitDefaultValue = false)] public string _Query { get; set; } /// /// Enumeration of key/value pairs that respresent parameters to be injected into query (can only specify either this field or extern and not both) /// /// Enumeration of key/value pairs that respresent parameters to be injected into query (can only specify either this field or extern and not both) [DataMember(Name = "params", EmitDefaultValue = false)] public Dictionary Params { get; set; } /// /// Gets or Sets Dialect /// [DataMember(Name = "dialect", EmitDefaultValue = false)] public Dialect Dialect { get; set; } /// /// Specifies the time that should be reported as \"now\" in the query. Default is the server's now time. /// /// Specifies the time that should be reported as \"now\" in the query. Default is the server's now time. [DataMember(Name = "now", EmitDefaultValue = false)] public DateTime? Now { get; set; } /// /// Returns the string presentation of the object /// /// String presentation of the object public override string ToString() { var sb = new StringBuilder(); sb.Append("class Query {\n"); sb.Append(" Extern: ").Append(Extern).Append("\n"); sb.Append(" _Query: ").Append(_Query).Append("\n"); sb.Append(" Type: ").Append(Type).Append("\n"); sb.Append(" Params: ").Append(Params).Append("\n"); sb.Append(" Dialect: ").Append(Dialect).Append("\n"); sb.Append(" Now: ").Append(Now).Append("\n"); sb.Append("}\n"); return sb.ToString(); } /// /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object public virtual string ToJson() { return JsonConvert.SerializeObject(this, Formatting.Indented); } /// /// Returns true if objects are equal /// /// Object to be compared /// Boolean public override bool Equals(object input) { return Equals(input as Query); } /// /// Returns true if Query instances are equal /// /// Instance of Query to be compared /// Boolean public bool Equals(Query input) { if (input == null) { return false; } return Extern != null && Extern.Equals(input.Extern) && ( _Query == input._Query || _Query != null && _Query.Equals(input._Query) ) && ( Type == input.Type || Type.Equals(input.Type) ) && ( Params == input.Params || Params != null && Params.SequenceEqual(input.Params) ) && Dialect != null && Dialect.Equals(input.Dialect) && ( Now == input.Now || Now != null && Now.Equals(input.Now) ); } /// /// Gets the hash code /// /// Hash code public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; if (Extern != null) { hashCode = hashCode * 59 + Extern.GetHashCode(); } if (_Query != null) { hashCode = hashCode * 59 + _Query.GetHashCode(); } hashCode = hashCode * 59 + Type.GetHashCode(); if (Params != null) { hashCode = hashCode * 59 + Params.GetHashCode(); } if (Dialect != null) { hashCode = hashCode * 59 + Dialect.GetHashCode(); } if (Now != null) { hashCode = hashCode * 59 + Now.GetHashCode(); } return hashCode; } } } }