diff --git a/misc/BreCalApi.cs b/misc/BreCalApi.cs index e6b56d9..a27deda 100644 --- a/misc/BreCalApi.cs +++ b/misc/BreCalApi.cs @@ -1,7 +1,7 @@ //---------------------- // -// Generated REST API Client Code Generator v1.7.17.0 on 14.07.2023 16:01:23 +// Generated REST API Client Code Generator v1.7.17.0 on 26.07.2023 19:35:38 // Using the tool OpenAPI Generator v6.6.0 // //---------------------- @@ -117,10 +117,10 @@ namespace BreCalClient.misc.Api /// gets a particular participant entry corresponding to user id /// /// Thrown when fails to make API call - /// **Id of user**. *Example: 2*. User id returned by verify call. + /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) /// Index associated with the operation. - /// Participant - Participant ParticipantGet(int userId, int operationIndex = 0); + /// List<Participant> + List ParticipantGet(int? userId = default(int?), int operationIndex = 0); /// /// gets a particular participant entry corresponding to user id /// @@ -128,18 +128,17 @@ namespace BreCalClient.misc.Api /// /// /// Thrown when fails to make API call - /// **Id of user**. *Example: 2*. User id returned by verify call. + /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) /// Index associated with the operation. - /// ApiResponse of Participant - ApiResponse ParticipantGetWithHttpInfo(int userId, int operationIndex = 0); + /// ApiResponse of List<Participant> + ApiResponse> ParticipantGetWithHttpInfo(int? userId = default(int?), int operationIndex = 0); /// /// Gets a list of ship calls /// /// Thrown when fails to make API call - /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls /// Index associated with the operation. /// List<Shipcall> - List ShipcallsGet(int participantId, int operationIndex = 0); + List ShipcallsGet(int operationIndex = 0); /// /// Gets a list of ship calls /// @@ -147,10 +146,9 @@ namespace BreCalClient.misc.Api /// /// /// Thrown when fails to make API call - /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls /// Index associated with the operation. /// ApiResponse of List<Shipcall> - ApiResponse> ShipcallsGetWithHttpInfo(int participantId, int operationIndex = 0); + ApiResponse> ShipcallsGetWithHttpInfo(int operationIndex = 0); /// /// Create a new ship call /// @@ -369,11 +367,11 @@ namespace BreCalClient.misc.Api /// /// /// Thrown when fails to make API call - /// **Id of user**. *Example: 2*. User id returned by verify call. + /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of Participant - System.Threading.Tasks.Task ParticipantGetAsync(int userId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// Task of List<Participant> + System.Threading.Tasks.Task> ParticipantGetAsync(int? userId = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// gets a particular participant entry corresponding to user id /// @@ -381,11 +379,11 @@ namespace BreCalClient.misc.Api /// /// /// Thrown when fails to make API call - /// **Id of user**. *Example: 2*. User id returned by verify call. + /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Participant) - System.Threading.Tasks.Task> ParticipantGetWithHttpInfoAsync(int userId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// Task of ApiResponse (List<Participant>) + System.Threading.Tasks.Task>> ParticipantGetWithHttpInfoAsync(int? userId = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// Gets a list of ship calls /// @@ -393,11 +391,10 @@ namespace BreCalClient.misc.Api /// /// /// Thrown when fails to make API call - /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of List<Shipcall> - System.Threading.Tasks.Task> ShipcallsGetAsync(int participantId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> ShipcallsGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// Gets a list of ship calls /// @@ -405,11 +402,10 @@ namespace BreCalClient.misc.Api /// /// /// Thrown when fails to make API call - /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of ApiResponse (List<Shipcall>) - System.Threading.Tasks.Task>> ShipcallsGetWithHttpInfoAsync(int participantId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task>> ShipcallsGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// Create a new ship call /// @@ -1051,22 +1047,22 @@ namespace BreCalClient.misc.Api /// gets a particular participant entry corresponding to user id /// /// Thrown when fails to make API call - /// **Id of user**. *Example: 2*. User id returned by verify call. + /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) /// Index associated with the operation. - /// Participant - public Participant ParticipantGet(int userId, int operationIndex = 0) + /// List<Participant> + public List ParticipantGet(int? userId = default(int?), int operationIndex = 0) { - BreCalClient.misc.Client.ApiResponse localVarResponse = ParticipantGetWithHttpInfo(userId); + BreCalClient.misc.Client.ApiResponse> localVarResponse = ParticipantGetWithHttpInfo(userId); return localVarResponse.Data; } /// /// gets a particular participant entry corresponding to user id /// /// Thrown when fails to make API call - /// **Id of user**. *Example: 2*. User id returned by verify call. + /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) /// Index associated with the operation. - /// ApiResponse of Participant - public BreCalClient.misc.Client.ApiResponse ParticipantGetWithHttpInfo(int userId, int operationIndex = 0) + /// ApiResponse of List<Participant> + public BreCalClient.misc.Client.ApiResponse> ParticipantGetWithHttpInfo(int? userId = default(int?), int operationIndex = 0) { BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions(); string[] _contentTypes = new string[] { @@ -1085,7 +1081,10 @@ namespace BreCalClient.misc.Api { localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); } - localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "user_id", userId)); + if (userId != null) + { + localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "user_id", userId)); + } localVarRequestOptions.Operation = "DefaultApi.ParticipantGet"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required @@ -1094,7 +1093,7 @@ namespace BreCalClient.misc.Api localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization")); } // make the HTTP request - var localVarResponse = this.Client.Get("/participant", localVarRequestOptions, this.Configuration); + var localVarResponse = this.Client.Get>("/participant", localVarRequestOptions, this.Configuration); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("ParticipantGet", localVarResponse); @@ -1109,24 +1108,24 @@ namespace BreCalClient.misc.Api /// gets a particular participant entry corresponding to user id /// /// Thrown when fails to make API call - /// **Id of user**. *Example: 2*. User id returned by verify call. + /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of Participant - public async System.Threading.Tasks.Task ParticipantGetAsync(int userId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + /// Task of List<Participant> + public async System.Threading.Tasks.Task> ParticipantGetAsync(int? userId = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - BreCalClient.misc.Client.ApiResponse localVarResponse = await ParticipantGetWithHttpInfoAsync(userId, operationIndex, cancellationToken).ConfigureAwait(false); + BreCalClient.misc.Client.ApiResponse> localVarResponse = await ParticipantGetWithHttpInfoAsync(userId, operationIndex, cancellationToken).ConfigureAwait(false); return localVarResponse.Data; } /// /// gets a particular participant entry corresponding to user id /// /// Thrown when fails to make API call - /// **Id of user**. *Example: 2*. User id returned by verify call. + /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Participant) - public async System.Threading.Tasks.Task> ParticipantGetWithHttpInfoAsync(int userId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + /// Task of ApiResponse (List<Participant>) + public async System.Threading.Tasks.Task>> ParticipantGetWithHttpInfoAsync(int? userId = default(int?), 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[] { @@ -1145,7 +1144,10 @@ namespace BreCalClient.misc.Api { localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); } - localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "user_id", userId)); + if (userId != null) + { + localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "user_id", userId)); + } localVarRequestOptions.Operation = "DefaultApi.ParticipantGet"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required @@ -1154,7 +1156,7 @@ namespace BreCalClient.misc.Api 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); + var localVarResponse = await this.AsynchronousClient.GetAsync>("/participant", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("ParticipantGet", localVarResponse); @@ -1169,22 +1171,20 @@ namespace BreCalClient.misc.Api /// Gets a list of ship calls /// /// Thrown when fails to make API call - /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls /// Index associated with the operation. /// List<Shipcall> - public List ShipcallsGet(int participantId, int operationIndex = 0) + public List ShipcallsGet(int operationIndex = 0) { - BreCalClient.misc.Client.ApiResponse> localVarResponse = ShipcallsGetWithHttpInfo(participantId); + BreCalClient.misc.Client.ApiResponse> localVarResponse = ShipcallsGetWithHttpInfo(); return localVarResponse.Data; } /// /// Gets a list of ship calls /// /// Thrown when fails to make API call - /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls /// Index associated with the operation. /// ApiResponse of List<Shipcall> - public BreCalClient.misc.Client.ApiResponse> ShipcallsGetWithHttpInfo(int participantId, int operationIndex = 0) + public BreCalClient.misc.Client.ApiResponse> ShipcallsGetWithHttpInfo(int operationIndex = 0) { BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions(); string[] _contentTypes = new string[] { @@ -1203,7 +1203,6 @@ namespace BreCalClient.misc.Api { localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); } - localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "participant_id", participantId)); localVarRequestOptions.Operation = "DefaultApi.ShipcallsGet"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required @@ -1227,24 +1226,22 @@ namespace BreCalClient.misc.Api /// Gets a list of ship calls /// /// Thrown when fails to make API call - /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of List<Shipcall> - public async System.Threading.Tasks.Task> ShipcallsGetAsync(int participantId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> ShipcallsGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - BreCalClient.misc.Client.ApiResponse> localVarResponse = await ShipcallsGetWithHttpInfoAsync(participantId, operationIndex, cancellationToken).ConfigureAwait(false); + BreCalClient.misc.Client.ApiResponse> localVarResponse = await ShipcallsGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); return localVarResponse.Data; } /// /// Gets a list of ship calls /// /// Thrown when fails to make API call - /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of ApiResponse (List<Shipcall>) - public async System.Threading.Tasks.Task>> ShipcallsGetWithHttpInfoAsync(int participantId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task>> ShipcallsGetWithHttpInfoAsync(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[] { @@ -1263,7 +1260,6 @@ namespace BreCalClient.misc.Api { localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); } - localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "participant_id", participantId)); localVarRequestOptions.Operation = "DefaultApi.ShipcallsGet"; localVarRequestOptions.OperationIndex = operationIndex; // authentication (ApiKey) required @@ -6010,7 +6006,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), DateTime? modified = default(DateTime?)) + 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; @@ -6022,6 +6018,11 @@ namespace BreCalClient.misc.Model throw new ArgumentNullException("voyage is a required property for Shipcall and cannot be null"); } this.Voyage = voyage; + // to ensure "etd" is required (not null) + if (etd == null) + { + throw new ArgumentNullException("etd is a required property for Shipcall and cannot be null"); + } this.Etd = etd; this.ArrivalBerthId = arrivalBerthId; this.DepartureBerthId = departureBerthId; @@ -6064,72 +6065,72 @@ namespace BreCalClient.misc.Model /// Gets or Sets Etd /// [DataMember(Name = "etd", IsRequired = true, EmitDefaultValue = true)] - public DateTime Etd { get; set; } + public DateTime? Etd { get; set; } /// /// Gets or Sets ArrivalBerthId /// [DataMember(Name = "arrival_berth_id", EmitDefaultValue = true)] - public int ArrivalBerthId { get; set; } + public int? ArrivalBerthId { get; set; } /// /// Gets or Sets DepartureBerthId /// [DataMember(Name = "departure_berth_id", EmitDefaultValue = true)] - public int DepartureBerthId { get; set; } + public int? DepartureBerthId { get; set; } /// /// Gets or Sets TugReguired /// [DataMember(Name = "tug_reguired", EmitDefaultValue = true)] - public bool TugReguired { get; set; } + public bool? TugReguired { get; set; } /// /// Gets or Sets PilotRequired /// [DataMember(Name = "pilot_required", EmitDefaultValue = true)] - public bool PilotRequired { get; set; } + public bool? PilotRequired { get; set; } /// /// Gets or Sets Flags /// [DataMember(Name = "flags", EmitDefaultValue = true)] - public int Flags { get; set; } + public int? Flags { get; set; } /// /// Gets or Sets PierSide /// [DataMember(Name = "pier_side", EmitDefaultValue = true)] - public bool PierSide { get; set; } + public bool? PierSide { get; set; } /// /// Gets or Sets Bunkering /// [DataMember(Name = "bunkering", EmitDefaultValue = true)] - public bool Bunkering { get; set; } + public bool? Bunkering { get; set; } /// /// Gets or Sets Replenishing /// [DataMember(Name = "replenishing", EmitDefaultValue = true)] - public bool Replenishing { get; set; } + public bool? Replenishing { get; set; } /// /// Gets or Sets Draft /// [DataMember(Name = "draft", EmitDefaultValue = true)] - public float Draft { get; set; } + public float? Draft { get; set; } /// /// Gets or Sets TidalWindowFrom /// [DataMember(Name = "tidal_window_from", EmitDefaultValue = true)] - public DateTime TidalWindowFrom { get; set; } + public DateTime? TidalWindowFrom { get; set; } /// /// Gets or Sets TidalWindowTo /// [DataMember(Name = "tidal_window_to", EmitDefaultValue = true)] - public DateTime TidalWindowTo { get; set; } + public DateTime? TidalWindowTo { get; set; } /// /// Gets or Sets RainSensitiveCargo /// [DataMember(Name = "rain_sensitive_cargo", EmitDefaultValue = true)] - public bool RainSensitiveCargo { get; set; } + public bool? RainSensitiveCargo { get; set; } /// /// Gets or Sets RecommendedTugs /// [DataMember(Name = "recommended_tugs", EmitDefaultValue = true)] - public int RecommendedTugs { get; set; } + public int? RecommendedTugs { get; set; } /// /// Gets or Sets Created /// @@ -6230,39 +6231,48 @@ namespace BreCalClient.misc.Model ) && ( this.ArrivalBerthId == input.ArrivalBerthId || - this.ArrivalBerthId.Equals(input.ArrivalBerthId) + (this.ArrivalBerthId != null && + this.ArrivalBerthId.Equals(input.ArrivalBerthId)) ) && ( this.DepartureBerthId == input.DepartureBerthId || - this.DepartureBerthId.Equals(input.DepartureBerthId) + (this.DepartureBerthId != null && + this.DepartureBerthId.Equals(input.DepartureBerthId)) ) && ( this.TugReguired == input.TugReguired || - this.TugReguired.Equals(input.TugReguired) + (this.TugReguired != null && + this.TugReguired.Equals(input.TugReguired)) ) && ( this.PilotRequired == input.PilotRequired || - this.PilotRequired.Equals(input.PilotRequired) + (this.PilotRequired != null && + this.PilotRequired.Equals(input.PilotRequired)) ) && ( this.Flags == input.Flags || - this.Flags.Equals(input.Flags) + (this.Flags != null && + this.Flags.Equals(input.Flags)) ) && ( this.PierSide == input.PierSide || - this.PierSide.Equals(input.PierSide) + (this.PierSide != null && + this.PierSide.Equals(input.PierSide)) ) && ( this.Bunkering == input.Bunkering || - this.Bunkering.Equals(input.Bunkering) + (this.Bunkering != null && + this.Bunkering.Equals(input.Bunkering)) ) && ( this.Replenishing == input.Replenishing || - this.Replenishing.Equals(input.Replenishing) + (this.Replenishing != null && + this.Replenishing.Equals(input.Replenishing)) ) && ( this.Draft == input.Draft || - this.Draft.Equals(input.Draft) + (this.Draft != null && + this.Draft.Equals(input.Draft)) ) && ( this.TidalWindowFrom == input.TidalWindowFrom || @@ -6276,11 +6286,13 @@ namespace BreCalClient.misc.Model ) && ( this.RainSensitiveCargo == input.RainSensitiveCargo || - this.RainSensitiveCargo.Equals(input.RainSensitiveCargo) + (this.RainSensitiveCargo != null && + this.RainSensitiveCargo.Equals(input.RainSensitiveCargo)) ) && ( this.RecommendedTugs == input.RecommendedTugs || - this.RecommendedTugs.Equals(input.RecommendedTugs) + (this.RecommendedTugs != null && + this.RecommendedTugs.Equals(input.RecommendedTugs)) ) && ( this.Created == input.Created || @@ -6317,15 +6329,42 @@ namespace BreCalClient.misc.Model { hashCode = (hashCode * 59) + this.Etd.GetHashCode(); } - hashCode = (hashCode * 59) + this.ArrivalBerthId.GetHashCode(); - hashCode = (hashCode * 59) + this.DepartureBerthId.GetHashCode(); - hashCode = (hashCode * 59) + this.TugReguired.GetHashCode(); - hashCode = (hashCode * 59) + this.PilotRequired.GetHashCode(); - hashCode = (hashCode * 59) + this.Flags.GetHashCode(); - hashCode = (hashCode * 59) + this.PierSide.GetHashCode(); - hashCode = (hashCode * 59) + this.Bunkering.GetHashCode(); - hashCode = (hashCode * 59) + this.Replenishing.GetHashCode(); - hashCode = (hashCode * 59) + this.Draft.GetHashCode(); + if (this.ArrivalBerthId != null) + { + hashCode = (hashCode * 59) + this.ArrivalBerthId.GetHashCode(); + } + if (this.DepartureBerthId != null) + { + hashCode = (hashCode * 59) + this.DepartureBerthId.GetHashCode(); + } + if (this.TugReguired != null) + { + hashCode = (hashCode * 59) + this.TugReguired.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.Replenishing != null) + { + hashCode = (hashCode * 59) + this.Replenishing.GetHashCode(); + } + if (this.Draft != null) + { + hashCode = (hashCode * 59) + this.Draft.GetHashCode(); + } if (this.TidalWindowFrom != null) { hashCode = (hashCode * 59) + this.TidalWindowFrom.GetHashCode(); @@ -6334,8 +6373,14 @@ namespace BreCalClient.misc.Model { hashCode = (hashCode * 59) + this.TidalWindowTo.GetHashCode(); } - hashCode = (hashCode * 59) + this.RainSensitiveCargo.GetHashCode(); - hashCode = (hashCode * 59) + this.RecommendedTugs.GetHashCode(); + if (this.RainSensitiveCargo != null) + { + hashCode = (hashCode * 59) + this.RainSensitiveCargo.GetHashCode(); + } + if (this.RecommendedTugs != null) + { + hashCode = (hashCode * 59) + this.RecommendedTugs.GetHashCode(); + } if (this.Created != null) { hashCode = (hashCode * 59) + this.Created.GetHashCode(); diff --git a/misc/BreCalApi.yaml b/misc/BreCalApi.yaml index 061001d..7f2aa4c 100644 --- a/misc/BreCalApi.yaml +++ b/misc/BreCalApi.yaml @@ -48,13 +48,13 @@ paths: /shipcalls: get: summary: Gets a list of ship calls - parameters: - - name: participant_id - in: query - required: true - description: "**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls" - schema: - type: integer + #parameters: + # - name: participant_id + # in: query + # required: true + # description: "**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls" + # schema: + # type: integer responses: 200: description: ship call list @@ -133,7 +133,7 @@ paths: parameters: - name: user_id in: query - required: true + required: false description: "**Id of user**. *Example: 2*. User id returned by verify call." schema: type: integer @@ -143,7 +143,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/participant' + $ref: '#/components/schemas/participant_list' 400: $ref: '#/components/responses/400' 401: @@ -326,38 +326,53 @@ components: format: date-time voyage: type: string + nullable: true etd: type: string format: date-time + nullable: true arrival_berth_id: type: integer + nullable: true departure_berth_id: type: integer + nullable: true tug_reguired: type: boolean + nullable: true pilot_required: type: boolean + nullable: true flags: type: integer + nullable: true pier_side: type: boolean + nullable: true bunkering: type: boolean + nullable: true replenishing: type: boolean + nullable: true draft: type: number format: float + nullable: true tidal_window_from: type: string format: date-time + nullable: true tidal_window_to: type: string format: date-time + nullable: true rain_sensitive_cargo: type: boolean + nullable: true recommended_tugs: type: integer + nullable: true created: type: string format: date-time @@ -513,6 +528,11 @@ components: format: date-time nullable: true + participant_list: + type: array + items: + $ref: '#/components/schemas/participant' + login_result: type: object description: result structure of a successful login attempt @@ -530,7 +550,8 @@ components: user_phone: type: string exp: - type: float + type: number + format: float token: type: string diff --git a/src/BreCalClient/BreCalClient.csproj b/src/BreCalClient/BreCalClient.csproj index d1b19be..903972e 100644 --- a/src/BreCalClient/BreCalClient.csproj +++ b/src/BreCalClient/BreCalClient.csproj @@ -7,6 +7,15 @@ true + + + + + + + + + @@ -29,6 +38,12 @@ MSBuild:Compile + + + + + + @@ -40,4 +55,19 @@ + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + diff --git a/src/BreCalClient/BreCalClient.licenseheader b/src/BreCalClient/BreCalClient.licenseheader new file mode 100644 index 0000000..82bf51d --- /dev/null +++ b/src/BreCalClient/BreCalClient.licenseheader @@ -0,0 +1,16 @@ +extensions: designer.cs generated.cs +extensions: .cs .cpp .h +// Copyright (c) 2023 schick Informatik +// Description: +// + +extensions: .aspx .ascx +<%-- +Copyright (c) 2023 schick Informatik +--%> +extensions: .vb +'Sample license text. +extensions: .xml .config .xsd + \ No newline at end of file diff --git a/src/BreCalClient/MainWindow.xaml b/src/BreCalClient/MainWindow.xaml index 1ab618e..737bf1a 100644 --- a/src/BreCalClient/MainWindow.xaml +++ b/src/BreCalClient/MainWindow.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:BreCalClient" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" mc:Ignorable="d" - Title="{DynamicResource textApplicationTitle}" Height="450" Width="800" Loaded="Window_Loaded"> + Title="{DynamicResource textApplicationTitle}" Height="450" Width="800" Loaded="Window_Loaded" Closing="Window_Closing"> @@ -45,7 +45,9 @@ - + + + diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs index f9c79ad..5859a30 100644 --- a/src/BreCalClient/MainWindow.xaml.cs +++ b/src/BreCalClient/MainWindow.xaml.cs @@ -1,9 +1,15 @@ -using System; +// Copyright (c) 2023 schick Informatik +// Description: Bremen calling main window +// + +using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; using System.Collections.ObjectModel; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; @@ -25,15 +31,17 @@ namespace BreCalClient /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window - { - DefaultApi _api; - ObservableCollection _controlModels = new(); - List _ships = new(); - Dictionary _shipLookupDict = new(); - List _berths = new(); - Dictionary _berthLookupDict = new(); - List _participants = new(); - Dictionary _participantLookupDict = new(); + { + private const int SHIPCALL_UPDATE_INTERVAL_SECONDS = 30; + private DefaultApi _api; + private ObservableCollection _controlModels = new(); + private List _ships = new(); + private ConcurrentDictionary _shipLookupDict = new(); + private List _berths = new(); + private ConcurrentDictionary _berthLookupDict = new(); + private List _participants = new(); + private Dictionary _participantLookupDict = new(); + private CancellationTokenSource _tokenSource = new CancellationTokenSource(); public MainWindow() { @@ -49,6 +57,11 @@ namespace BreCalClient } + private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) + { + _tokenSource.Cancel(); + } + private async void buttonLogin_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(this.textPassword.Password) || string.IsNullOrEmpty(this.textUsername.Text)) @@ -100,32 +113,68 @@ namespace BreCalClient this._ships = await _api.ShipsGetAsync(); foreach(var ship in this._ships) _shipLookupDict[ship.Id] = ship; - // this._participants = await _api.ParticipantGetAsync(); + this._participants = await _api.ParticipantGetAsync(); + foreach(Participant participant in this._participants) + this._participantLookupDict[participant.Id] = participant; + _ = Task.Run(() => RefreshShipcalls()); } + - private async void RefreshShipcalls() + public async Task RefreshShipcalls() { - List shipcalls = await _api.ShipcallsGetAsync(0); // TODO: this must return all current calls - foreach(Shipcall shipcall in shipcalls) + while (!_tokenSource.Token.IsCancellationRequested) { + List shipcalls = await _api.ShipcallsGetAsync(); + foreach (Shipcall shipcall in shipcalls) + { + ShipcallControlModel? selectedSCMModel = null; + + foreach(ShipcallControlModel scm in this._controlModels) + { + if(scm.Shipcall?.Id == shipcall.Id) + { + selectedSCMModel = scm; + break; + } + } + + if(selectedSCMModel != null) + { + selectedSCMModel.Shipcall = shipcall; + + } + else + { + // no: create new entry + ShipcallControlModel scm = new ShipcallControlModel(); + scm.Shipcall = shipcall; + if (this._shipLookupDict.ContainsKey(shipcall.ShipId)) + scm.Ship = this._shipLookupDict[shipcall.ShipId]; + _controlModels.Add(scm); + this.Dispatcher.Invoke(new Action(() => + { + ShipcallControl sc = new ShipcallControl(); + sc.Height = 80; + sc.ShipcallControlModel = scm; + this.stackPanel.Children.Add(sc); + })); + } + } + + // test for deletion, anything in the display that is not in the lookup result + foreach(ShipcallControlModel scm in this._controlModels) + { + + } - // TODO: find out if we already have this thing - - // yes: update values - - // no: create new entry - ShipcallControlModel scm = new ShipcallControlModel(); - scm.Shipcall = shipcall; - if(this._shipLookupDict.ContainsKey(shipcall.Id)) - scm.Ship = this._shipLookupDict[shipcall.Id]; - _controlModels.Add(scm); - - // TODO: sort this list somehow + await Task.Delay(TimeSpan.FromSeconds(SHIPCALL_UPDATE_INTERVAL_SECONDS), _tokenSource.Token); } } + #endregion + } } diff --git a/src/BreCalClient/Resources/Resources.Designer.cs b/src/BreCalClient/Resources/Resources.Designer.cs new file mode 100644 index 0000000..4a501ea --- /dev/null +++ b/src/BreCalClient/Resources/Resources.Designer.cs @@ -0,0 +1,123 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace BreCalClient.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BreCalClient.Resources.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] trafficlight_green { + get { + object obj = ResourceManager.GetObject("trafficlight_green", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] trafficlight_off { + get { + object obj = ResourceManager.GetObject("trafficlight_off", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] trafficlight_on { + get { + object obj = ResourceManager.GetObject("trafficlight_on", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] trafficlight_red { + get { + object obj = ResourceManager.GetObject("trafficlight_red", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] trafficlight_red_yellow { + get { + object obj = ResourceManager.GetObject("trafficlight_red_yellow", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] trafficlight_yellow { + get { + object obj = ResourceManager.GetObject("trafficlight_yellow", resourceCulture); + return ((byte[])(obj)); + } + } + } +} diff --git a/src/BreCalClient/Resources/Resources.resx b/src/BreCalClient/Resources/Resources.resx new file mode 100644 index 0000000..2d8b1ab --- /dev/null +++ b/src/BreCalClient/Resources/Resources.resx @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + trafficlight_green.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + trafficlight_off.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + trafficlight_on.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + trafficlight_red.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + trafficlight_red_yellow.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + trafficlight_yellow.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/BreCalClient/Resources/trafficlight_green.png b/src/BreCalClient/Resources/trafficlight_green.png new file mode 100644 index 0000000..52c0ad3 Binary files /dev/null and b/src/BreCalClient/Resources/trafficlight_green.png differ diff --git a/src/BreCalClient/Resources/trafficlight_off.png b/src/BreCalClient/Resources/trafficlight_off.png new file mode 100644 index 0000000..49cc4d7 Binary files /dev/null and b/src/BreCalClient/Resources/trafficlight_off.png differ diff --git a/src/BreCalClient/Resources/trafficlight_on.png b/src/BreCalClient/Resources/trafficlight_on.png new file mode 100644 index 0000000..bac5c50 Binary files /dev/null and b/src/BreCalClient/Resources/trafficlight_on.png differ diff --git a/src/BreCalClient/Resources/trafficlight_red.png b/src/BreCalClient/Resources/trafficlight_red.png new file mode 100644 index 0000000..b0fe48b Binary files /dev/null and b/src/BreCalClient/Resources/trafficlight_red.png differ diff --git a/src/BreCalClient/Resources/trafficlight_red_yellow.png b/src/BreCalClient/Resources/trafficlight_red_yellow.png new file mode 100644 index 0000000..2cabd7f Binary files /dev/null and b/src/BreCalClient/Resources/trafficlight_red_yellow.png differ diff --git a/src/BreCalClient/Resources/trafficlight_yellow.png b/src/BreCalClient/Resources/trafficlight_yellow.png new file mode 100644 index 0000000..5578e89 Binary files /dev/null and b/src/BreCalClient/Resources/trafficlight_yellow.png differ diff --git a/src/BreCalClient/ShipcallControl.xaml b/src/BreCalClient/ShipcallControl.xaml index f8e8b63..236ea2c 100644 --- a/src/BreCalClient/ShipcallControl.xaml +++ b/src/BreCalClient/ShipcallControl.xaml @@ -4,9 +4,11 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:BreCalClient" + xmlns:db="clr-namespace:BreCalClient;assembly=BreCalClient" mc:Ignorable="d" - d:DesignHeight="100" d:DesignWidth="800"> - + d:DesignHeight="100" d:DesignWidth="800" Loaded="UserControl_Loaded"> + + @@ -19,7 +21,7 @@ - + @@ -29,23 +31,60 @@ - + - + - + - + - + + + + - + + + + + + + + + + + + + diff --git a/src/BreCalClient/ShipcallControl.xaml.cs b/src/BreCalClient/ShipcallControl.xaml.cs index 4218613..a9b103d 100644 --- a/src/BreCalClient/ShipcallControl.xaml.cs +++ b/src/BreCalClient/ShipcallControl.xaml.cs @@ -1,4 +1,8 @@ -using System; +// Copyright (c) 2023 schick Informatik +// Description: Custom control to display a ship call +// + +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -20,9 +24,33 @@ namespace BreCalClient /// public partial class ShipcallControl : UserControl { + + #region Construction + public ShipcallControl() { InitializeComponent(); } + + #endregion + + #region Properties + + /// + /// this is our datasource + /// + public ShipcallControlModel? ShipcallControlModel { get; set; } + + #endregion + + #region event handler + + private void UserControl_Loaded(object sender, RoutedEventArgs e) + { + this.DataContext = this.ShipcallControlModel; + } + + #endregion + } } diff --git a/src/BreCalClient/ShipcallControlModel.cs b/src/BreCalClient/ShipcallControlModel.cs index fe864f4..03524cf 100644 --- a/src/BreCalClient/ShipcallControlModel.cs +++ b/src/BreCalClient/ShipcallControlModel.cs @@ -1,5 +1,9 @@ -using BreCalClient.misc.Model; +// Copyright (c) 2023 schick Informatik +// Description: Container model for shipcall related info +// +using BreCalClient.misc.Model; +using System; namespace BreCalClient { @@ -9,7 +13,65 @@ namespace BreCalClient /// public class ShipcallControlModel { + + public enum TrafficLightMode + { + OFF, + GREEN, + YELLOW, + RED, + RED_YELLOW, + ALL + }; + + [Flags] + public enum StatusFlags + { + RED, + GREEN, + YELLOW, + BLINK_1, + BLINK_2 + }; + public Shipcall? Shipcall { get; set; } public Ship? Ship { get; set; } + + public string Test { get { return "Gurkensalat"; } } + + public TrafficLightMode LightMode + { + get + { + if(IsFlagSet(StatusFlags.RED)) + { + if(IsFlagSet((StatusFlags)StatusFlags.YELLOW)) + { + if(IsFlagSet(StatusFlags.GREEN)) + { + return TrafficLightMode.ALL; + } + return TrafficLightMode.RED_YELLOW; + } + return TrafficLightMode.RED; + } + if(IsFlagSet(StatusFlags.YELLOW)) + return TrafficLightMode.YELLOW; + if(IsFlagSet(StatusFlags.GREEN)) + return TrafficLightMode.GREEN; + return TrafficLightMode.OFF; + } + } + + #region private helper + + private bool IsFlagSet(StatusFlags flag) + { + if(this.Shipcall == null) return false; + return (this.Shipcall.Flags & (int) flag) != 0; + } + + #endregion + } }