From 12f36c51139b9b4f289b5a1061d03dca441182ef Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Fri, 14 Jul 2023 16:03:45 +0200 Subject: [PATCH] Fixed Token transmission to server, loading of berth and ship lists ok! --- misc/BreCalApi.cs | 222 ++++++++++++++++++++-------- misc/BreCalApi.yaml | 68 ++++++--- src/BreCalClient/MainWindow.xaml.cs | 4 +- 3 files changed, 211 insertions(+), 83 deletions(-) diff --git a/misc/BreCalApi.cs b/misc/BreCalApi.cs index c8c7302..e6b56d9 100644 --- a/misc/BreCalApi.cs +++ b/misc/BreCalApi.cs @@ -1,7 +1,7 @@ //---------------------- // -// Generated REST API Client Code Generator v1.7.17.0 on 13.07.2023 19:39:52 +// Generated REST API Client Code Generator v1.7.17.0 on 14.07.2023 16:01:23 // Using the tool OpenAPI Generator v6.6.0 // //---------------------- @@ -720,9 +720,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.BerthsGet"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = this.Client.Get>("/berths", localVarRequestOptions, this.Configuration); @@ -777,9 +777,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.BerthsGet"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = await this.AsynchronousClient.GetAsync>("/berths", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); @@ -841,9 +841,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.LoginPost"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = this.Client.Post("/login", localVarRequestOptions, this.Configuration); @@ -907,9 +907,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.LoginPost"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = await this.AsynchronousClient.PostAsync("/login", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); @@ -968,9 +968,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.NotificationsGet"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = this.Client.Get("/notifications", localVarRequestOptions, this.Configuration); @@ -1031,9 +1031,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.NotificationsGet"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = await this.AsynchronousClient.GetAsync("/notifications", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); @@ -1089,9 +1089,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.ParticipantGet"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = this.Client.Get("/participant", localVarRequestOptions, this.Configuration); @@ -1149,9 +1149,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.ParticipantGet"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = await this.AsynchronousClient.GetAsync("/participant", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); @@ -1207,9 +1207,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.ShipcallsGet"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = this.Client.Get>("/shipcalls", localVarRequestOptions, this.Configuration); @@ -1267,9 +1267,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.ShipcallsGet"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = await this.AsynchronousClient.GetAsync>("/shipcalls", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); @@ -1330,9 +1330,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.ShipcallsPost"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = this.Client.Post("/shipcalls", localVarRequestOptions, this.Configuration); @@ -1395,9 +1395,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.ShipcallsPost"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = await this.AsynchronousClient.PostAsync("/shipcalls", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); @@ -1458,9 +1458,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.ShipcallsPut"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = this.Client.Put("/shipcalls", localVarRequestOptions, this.Configuration); @@ -1523,9 +1523,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.ShipcallsPut"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = await this.AsynchronousClient.PutAsync("/shipcalls", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); @@ -1578,9 +1578,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.ShipsGet"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = this.Client.Get>("/ships", localVarRequestOptions, this.Configuration); @@ -1635,9 +1635,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.ShipsGet"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = await this.AsynchronousClient.GetAsync>("/ships", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); @@ -1692,9 +1692,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.TimesDelete"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = this.Client.Delete("/times", localVarRequestOptions, this.Configuration); @@ -1751,9 +1751,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.TimesDelete"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = await this.AsynchronousClient.DeleteAsync("/times", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); @@ -1812,9 +1812,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.TimesGet"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = this.Client.Get>("/times", localVarRequestOptions, this.Configuration); @@ -1875,9 +1875,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.TimesGet"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = await this.AsynchronousClient.GetAsync>("/times", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); @@ -1938,9 +1938,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.TimesPost"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = this.Client.Post("/times", localVarRequestOptions, this.Configuration); @@ -2003,9 +2003,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.TimesPost"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = await this.AsynchronousClient.PostAsync("/times", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); @@ -2066,9 +2066,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.TimesPut"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = this.Client.Put("/times", localVarRequestOptions, this.Configuration); @@ -2131,9 +2131,9 @@ namespace BreCalClient.misc.Api localVarRequestOptions.Operation = "DefaultApi.TimesPut"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { - localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request var localVarResponse = await this.AsynchronousClient.PutAsync("/times", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); @@ -3387,7 +3387,7 @@ namespace BreCalClient.misc.Client { Proxy = null; UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); - BasePath = "https://puls200.dyn-dns.org:8088/brecal/api"; + BasePath = "https://brecal.bsmd-emswe.eu"; DefaultHeaders = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); ApiKeyPrefix = new ConcurrentDictionary(); @@ -3395,8 +3395,8 @@ namespace BreCalClient.misc.Client { { new Dictionary { - {"url", "https://puls200.dyn-dns.org:8088/brecal/api"}, - {"description", "Test server self-hosted by yours truly"}, + {"url", "https://brecal.bsmd-emswe.eu"}, + {"description", "Test server hosted on vcup"}, } } }; @@ -3414,7 +3414,7 @@ namespace BreCalClient.misc.Client IDictionary defaultHeaders, IDictionary apiKey, IDictionary apiKeyPrefix, - string basePath = "https://puls200.dyn-dns.org:8088/brecal/api") : this() + string basePath = "https://brecal.bsmd-emswe.eu") : this() { if (string.IsNullOrWhiteSpace(basePath)) throw new ArgumentException("The provided basePath is invalid.", "basePath"); @@ -5340,7 +5340,9 @@ namespace BreCalClient.misc.Model /// notificationType. /// timestamp. /// acknowledged. - public Notification(int id = default(int), int timesId = default(int), int participantId = default(int), NotificationTypeEnum? notificationType = default(NotificationTypeEnum?), DateTime timestamp = default(DateTime), bool acknowledged = default(bool)) + /// created. + /// modified. + public Notification(int id = default(int), int timesId = default(int), int participantId = default(int), NotificationTypeEnum? notificationType = default(NotificationTypeEnum?), DateTime timestamp = default(DateTime), bool acknowledged = default(bool), DateTime created = default(DateTime), DateTime? modified = default(DateTime?)) { this.Id = id; this.TimesId = timesId; @@ -5348,6 +5350,8 @@ namespace BreCalClient.misc.Model this.NotificationType = notificationType; this.Timestamp = timestamp; this.Acknowledged = acknowledged; + this.Created = created; + this.Modified = modified; } /// /// Gets or Sets Id @@ -5375,6 +5379,16 @@ namespace BreCalClient.misc.Model [DataMember(Name = "acknowledged", EmitDefaultValue = true)] public bool Acknowledged { get; set; } /// + /// Gets or Sets Created + /// + [DataMember(Name = "created", EmitDefaultValue = true)] + public DateTime Created { get; set; } + /// + /// Gets or Sets Modified + /// + [DataMember(Name = "modified", EmitDefaultValue = true)] + public DateTime? Modified { get; set; } + /// /// Returns the string presentation of the object /// /// String presentation of the object @@ -5388,6 +5402,8 @@ namespace BreCalClient.misc.Model sb.Append(" NotificationType: ").Append(NotificationType).Append("\n"); sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); sb.Append(" Acknowledged: ").Append(Acknowledged).Append("\n"); + sb.Append(" Created: ").Append(Created).Append("\n"); + sb.Append(" Modified: ").Append(Modified).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -5444,6 +5460,16 @@ namespace BreCalClient.misc.Model ( this.Acknowledged == input.Acknowledged || this.Acknowledged.Equals(input.Acknowledged) + ) && + ( + this.Created == input.Created || + (this.Created != null && + this.Created.Equals(input.Created)) + ) && + ( + this.Modified == input.Modified || + (this.Modified != null && + this.Modified.Equals(input.Modified)) ); } /// @@ -5464,6 +5490,14 @@ namespace BreCalClient.misc.Model hashCode = (hashCode * 59) + this.Timestamp.GetHashCode(); } hashCode = (hashCode * 59) + this.Acknowledged.GetHashCode(); + if (this.Created != null) + { + hashCode = (hashCode * 59) + this.Created.GetHashCode(); + } + if (this.Modified != null) + { + hashCode = (hashCode * 59) + this.Modified.GetHashCode(); + } return hashCode; } } @@ -5504,13 +5538,17 @@ namespace BreCalClient.misc.Model /// street. /// postalCode. /// city. - public Participant(int id = default(int), string name = default(string), string street = default(string), string postalCode = default(string), string city = default(string)) + /// created. + /// modified. + public Participant(int id = default(int), string name = default(string), string street = default(string), string postalCode = default(string), string city = default(string), DateTime created = default(DateTime), DateTime? modified = default(DateTime?)) { this.Id = id; this.Name = name; this.Street = street; this.PostalCode = postalCode; this.City = city; + this.Created = created; + this.Modified = modified; } /// /// Gets or Sets Id @@ -5538,6 +5576,16 @@ namespace BreCalClient.misc.Model [DataMember(Name = "city", EmitDefaultValue = true)] public string City { get; set; } /// + /// Gets or Sets Created + /// + [DataMember(Name = "created", EmitDefaultValue = true)] + public DateTime Created { get; set; } + /// + /// Gets or Sets Modified + /// + [DataMember(Name = "modified", EmitDefaultValue = true)] + public DateTime? Modified { get; set; } + /// /// Returns the string presentation of the object /// /// String presentation of the object @@ -5550,6 +5598,8 @@ namespace BreCalClient.misc.Model sb.Append(" Street: ").Append(Street).Append("\n"); sb.Append(" PostalCode: ").Append(PostalCode).Append("\n"); sb.Append(" City: ").Append(City).Append("\n"); + sb.Append(" Created: ").Append(Created).Append("\n"); + sb.Append(" Modified: ").Append(Modified).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -5605,6 +5655,16 @@ namespace BreCalClient.misc.Model this.City == input.City || (this.City != null && this.City.Equals(input.City)) + ) && + ( + this.Created == input.Created || + (this.Created != null && + this.Created.Equals(input.Created)) + ) && + ( + this.Modified == input.Modified || + (this.Modified != null && + this.Modified.Equals(input.Modified)) ); } /// @@ -5633,6 +5693,14 @@ namespace BreCalClient.misc.Model { hashCode = (hashCode * 59) + this.City.GetHashCode(); } + if (this.Created != null) + { + hashCode = (hashCode * 59) + this.Created.GetHashCode(); + } + if (this.Modified != null) + { + hashCode = (hashCode * 59) + this.Modified.GetHashCode(); + } return hashCode; } } @@ -5677,7 +5745,7 @@ namespace BreCalClient.misc.Model /// width. /// created. /// modified. - public Ship(int id = default(int), string name = default(string), int imo = default(int), string callsign = default(string), int participantId = default(int), float length = default(float), float width = default(float), DateTime created = default(DateTime), DateTime modified = default(DateTime)) + public Ship(int id = default(int), string name = default(string), int imo = default(int), string callsign = default(string), int participantId = default(int), float length = default(float), float width = default(float), DateTime created = default(DateTime), DateTime? modified = default(DateTime?)) { this.Id = id; this.Name = name; @@ -5733,7 +5801,7 @@ namespace BreCalClient.misc.Model /// Gets or Sets Modified /// [DataMember(Name = "modified", EmitDefaultValue = true)] - public DateTime Modified { get; set; } + public DateTime? Modified { get; set; } /// /// Returns the string presentation of the object /// @@ -5942,7 +6010,7 @@ namespace BreCalClient.misc.Model /// recommendedTugs. /// created. /// modified. - public Shipcall(int id = default(int), int shipId = default(int), TypeEnum type = default(TypeEnum), DateTime eta = default(DateTime), string voyage = default(string), DateTime etd = default(DateTime), int arrivalBerthId = default(int), int departureBerthId = default(int), bool tugReguired = default(bool), bool pilotRequired = default(bool), int flags = default(int), bool pierSide = default(bool), bool bunkering = default(bool), bool replenishing = default(bool), float draft = default(float), DateTime tidalWindowFrom = default(DateTime), DateTime tidalWindowTo = default(DateTime), bool rainSensitiveCargo = default(bool), int recommendedTugs = default(int), DateTime created = default(DateTime), string modified = default(string)) + public Shipcall(int id = default(int), int shipId = default(int), TypeEnum type = default(TypeEnum), DateTime eta = default(DateTime), string voyage = default(string), DateTime etd = default(DateTime), int arrivalBerthId = default(int), int departureBerthId = default(int), bool tugReguired = default(bool), bool pilotRequired = default(bool), int flags = default(int), bool pierSide = default(bool), bool bunkering = default(bool), bool replenishing = default(bool), float draft = default(float), DateTime tidalWindowFrom = default(DateTime), DateTime tidalWindowTo = default(DateTime), bool rainSensitiveCargo = default(bool), int recommendedTugs = default(int), DateTime created = default(DateTime), DateTime? modified = default(DateTime?)) { this.Id = id; this.ShipId = shipId; @@ -6071,7 +6139,7 @@ namespace BreCalClient.misc.Model /// Gets or Sets Modified /// [DataMember(Name = "modified", EmitDefaultValue = true)] - public string Modified { get; set; } + public DateTime? Modified { get; set; } /// /// Returns the string presentation of the object /// @@ -6324,7 +6392,9 @@ namespace BreCalClient.misc.Model /// endActual. /// shipcallId (required). /// participantId (required). - public Times(int id = default(int), DateTime startPlanned = default(DateTime), DateTime endPlanned = default(DateTime), int durationPlanned = default(int), DateTime startActual = default(DateTime), DateTime endActual = default(DateTime), int shipcallId = default(int), int participantId = default(int)) + /// created. + /// modified. + public Times(int id = default(int), DateTime startPlanned = default(DateTime), DateTime endPlanned = default(DateTime), int durationPlanned = default(int), DateTime startActual = default(DateTime), DateTime endActual = default(DateTime), int shipcallId = default(int), int participantId = default(int), DateTime created = default(DateTime), DateTime? modified = default(DateTime?)) { this.ShipcallId = shipcallId; this.ParticipantId = participantId; @@ -6334,6 +6404,8 @@ namespace BreCalClient.misc.Model this.DurationPlanned = durationPlanned; this.StartActual = startActual; this.EndActual = endActual; + this.Created = created; + this.Modified = modified; } /// /// Gets or Sets Id @@ -6376,6 +6448,16 @@ namespace BreCalClient.misc.Model [DataMember(Name = "participant_id", IsRequired = true, EmitDefaultValue = true)] public int ParticipantId { get; set; } /// + /// Gets or Sets Created + /// + [DataMember(Name = "created", EmitDefaultValue = true)] + public DateTime Created { get; set; } + /// + /// Gets or Sets Modified + /// + [DataMember(Name = "modified", EmitDefaultValue = true)] + public DateTime? Modified { get; set; } + /// /// Returns the string presentation of the object /// /// String presentation of the object @@ -6391,6 +6473,8 @@ namespace BreCalClient.misc.Model sb.Append(" EndActual: ").Append(EndActual).Append("\n"); sb.Append(" ShipcallId: ").Append(ShipcallId).Append("\n"); sb.Append(" ParticipantId: ").Append(ParticipantId).Append("\n"); + sb.Append(" Created: ").Append(Created).Append("\n"); + sb.Append(" Modified: ").Append(Modified).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -6458,6 +6542,16 @@ namespace BreCalClient.misc.Model ( this.ParticipantId == input.ParticipantId || this.ParticipantId.Equals(input.ParticipantId) + ) && + ( + this.Created == input.Created || + (this.Created != null && + this.Created.Equals(input.Created)) + ) && + ( + this.Modified == input.Modified || + (this.Modified != null && + this.Modified.Equals(input.Modified)) ); } /// @@ -6489,6 +6583,14 @@ namespace BreCalClient.misc.Model } hashCode = (hashCode * 59) + this.ShipcallId.GetHashCode(); hashCode = (hashCode * 59) + this.ParticipantId.GetHashCode(); + if (this.Created != null) + { + hashCode = (hashCode * 59) + this.Created.GetHashCode(); + } + if (this.Modified != null) + { + hashCode = (hashCode * 59) + this.Modified.GetHashCode(); + } return hashCode; } } diff --git a/misc/BreCalApi.yaml b/misc/BreCalApi.yaml index 2e195bf..061001d 100644 --- a/misc/BreCalApi.yaml +++ b/misc/BreCalApi.yaml @@ -14,12 +14,12 @@ info: servers: # tutorial: https://idratherbewriting.com/learnapidoc/pubapis_openapi_step3_servers_object.html - - url : "https://puls200.dyn-dns.org:8088/brecal/api" - description: "Test server self-hosted by yours truly" + - url : "https://brecal.bsmd-emswe.eu/" + description: "Test server hosted on vcup" paths: # tutorial: https://idratherbewriting.com/learnapidoc/pubapis_openapi_step4_paths_object.html - /login: + /login: post: summary: Returns a JWT session token and user data if successful requestBody: @@ -35,7 +35,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/login_result' + $ref: '#/components/schemas/login_result' 400: $ref: '#/components/responses/400' 403: @@ -43,13 +43,13 @@ paths: 500: $ref: '#/components/responses/500' 503: - $ref: '#/components/responses/503' + $ref: '#/components/responses/503' /shipcalls: get: summary: Gets a list of ship calls parameters: - - name: participant_id + - name: participant_id in: query required: true description: "**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls" @@ -151,7 +151,7 @@ paths: 500: $ref: '#/components/responses/500' 503: - $ref: '#/components/responses/503' + $ref: '#/components/responses/503' /times: get: @@ -168,7 +168,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/times_list' + $ref: '#/components/schemas/times_list' 400: $ref: '#/components/responses/400' 401: @@ -221,7 +221,7 @@ paths: parameters: - name: id in: query - required: true + required: true schema: $ref: '#/components/schemas/timesId' responses: @@ -291,10 +291,10 @@ components: - username - password properties: - username: + username: format : string password: - format : string + format : string timesId: description: The unique identifier for a times entry type: integer @@ -306,7 +306,7 @@ components: required: - id - ship_id - - type + - type - eta - voyage - etd @@ -314,13 +314,13 @@ components: id: $ref: '#/components/schemas/shipcallId' ship_id: - type: integer + type: integer type: type: string enum: - incoming - outgoing - - shifting + - shifting eta: type: string format: date-time @@ -337,7 +337,7 @@ components: type: boolean pilot_required: type: boolean - flags: + flags: type: integer pier_side: type: boolean @@ -363,6 +363,8 @@ components: format: date-time modified: type: string + format: date-time + nullable: true shipcalls: type: array @@ -372,7 +374,7 @@ components: times: type: object description: the id parameter needs to be missing on POST and to be present on PUT (Update) calls, otherwise a 400 response will be generated - required: + required: - shipcall_id - participant_id properties: @@ -396,12 +398,19 @@ components: type: integer participant_id: type: integer - + created: + type: string + format: date-time + modified: + type: string + format: date-time + nullable: true + times_list: type: array items: $ref: '#/components/schemas/times' - + berth: type: object description: Ship berth used for a ship call @@ -434,7 +443,7 @@ components: type: integer length: type: number - format: float + format: float width: type: number format: float @@ -444,6 +453,7 @@ components: modified: type: string format: date-time + nullable: true ship_list: type: array @@ -468,7 +478,14 @@ components: format: date-time acknowledged: type: boolean - + created: + type: string + format: date-time + modified: + type: string + format: date-time + nullable: true + notification_list: type: array items: @@ -486,8 +503,15 @@ components: type: string postal code: type: string - city: + city: type: string + created: + type: string + format: date-time + modified: + type: string + format: date-time + nullable: true login_result: type: object @@ -523,7 +547,7 @@ components: ApiKey: type: apiKey in: header - name: X-Api-Key + name: Authorization responses: 400: description: Invalid input diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs index 48939f3..f9c79ad 100644 --- a/src/BreCalClient/MainWindow.xaml.cs +++ b/src/BreCalClient/MainWindow.xaml.cs @@ -38,7 +38,8 @@ namespace BreCalClient public MainWindow() { InitializeComponent(); - _api = new DefaultApi(); + _api = new DefaultApi(); + _api.Configuration.ApiKeyPrefix["Authorization"] = "Bearer"; } #region event handler @@ -67,6 +68,7 @@ namespace BreCalClient if(loginResult.Id > 0) { this.busyIndicator.IsBusy = false; + this._api.Configuration.ApiKey["Authorization"] = loginResult.Token; this.LoadStaticLists(); } }