From 129b8c8d49e88215facb0655e3ca2a5c046c2b22 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Tue, 11 Jun 2024 09:41:45 +0200 Subject: [PATCH] Include getlatest endpoint in yaml and call before shipcall sync in reg update --- misc/BreCalApi.cs | 1713 ++++++++++++++++++++++++++- misc/BreCalApi.yaml | 35 + src/BreCalClient/MainWindow.xaml.cs | 71 +- 3 files changed, 1791 insertions(+), 28 deletions(-) diff --git a/misc/BreCalApi.cs b/misc/BreCalApi.cs index 539d113..0cfd7fb 100644 --- a/misc/BreCalApi.cs +++ b/misc/BreCalApi.cs @@ -1,7 +1,7 @@ //---------------------- // -// Generated REST API Client Code Generator v1.9.8.0 on 06.05.2024 13:42:21 +// Generated REST API Client Code Generator v1.9.8.0 on 11.06.2024 08:29:39 // Using the tool OpenAPI Generator v7.4.0 // //---------------------- @@ -863,6 +863,26 @@ namespace BreCalClient.misc.Api { #region Synchronous Operations /// + /// Get latest timestamps of changes + /// + /// + /// Returns timestamps for latest data changes + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Latest + Latest GetLatest(int operationIndex = 0); + /// + /// Get latest timestamps of changes + /// + /// + /// Returns timestamps for latest data changes + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of Latest + ApiResponse GetLatestWithHttpInfo(int operationIndex = 0); + /// /// Create a new ship call /// /// @@ -937,6 +957,28 @@ namespace BreCalClient.misc.Api { #region Asynchronous Operations /// + /// Get latest timestamps of changes + /// + /// + /// Returns timestamps for latest data changes + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Latest + System.Threading.Tasks.Task GetLatestAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get latest timestamps of changes + /// + /// + /// Returns timestamps for latest data changes + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Latest) + System.Threading.Tasks.Task> GetLatestWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Create a new ship call /// /// @@ -1114,6 +1156,118 @@ namespace BreCalClient.misc.Api set { _exceptionFactory = value; } } /// + /// Get latest timestamps of changes Returns timestamps for latest data changes + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Latest + public Latest GetLatest(int operationIndex = 0) + { + BreCalClient.misc.Client.ApiResponse localVarResponse = GetLatestWithHttpInfo(); + return localVarResponse.Data; + } + /// + /// Get latest timestamps of changes Returns timestamps for latest data changes + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of Latest + public BreCalClient.misc.Client.ApiResponse GetLatestWithHttpInfo(int operationIndex = 0) + { + BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.Operation = "ShipcallApi.GetLatest"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); + } + // make the HTTP request + var localVarResponse = this.Client.Get("/getlatest", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetLatest", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Get latest timestamps of changes Returns timestamps for latest data changes + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Latest + public async System.Threading.Tasks.Task GetLatestAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + BreCalClient.misc.Client.ApiResponse localVarResponse = await GetLatestWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + /// + /// Get latest timestamps of changes Returns timestamps for latest data changes + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Latest) + public async System.Threading.Tasks.Task> GetLatestWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.Operation = "ShipcallApi.GetLatest"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); + } + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/getlatest", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetLatest", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// /// Create a new ship call A new shipcall is created without times at this point. This is ususally done by the BSMD or a participant with that particular role. /// /// Thrown when fails to make API call @@ -4889,7 +5043,7 @@ namespace BreCalClient.misc.Client /// /// Gets or sets the base path for API access. /// - public virtual string BasePath + public virtual string BasePath { get { return _basePath; } set { _basePath = value; } @@ -6172,7 +6326,7 @@ namespace BreCalClient.misc.Model /// Ship berth used for a ship call /// [DataContract(Name = "berth")] - public partial class Berth : IValidatableObject + public partial class Berth : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -6267,6 +6421,104 @@ namespace BreCalClient.misc.Model return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Berth); + } + /// + /// Returns true if Berth instances are equal + /// + /// Instance of Berth to be compared + /// Boolean + public bool Equals(Berth input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + this.Id.Equals(input.Id) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.OwnerId == input.OwnerId || + (this.OwnerId != null && + this.OwnerId.Equals(input.OwnerId)) + ) && + ( + this.AuthorityId == input.AuthorityId || + (this.AuthorityId != null && + this.AuthorityId.Equals(input.AuthorityId)) + ) && + ( + this.VarLock == input.VarLock || + (this.VarLock != null && + this.VarLock.Equals(input.VarLock)) + ) && + ( + this.Created == input.Created || + (this.Created != null && + this.Created.Equals(input.Created)) + ) && + ( + this.Modified == input.Modified || + (this.Modified != null && + this.Modified.Equals(input.Modified)) + ) && + ( + this.Deleted == input.Deleted || + this.Deleted.Equals(input.Deleted) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.OwnerId != null) + { + hashCode = (hashCode * 59) + this.OwnerId.GetHashCode(); + } + if (this.AuthorityId != null) + { + hashCode = (hashCode * 59) + this.AuthorityId.GetHashCode(); + } + if (this.VarLock != null) + { + hashCode = (hashCode * 59) + this.VarLock.GetHashCode(); + } + if (this.Created != null) + { + hashCode = (hashCode * 59) + this.Created.GetHashCode(); + } + if (this.Modified != null) + { + hashCode = (hashCode * 59) + this.Modified.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Deleted.GetHashCode(); + return hashCode; + } + } + /// /// To validate all properties of the instance /// /// Validation context @@ -6298,7 +6550,7 @@ namespace BreCalClient.misc.Model /// Credentials /// [DataContract(Name = "credentials")] - public partial class Credentials : IValidatableObject + public partial class Credentials : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -6357,6 +6609,58 @@ namespace BreCalClient.misc.Model return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Credentials); + } + /// + /// Returns true if Credentials instances are equal + /// + /// Instance of Credentials to be compared + /// Boolean + public bool Equals(Credentials input) + { + if (input == null) + { + return false; + } + return + ( + this.Username == input.Username || + (this.Username != null && + this.Username.Equals(input.Username)) + ) && + ( + this.Password == input.Password || + (this.Password != null && + this.Password.Equals(input.Password)) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Username != null) + { + hashCode = (hashCode * 59) + this.Username.GetHashCode(); + } + if (this.Password != null) + { + hashCode = (hashCode * 59) + this.Password.GetHashCode(); + } + return hashCode; + } + } + /// /// To validate all properties of the instance /// /// Validation context @@ -6383,7 +6687,7 @@ namespace BreCalClient.misc.Model /// Error /// [DataContract(Name = "Error")] - public partial class Error : IValidatableObject + public partial class Error : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -6430,6 +6734,49 @@ namespace BreCalClient.misc.Model return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Error); + } + /// + /// Returns true if Error instances are equal + /// + /// Instance of Error to be compared + /// Boolean + public bool Equals(Error input) + { + if (input == null) + { + return false; + } + return + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + return hashCode; + } + } + /// /// To validate all properties of the instance /// /// Validation context @@ -6496,7 +6843,7 @@ namespace BreCalClient.misc.Model /// Single history entry with references /// [DataContract(Name = "history")] - public partial class History : IValidatableObject + public partial class History : IEquatable, IValidatableObject { /// /// Gets or Sets Operation @@ -6580,6 +6927,83 @@ namespace BreCalClient.misc.Model return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as History); + } + /// + /// Returns true if History instances are equal + /// + /// Instance of History to be compared + /// Boolean + public bool Equals(History input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + this.Id.Equals(input.Id) + ) && + ( + this.ParticipantId == input.ParticipantId || + this.ParticipantId.Equals(input.ParticipantId) + ) && + ( + this.ShipcallId == input.ShipcallId || + this.ShipcallId.Equals(input.ShipcallId) + ) && + ( + this.Timestamp == input.Timestamp || + (this.Timestamp != null && + this.Timestamp.Equals(input.Timestamp)) + ) && + ( + this.Eta == input.Eta || + (this.Eta != null && + this.Eta.Equals(input.Eta)) + ) && + ( + this.Operation == input.Operation || + this.Operation.Equals(input.Operation) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + hashCode = (hashCode * 59) + this.ParticipantId.GetHashCode(); + hashCode = (hashCode * 59) + this.ShipcallId.GetHashCode(); + if (this.Timestamp != null) + { + hashCode = (hashCode * 59) + this.Timestamp.GetHashCode(); + } + if (this.Eta != null) + { + hashCode = (hashCode * 59) + this.Eta.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Operation.GetHashCode(); + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + /// /// To validate all properties of the instance /// /// Validation context @@ -6606,7 +7030,7 @@ namespace BreCalClient.misc.Model /// A unique identifier for an entity /// [DataContract(Name = "Id")] - public partial class Id : IValidatableObject + public partial class Id : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -6642,6 +7066,184 @@ namespace BreCalClient.misc.Model return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Id); + } + /// + /// Returns true if Id instances are equal + /// + /// Instance of Id to be compared + /// Boolean + public bool Equals(Id input) + { + if (input == null) + { + return false; + } + return + ( + this.VarId == input.VarId || + this.VarId.Equals(input.VarId) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.VarId.GetHashCode(); + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.3.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.misc.Model +{ + /// + /// Latest + /// + [DataContract(Name = "latest")] + public partial class Latest : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// shipcalls. + /// times. + /// ship. + public Latest(DateTime? shipcalls = default(DateTime?), DateTime? times = default(DateTime?), DateTime? ship = default(DateTime?)) + { + this.Shipcalls = shipcalls; + this.Times = times; + this.Ship = ship; + } + /// + /// Gets or Sets Shipcalls + /// + [DataMember(Name = "shipcalls", EmitDefaultValue = true)] + public DateTime? Shipcalls { get; set; } + /// + /// Gets or Sets Times + /// + [DataMember(Name = "times", EmitDefaultValue = true)] + public DateTime? Times { get; set; } + /// + /// Gets or Sets Ship + /// + [DataMember(Name = "ship", EmitDefaultValue = true)] + public DateTime? Ship { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Latest {\n"); + sb.Append(" Shipcalls: ").Append(Shipcalls).Append("\n"); + sb.Append(" Times: ").Append(Times).Append("\n"); + sb.Append(" Ship: ").Append(Ship).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 Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Latest); + } + /// + /// Returns true if Latest instances are equal + /// + /// Instance of Latest to be compared + /// Boolean + public bool Equals(Latest input) + { + if (input == null) + { + return false; + } + return + ( + this.Shipcalls == input.Shipcalls || + (this.Shipcalls != null && + this.Shipcalls.Equals(input.Shipcalls)) + ) && + ( + this.Times == input.Times || + (this.Times != null && + this.Times.Equals(input.Times)) + ) && + ( + this.Ship == input.Ship || + (this.Ship != null && + this.Ship.Equals(input.Ship)) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Shipcalls != null) + { + hashCode = (hashCode * 59) + this.Shipcalls.GetHashCode(); + } + if (this.Times != null) + { + hashCode = (hashCode * 59) + this.Times.GetHashCode(); + } + if (this.Ship != null) + { + hashCode = (hashCode * 59) + this.Ship.GetHashCode(); + } + return hashCode; + } + } + /// /// To validate all properties of the instance /// /// Validation context @@ -6668,7 +7270,7 @@ namespace BreCalClient.misc.Model /// result structure of a successful login attempt /// [DataContract(Name = "login_result")] - public partial class LoginResult : IValidatableObject + public partial class LoginResult : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -6768,6 +7370,109 @@ namespace BreCalClient.misc.Model return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as LoginResult); + } + /// + /// Returns true if LoginResult instances are equal + /// + /// Instance of LoginResult to be compared + /// Boolean + public bool Equals(LoginResult input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + this.Id.Equals(input.Id) + ) && + ( + this.ParticipantId == input.ParticipantId || + this.ParticipantId.Equals(input.ParticipantId) + ) && + ( + this.FirstName == input.FirstName || + (this.FirstName != null && + this.FirstName.Equals(input.FirstName)) + ) && + ( + this.LastName == input.LastName || + (this.LastName != null && + this.LastName.Equals(input.LastName)) + ) && + ( + this.UserName == input.UserName || + (this.UserName != null && + this.UserName.Equals(input.UserName)) + ) && + ( + this.UserPhone == input.UserPhone || + (this.UserPhone != null && + this.UserPhone.Equals(input.UserPhone)) + ) && + ( + this.UserEmail == input.UserEmail || + (this.UserEmail != null && + this.UserEmail.Equals(input.UserEmail)) + ) && + ( + this.Exp == input.Exp || + this.Exp.Equals(input.Exp) + ) && + ( + this.Token == input.Token || + (this.Token != null && + this.Token.Equals(input.Token)) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + hashCode = (hashCode * 59) + this.ParticipantId.GetHashCode(); + if (this.FirstName != null) + { + hashCode = (hashCode * 59) + this.FirstName.GetHashCode(); + } + if (this.LastName != null) + { + hashCode = (hashCode * 59) + this.LastName.GetHashCode(); + } + if (this.UserName != null) + { + hashCode = (hashCode * 59) + this.UserName.GetHashCode(); + } + if (this.UserPhone != null) + { + hashCode = (hashCode * 59) + this.UserPhone.GetHashCode(); + } + if (this.UserEmail != null) + { + hashCode = (hashCode * 59) + this.UserEmail.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Exp.GetHashCode(); + if (this.Token != null) + { + hashCode = (hashCode * 59) + this.Token.GetHashCode(); + } + return hashCode; + } + } + /// /// To validate all properties of the instance /// /// Validation context @@ -6794,7 +7499,7 @@ namespace BreCalClient.misc.Model /// a notification created by the engine if a times entry violates a rule /// [DataContract(Name = "notification")] - public partial class Notification : IValidatableObject + public partial class Notification : IEquatable, IValidatableObject { /// /// Gets or Sets NotificationType @@ -6872,6 +7577,82 @@ namespace BreCalClient.misc.Model return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Notification); + } + /// + /// Returns true if Notification instances are equal + /// + /// Instance of Notification to be compared + /// Boolean + public bool Equals(Notification input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + this.Id.Equals(input.Id) + ) && + ( + this.ShipcallId == input.ShipcallId || + this.ShipcallId.Equals(input.ShipcallId) + ) && + ( + this.NotificationType == input.NotificationType || + this.NotificationType.Equals(input.NotificationType) + ) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ) && + ( + this.Created == input.Created || + (this.Created != null && + this.Created.Equals(input.Created)) + ) && + ( + this.Modified == input.Modified || + (this.Modified != null && + this.Modified.Equals(input.Modified)) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + hashCode = (hashCode * 59) + this.ShipcallId.GetHashCode(); + hashCode = (hashCode * 59) + this.NotificationType.GetHashCode(); + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + if (this.Created != null) + { + hashCode = (hashCode * 59) + this.Created.GetHashCode(); + } + if (this.Modified != null) + { + hashCode = (hashCode * 59) + this.Modified.GetHashCode(); + } + return hashCode; + } + } + /// /// To validate all properties of the instance /// /// Validation context @@ -7003,7 +7784,7 @@ namespace BreCalClient.misc.Model /// A organisational entity that participates in Bremen Calling /// [DataContract(Name = "participant")] - public partial class Participant : IValidatableObject + public partial class Participant : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -7114,6 +7895,118 @@ namespace BreCalClient.misc.Model return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Participant); + } + /// + /// Returns true if Participant instances are equal + /// + /// Instance of Participant to be compared + /// Boolean + public bool Equals(Participant input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + this.Id.Equals(input.Id) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Street == input.Street || + (this.Street != null && + this.Street.Equals(input.Street)) + ) && + ( + this.PostalCode == input.PostalCode || + (this.PostalCode != null && + this.PostalCode.Equals(input.PostalCode)) + ) && + ( + this.City == input.City || + (this.City != null && + this.City.Equals(input.City)) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.Flags == input.Flags || + (this.Flags != null && + this.Flags.Equals(input.Flags)) + ) && + ( + this.Created == input.Created || + (this.Created != null && + this.Created.Equals(input.Created)) + ) && + ( + this.Modified == input.Modified || + (this.Modified != null && + this.Modified.Equals(input.Modified)) + ) && + ( + this.Deleted == input.Deleted || + this.Deleted.Equals(input.Deleted) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.Street != null) + { + hashCode = (hashCode * 59) + this.Street.GetHashCode(); + } + if (this.PostalCode != null) + { + hashCode = (hashCode * 59) + this.PostalCode.GetHashCode(); + } + if (this.City != null) + { + hashCode = (hashCode * 59) + this.City.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + if (this.Flags != null) + { + hashCode = (hashCode * 59) + this.Flags.GetHashCode(); + } + if (this.Created != null) + { + hashCode = (hashCode * 59) + this.Created.GetHashCode(); + } + if (this.Modified != null) + { + hashCode = (hashCode * 59) + this.Modified.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Deleted.GetHashCode(); + return hashCode; + } + } + /// /// To validate all properties of the instance /// /// Validation context @@ -7160,7 +8053,7 @@ namespace BreCalClient.misc.Model /// Participant assigned to a shipcall with a given role (type) /// [DataContract(Name = "participant_assignment")] - public partial class ParticipantAssignment : IValidatableObject + public partial class ParticipantAssignment : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -7210,6 +8103,50 @@ namespace BreCalClient.misc.Model return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ParticipantAssignment); + } + /// + /// Returns true if ParticipantAssignment instances are equal + /// + /// Instance of ParticipantAssignment to be compared + /// Boolean + public bool Equals(ParticipantAssignment input) + { + if (input == null) + { + return false; + } + return + ( + this.ParticipantId == input.ParticipantId || + this.ParticipantId.Equals(input.ParticipantId) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.ParticipantId.GetHashCode(); + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + /// /// To validate all properties of the instance /// /// Validation context @@ -7236,7 +8173,7 @@ namespace BreCalClient.misc.Model /// a ship /// [DataContract(Name = "ship")] - public partial class Ship : IValidatableObject + public partial class Ship : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -7370,6 +8307,145 @@ namespace BreCalClient.misc.Model return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Ship); + } + /// + /// Returns true if Ship instances are equal + /// + /// Instance of Ship to be compared + /// Boolean + public bool Equals(Ship input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + this.Id.Equals(input.Id) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Imo == input.Imo || + (this.Imo != null && + this.Imo.Equals(input.Imo)) + ) && + ( + this.Callsign == input.Callsign || + (this.Callsign != null && + this.Callsign.Equals(input.Callsign)) + ) && + ( + this.ParticipantId == input.ParticipantId || + (this.ParticipantId != null && + this.ParticipantId.Equals(input.ParticipantId)) + ) && + ( + this.Length == input.Length || + (this.Length != null && + this.Length.Equals(input.Length)) + ) && + ( + this.Width == input.Width || + (this.Width != null && + this.Width.Equals(input.Width)) + ) && + ( + this.IsTug == input.IsTug || + this.IsTug.Equals(input.IsTug) + ) && + ( + this.BollardPull == input.BollardPull || + (this.BollardPull != null && + this.BollardPull.Equals(input.BollardPull)) + ) && + ( + this.Eni == input.Eni || + (this.Eni != null && + this.Eni.Equals(input.Eni)) + ) && + ( + this.Created == input.Created || + (this.Created != null && + this.Created.Equals(input.Created)) + ) && + ( + this.Modified == input.Modified || + (this.Modified != null && + this.Modified.Equals(input.Modified)) + ) && + ( + this.Deleted == input.Deleted || + this.Deleted.Equals(input.Deleted) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.Imo != null) + { + hashCode = (hashCode * 59) + this.Imo.GetHashCode(); + } + if (this.Callsign != null) + { + hashCode = (hashCode * 59) + this.Callsign.GetHashCode(); + } + if (this.ParticipantId != null) + { + hashCode = (hashCode * 59) + this.ParticipantId.GetHashCode(); + } + if (this.Length != null) + { + hashCode = (hashCode * 59) + this.Length.GetHashCode(); + } + if (this.Width != null) + { + hashCode = (hashCode * 59) + this.Width.GetHashCode(); + } + hashCode = (hashCode * 59) + this.IsTug.GetHashCode(); + if (this.BollardPull != null) + { + hashCode = (hashCode * 59) + this.BollardPull.GetHashCode(); + } + if (this.Eni != null) + { + hashCode = (hashCode * 59) + this.Eni.GetHashCode(); + } + if (this.Created != null) + { + hashCode = (hashCode * 59) + this.Created.GetHashCode(); + } + if (this.Modified != null) + { + hashCode = (hashCode * 59) + this.Modified.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Deleted.GetHashCode(); + return hashCode; + } + } + /// /// To validate all properties of the instance /// /// Validation context @@ -7406,7 +8482,7 @@ namespace BreCalClient.misc.Model /// Shipcall /// [DataContract(Name = "shipcall")] - public partial class Shipcall : IValidatableObject + public partial class Shipcall : IEquatable, IValidatableObject { /// /// Gets or Sets Type @@ -7675,6 +8751,286 @@ namespace BreCalClient.misc.Model return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Shipcall); + } + /// + /// Returns true if Shipcall instances are equal + /// + /// Instance of Shipcall to be compared + /// Boolean + public bool Equals(Shipcall input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + this.Id.Equals(input.Id) + ) && + ( + this.ShipId == input.ShipId || + this.ShipId.Equals(input.ShipId) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.Eta == input.Eta || + (this.Eta != null && + this.Eta.Equals(input.Eta)) + ) && + ( + this.Voyage == input.Voyage || + (this.Voyage != null && + this.Voyage.Equals(input.Voyage)) + ) && + ( + this.Etd == input.Etd || + (this.Etd != null && + this.Etd.Equals(input.Etd)) + ) && + ( + this.ArrivalBerthId == input.ArrivalBerthId || + (this.ArrivalBerthId != null && + this.ArrivalBerthId.Equals(input.ArrivalBerthId)) + ) && + ( + this.DepartureBerthId == input.DepartureBerthId || + (this.DepartureBerthId != null && + this.DepartureBerthId.Equals(input.DepartureBerthId)) + ) && + ( + this.TugRequired == input.TugRequired || + (this.TugRequired != null && + this.TugRequired.Equals(input.TugRequired)) + ) && + ( + this.PilotRequired == input.PilotRequired || + (this.PilotRequired != null && + this.PilotRequired.Equals(input.PilotRequired)) + ) && + ( + this.Flags == input.Flags || + (this.Flags != null && + this.Flags.Equals(input.Flags)) + ) && + ( + this.PierSide == input.PierSide || + (this.PierSide != null && + this.PierSide.Equals(input.PierSide)) + ) && + ( + this.Bunkering == input.Bunkering || + (this.Bunkering != null && + this.Bunkering.Equals(input.Bunkering)) + ) && + ( + this.ReplenishingTerminal == input.ReplenishingTerminal || + (this.ReplenishingTerminal != null && + this.ReplenishingTerminal.Equals(input.ReplenishingTerminal)) + ) && + ( + this.ReplenishingLock == input.ReplenishingLock || + (this.ReplenishingLock != null && + this.ReplenishingLock.Equals(input.ReplenishingLock)) + ) && + ( + this.Draft == input.Draft || + (this.Draft != null && + this.Draft.Equals(input.Draft)) + ) && + ( + this.TidalWindowFrom == input.TidalWindowFrom || + (this.TidalWindowFrom != null && + this.TidalWindowFrom.Equals(input.TidalWindowFrom)) + ) && + ( + this.TidalWindowTo == input.TidalWindowTo || + (this.TidalWindowTo != null && + this.TidalWindowTo.Equals(input.TidalWindowTo)) + ) && + ( + this.RainSensitiveCargo == input.RainSensitiveCargo || + (this.RainSensitiveCargo != null && + this.RainSensitiveCargo.Equals(input.RainSensitiveCargo)) + ) && + ( + this.RecommendedTugs == input.RecommendedTugs || + (this.RecommendedTugs != null && + this.RecommendedTugs.Equals(input.RecommendedTugs)) + ) && + ( + this.Anchored == input.Anchored || + (this.Anchored != null && + this.Anchored.Equals(input.Anchored)) + ) && + ( + this.MooredLock == input.MooredLock || + (this.MooredLock != null && + this.MooredLock.Equals(input.MooredLock)) + ) && + ( + this.Canceled == input.Canceled || + (this.Canceled != null && + this.Canceled.Equals(input.Canceled)) + ) && + ( + this.Evaluation == input.Evaluation || + this.Evaluation.Equals(input.Evaluation) + ) && + ( + this.EvaluationMessage == input.EvaluationMessage || + (this.EvaluationMessage != null && + this.EvaluationMessage.Equals(input.EvaluationMessage)) + ) && + ( + this.TimeRefPoint == input.TimeRefPoint || + (this.TimeRefPoint != null && + this.TimeRefPoint.Equals(input.TimeRefPoint)) + ) && + ( + this.Participants == input.Participants || + this.Participants != null && + input.Participants != null && + this.Participants.SequenceEqual(input.Participants) + ) && + ( + this.Created == input.Created || + (this.Created != null && + this.Created.Equals(input.Created)) + ) && + ( + this.Modified == input.Modified || + (this.Modified != null && + this.Modified.Equals(input.Modified)) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + hashCode = (hashCode * 59) + this.ShipId.GetHashCode(); + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + if (this.Eta != null) + { + hashCode = (hashCode * 59) + this.Eta.GetHashCode(); + } + if (this.Voyage != null) + { + hashCode = (hashCode * 59) + this.Voyage.GetHashCode(); + } + if (this.Etd != null) + { + hashCode = (hashCode * 59) + this.Etd.GetHashCode(); + } + if (this.ArrivalBerthId != null) + { + hashCode = (hashCode * 59) + this.ArrivalBerthId.GetHashCode(); + } + if (this.DepartureBerthId != null) + { + hashCode = (hashCode * 59) + this.DepartureBerthId.GetHashCode(); + } + if (this.TugRequired != null) + { + hashCode = (hashCode * 59) + this.TugRequired.GetHashCode(); + } + if (this.PilotRequired != null) + { + hashCode = (hashCode * 59) + this.PilotRequired.GetHashCode(); + } + if (this.Flags != null) + { + hashCode = (hashCode * 59) + this.Flags.GetHashCode(); + } + if (this.PierSide != null) + { + hashCode = (hashCode * 59) + this.PierSide.GetHashCode(); + } + if (this.Bunkering != null) + { + hashCode = (hashCode * 59) + this.Bunkering.GetHashCode(); + } + if (this.ReplenishingTerminal != null) + { + hashCode = (hashCode * 59) + this.ReplenishingTerminal.GetHashCode(); + } + if (this.ReplenishingLock != null) + { + hashCode = (hashCode * 59) + this.ReplenishingLock.GetHashCode(); + } + if (this.Draft != null) + { + hashCode = (hashCode * 59) + this.Draft.GetHashCode(); + } + if (this.TidalWindowFrom != null) + { + hashCode = (hashCode * 59) + this.TidalWindowFrom.GetHashCode(); + } + if (this.TidalWindowTo != null) + { + hashCode = (hashCode * 59) + this.TidalWindowTo.GetHashCode(); + } + if (this.RainSensitiveCargo != null) + { + hashCode = (hashCode * 59) + this.RainSensitiveCargo.GetHashCode(); + } + if (this.RecommendedTugs != null) + { + hashCode = (hashCode * 59) + this.RecommendedTugs.GetHashCode(); + } + if (this.Anchored != null) + { + hashCode = (hashCode * 59) + this.Anchored.GetHashCode(); + } + if (this.MooredLock != null) + { + hashCode = (hashCode * 59) + this.MooredLock.GetHashCode(); + } + if (this.Canceled != null) + { + hashCode = (hashCode * 59) + this.Canceled.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Evaluation.GetHashCode(); + if (this.EvaluationMessage != null) + { + hashCode = (hashCode * 59) + this.EvaluationMessage.GetHashCode(); + } + if (this.TimeRefPoint != null) + { + hashCode = (hashCode * 59) + this.TimeRefPoint.GetHashCode(); + } + if (this.Participants != null) + { + hashCode = (hashCode * 59) + this.Participants.GetHashCode(); + } + if (this.Created != null) + { + hashCode = (hashCode * 59) + this.Created.GetHashCode(); + } + if (this.Modified != null) + { + hashCode = (hashCode * 59) + this.Modified.GetHashCode(); + } + return hashCode; + } + } + /// /// To validate all properties of the instance /// /// Validation context @@ -7751,7 +9107,7 @@ namespace BreCalClient.misc.Model /// the id parameter needs to be missing on POST and to be present on PUT (Update) calls, otherwise a 400 response will be generated /// [DataContract(Name = "times")] - public partial class Times : IValidatableObject + public partial class Times : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -7997,6 +9353,240 @@ namespace BreCalClient.misc.Model return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Times); + } + /// + /// Returns true if Times instances are equal + /// + /// Instance of Times to be compared + /// Boolean + public bool Equals(Times input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + this.Id.Equals(input.Id) + ) && + ( + this.EtaBerth == input.EtaBerth || + (this.EtaBerth != null && + this.EtaBerth.Equals(input.EtaBerth)) + ) && + ( + this.EtaBerthFixed == input.EtaBerthFixed || + (this.EtaBerthFixed != null && + this.EtaBerthFixed.Equals(input.EtaBerthFixed)) + ) && + ( + this.EtdBerth == input.EtdBerth || + (this.EtdBerth != null && + this.EtdBerth.Equals(input.EtdBerth)) + ) && + ( + this.EtdBerthFixed == input.EtdBerthFixed || + (this.EtdBerthFixed != null && + this.EtdBerthFixed.Equals(input.EtdBerthFixed)) + ) && + ( + this.LockTime == input.LockTime || + (this.LockTime != null && + this.LockTime.Equals(input.LockTime)) + ) && + ( + this.LockTimeFixed == input.LockTimeFixed || + (this.LockTimeFixed != null && + this.LockTimeFixed.Equals(input.LockTimeFixed)) + ) && + ( + this.ZoneEntry == input.ZoneEntry || + (this.ZoneEntry != null && + this.ZoneEntry.Equals(input.ZoneEntry)) + ) && + ( + this.ZoneEntryFixed == input.ZoneEntryFixed || + (this.ZoneEntryFixed != null && + this.ZoneEntryFixed.Equals(input.ZoneEntryFixed)) + ) && + ( + this.OperationsStart == input.OperationsStart || + (this.OperationsStart != null && + this.OperationsStart.Equals(input.OperationsStart)) + ) && + ( + this.OperationsEnd == input.OperationsEnd || + (this.OperationsEnd != null && + this.OperationsEnd.Equals(input.OperationsEnd)) + ) && + ( + this.Remarks == input.Remarks || + (this.Remarks != null && + this.Remarks.Equals(input.Remarks)) + ) && + ( + this.ShipcallId == input.ShipcallId || + this.ShipcallId.Equals(input.ShipcallId) + ) && + ( + this.ParticipantId == input.ParticipantId || + this.ParticipantId.Equals(input.ParticipantId) + ) && + ( + this.BerthId == input.BerthId || + (this.BerthId != null && + this.BerthId.Equals(input.BerthId)) + ) && + ( + this.BerthInfo == input.BerthInfo || + (this.BerthInfo != null && + this.BerthInfo.Equals(input.BerthInfo)) + ) && + ( + this.PierSide == input.PierSide || + (this.PierSide != null && + this.PierSide.Equals(input.PierSide)) + ) && + ( + this.ParticipantType == input.ParticipantType || + this.ParticipantType.Equals(input.ParticipantType) + ) && + ( + this.Ata == input.Ata || + (this.Ata != null && + this.Ata.Equals(input.Ata)) + ) && + ( + this.Atd == input.Atd || + (this.Atd != null && + this.Atd.Equals(input.Atd)) + ) && + ( + this.EtaIntervalEnd == input.EtaIntervalEnd || + (this.EtaIntervalEnd != null && + this.EtaIntervalEnd.Equals(input.EtaIntervalEnd)) + ) && + ( + this.EtdIntervalEnd == input.EtdIntervalEnd || + (this.EtdIntervalEnd != null && + this.EtdIntervalEnd.Equals(input.EtdIntervalEnd)) + ) && + ( + this.Created == input.Created || + (this.Created != null && + this.Created.Equals(input.Created)) + ) && + ( + this.Modified == input.Modified || + (this.Modified != null && + this.Modified.Equals(input.Modified)) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + if (this.EtaBerth != null) + { + hashCode = (hashCode * 59) + this.EtaBerth.GetHashCode(); + } + if (this.EtaBerthFixed != null) + { + hashCode = (hashCode * 59) + this.EtaBerthFixed.GetHashCode(); + } + if (this.EtdBerth != null) + { + hashCode = (hashCode * 59) + this.EtdBerth.GetHashCode(); + } + if (this.EtdBerthFixed != null) + { + hashCode = (hashCode * 59) + this.EtdBerthFixed.GetHashCode(); + } + if (this.LockTime != null) + { + hashCode = (hashCode * 59) + this.LockTime.GetHashCode(); + } + if (this.LockTimeFixed != null) + { + hashCode = (hashCode * 59) + this.LockTimeFixed.GetHashCode(); + } + if (this.ZoneEntry != null) + { + hashCode = (hashCode * 59) + this.ZoneEntry.GetHashCode(); + } + if (this.ZoneEntryFixed != null) + { + hashCode = (hashCode * 59) + this.ZoneEntryFixed.GetHashCode(); + } + if (this.OperationsStart != null) + { + hashCode = (hashCode * 59) + this.OperationsStart.GetHashCode(); + } + if (this.OperationsEnd != null) + { + hashCode = (hashCode * 59) + this.OperationsEnd.GetHashCode(); + } + if (this.Remarks != null) + { + hashCode = (hashCode * 59) + this.Remarks.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ShipcallId.GetHashCode(); + hashCode = (hashCode * 59) + this.ParticipantId.GetHashCode(); + if (this.BerthId != null) + { + hashCode = (hashCode * 59) + this.BerthId.GetHashCode(); + } + if (this.BerthInfo != null) + { + hashCode = (hashCode * 59) + this.BerthInfo.GetHashCode(); + } + if (this.PierSide != null) + { + hashCode = (hashCode * 59) + this.PierSide.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ParticipantType.GetHashCode(); + if (this.Ata != null) + { + hashCode = (hashCode * 59) + this.Ata.GetHashCode(); + } + if (this.Atd != null) + { + hashCode = (hashCode * 59) + this.Atd.GetHashCode(); + } + if (this.EtaIntervalEnd != null) + { + hashCode = (hashCode * 59) + this.EtaIntervalEnd.GetHashCode(); + } + if (this.EtdIntervalEnd != null) + { + hashCode = (hashCode * 59) + this.EtdIntervalEnd.GetHashCode(); + } + if (this.Created != null) + { + hashCode = (hashCode * 59) + this.Created.GetHashCode(); + } + if (this.Modified != null) + { + hashCode = (hashCode * 59) + this.Modified.GetHashCode(); + } + return hashCode; + } + } + /// /// To validate all properties of the instance /// /// Validation context @@ -8033,7 +9623,7 @@ namespace BreCalClient.misc.Model /// fields that a user may change /// [DataContract(Name = "user_details")] - public partial class UserDetails : IValidatableObject + public partial class UserDetails : IEquatable, IValidatableObject { /// /// Initializes a new instance of the class. @@ -8117,6 +9707,99 @@ namespace BreCalClient.misc.Model return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as UserDetails); + } + /// + /// Returns true if UserDetails instances are equal + /// + /// Instance of UserDetails to be compared + /// Boolean + public bool Equals(UserDetails input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + this.Id.Equals(input.Id) + ) && + ( + this.OldPassword == input.OldPassword || + (this.OldPassword != null && + this.OldPassword.Equals(input.OldPassword)) + ) && + ( + this.NewPassword == input.NewPassword || + (this.NewPassword != null && + this.NewPassword.Equals(input.NewPassword)) + ) && + ( + this.FirstName == input.FirstName || + (this.FirstName != null && + this.FirstName.Equals(input.FirstName)) + ) && + ( + this.LastName == input.LastName || + (this.LastName != null && + this.LastName.Equals(input.LastName)) + ) && + ( + this.UserPhone == input.UserPhone || + (this.UserPhone != null && + this.UserPhone.Equals(input.UserPhone)) + ) && + ( + this.UserEmail == input.UserEmail || + (this.UserEmail != null && + this.UserEmail.Equals(input.UserEmail)) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + if (this.OldPassword != null) + { + hashCode = (hashCode * 59) + this.OldPassword.GetHashCode(); + } + if (this.NewPassword != null) + { + hashCode = (hashCode * 59) + this.NewPassword.GetHashCode(); + } + if (this.FirstName != null) + { + hashCode = (hashCode * 59) + this.FirstName.GetHashCode(); + } + if (this.LastName != null) + { + hashCode = (hashCode * 59) + this.LastName.GetHashCode(); + } + if (this.UserPhone != null) + { + hashCode = (hashCode * 59) + this.UserPhone.GetHashCode(); + } + if (this.UserEmail != null) + { + hashCode = (hashCode * 59) + this.UserEmail.GetHashCode(); + } + return hashCode; + } + } + /// /// To validate all properties of the instance /// /// Validation context diff --git a/misc/BreCalApi.yaml b/misc/BreCalApi.yaml index aa42b53..ee219f1 100644 --- a/misc/BreCalApi.yaml +++ b/misc/BreCalApi.yaml @@ -457,8 +457,43 @@ paths: $ref: '#/components/responses/500' '503': $ref: '#/components/responses/503' + /getlatest: + get: + description: 'Returns timestamps for latest data changes' + summary: Get latest timestamps of changes + tags: + - shipcall + operationId: getLatest + responses: + '200': + description: ship call list + content: + application/json: + schema: + $ref: '#/components/schemas/latest' + '401': + $ref: '#/components/responses/401' + '500': + $ref: '#/components/responses/500' + '503': + $ref: '#/components/responses/503' components: schemas: + latest: + type: object + properties: + shipcalls: + type: string + format: date-time + nullable: true + times: + type: string + format: date-time + nullable: true + ship: + type: string + format: date-time + nullable: true credentials: type: object properties: diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs index 19687bc..51bd237 100644 --- a/src/BreCalClient/MainWindow.xaml.cs +++ b/src/BreCalClient/MainWindow.xaml.cs @@ -39,7 +39,7 @@ namespace BreCalClient #region Fields //private static int _uiUpdateRunning = 0; - private static SemaphoreSlim uiLock = new SemaphoreSlim(1); + private static readonly SemaphoreSlim uiLock = new SemaphoreSlim(1); private Credentials? _credentials; @@ -65,6 +65,10 @@ namespace BreCalClient // private bool _sequenceChanged = false; private HistoryDialog? _historyDialog; + // Fields to store the latest check flags + private DateTime? _latestShipcall; + private DateTime? _latestShip; + #endregion #region Enums @@ -443,20 +447,61 @@ namespace BreCalClient } List? shipcalls = null; + bool skipShipLoad, skipShipcallLoad; + skipShipLoad = false; + skipShipcallLoad = false; + try { - if(this.searchPastDays != 0) - shipcalls = await _shipcallApi.ShipcallsGetAsync(this.searchPastDays); - else - shipcalls = await _shipcallApi.ShipcallsGetAsync(); - - this.Dispatcher.Invoke(new Action(() => + // this only works with API v1.3 onwards + Latest latest = await _shipcallApi.GetLatestAsync(); + + if (latest != null) { - labelGeneralStatus.Text = $"Connection {ConnectionStatus.SUCCESSFUL}"; - labelLatestUpdate.Text = $"Last update: {DateTime.Now.ToLongTimeString()}"; - labelStatusBar.Text = ""; - generalProgressStatus.Value = 0; - })); + // compare timestamps to decide whether an update is required + if ((_latestShip != null) && ((latest.Ship.HasValue && + (latest.Ship.Value <= _latestShip.Value)) || + !_latestShip.HasValue) + ) + { + skipShipLoad = true; + } + + if(!skipShipLoad) + { + _latestShip = latest.Ship ?? DateTime.Now; + } + + + if ((_latestShipcall != null) && ((latest.Shipcalls.HasValue && + (latest.Shipcalls.Value <= _latestShipcall.Value)) || + !_latestShipcall.HasValue) + ) + { + skipShipcallLoad = true; + } + + if(!skipShipcallLoad) + { + _latestShipcall = latest.Shipcalls ?? DateTime.Now; + } + } + + if (!skipShipcallLoad) + { + if (this.searchPastDays != 0) + shipcalls = await _shipcallApi.ShipcallsGetAsync(this.searchPastDays); + else + shipcalls = await _shipcallApi.ShipcallsGetAsync(); + + this.Dispatcher.Invoke(new Action(() => + { + labelGeneralStatus.Text = $"Connection {ConnectionStatus.SUCCESSFUL}"; + labelLatestUpdate.Text = $"Last update: {DateTime.Now.ToLongTimeString()}"; + labelStatusBar.Text = ""; + generalProgressStatus.Value = 0; + })); + } } catch (Exception ex) { @@ -474,7 +519,7 @@ namespace BreCalClient try { - + if (shipcalls != null) { foreach (Shipcall shipcall in shipcalls)