fixed notification endpoint to return real data for a shipcall

This commit is contained in:
Daniel Schick 2023-12-27 08:33:49 +01:00
parent 1ef74b51ba
commit c1d8b2e855
5 changed files with 475 additions and 117 deletions

View File

@ -1,7 +1,7 @@
//----------------------
// <auto-generated>
// Generated REST API Client Code Generator v1.9.1.0 on 19.12.2023 07:58:27
// Generated REST API Client Code Generator v1.9.1.0 on 27.12.2023 08:25:38
// Using the tool OpenAPI Generator v7.1.0
// </auto-generated>
//----------------------
@ -736,17 +736,36 @@ namespace BreCalClient.misc.Api
/// <returns>ApiResponse of List&lt;Berth&gt;</returns>
ApiResponse<List<Berth>> BerthsGetWithHttpInfo(int operationIndex = 0);
/// <summary>
/// Gets a list of notifications pursuant to a specified participant and ship call
/// History data
/// </summary>
/// <remarks>
/// List of notifications (tbd)
/// This endpoint returns a list of changes made to the specific shipcall
/// </remarks>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="participantId">**Id of participant**. *Example: 2*. Id returned through loading of participant</param>
/// <param name="shipcallId">**Id of ship call**. *Example: 52*. Id given in ship call list</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>Notification</returns>
Notification NotificationsGet(int participantId, int shipcallId, int operationIndex = 0);
/// <returns>List&lt;History&gt;</returns>
List<History> HistoryGet(int operationIndex = 0);
/// <summary>
/// History data
/// </summary>
/// <remarks>
/// This endpoint returns a list of changes made to the specific shipcall
/// </remarks>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of List&lt;History&gt;</returns>
ApiResponse<List<History>> HistoryGetWithHttpInfo(int operationIndex = 0);
/// <summary>
/// Gets a list of notifications pursuant to a specified participant and ship call
/// </summary>
/// <remarks>
/// List of notifications (tbd)
/// </remarks>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="shipcallId">**Id of ship call**. *Example: 52*. Id given in ship call list</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>Notification</returns>
Notification NotificationsGet(int shipcallId, int operationIndex = 0);
/// <summary>
/// Gets a list of notifications pursuant to a specified participant and ship call
/// </summary>
@ -754,11 +773,10 @@ namespace BreCalClient.misc.Api
/// List of notifications (tbd)
/// </remarks>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="participantId">**Id of participant**. *Example: 2*. Id returned through loading of participant</param>
/// <param name="shipcallId">**Id of ship call**. *Example: 52*. Id given in ship call list</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of Notification</returns>
ApiResponse<Notification> NotificationsGetWithHttpInfo(int participantId, int shipcallId, int operationIndex = 0);
ApiResponse<Notification> NotificationsGetWithHttpInfo(int shipcallId, int operationIndex = 0);
/// <summary>
/// gets one or all participants
/// </summary>
@ -832,18 +850,39 @@ namespace BreCalClient.misc.Api
/// <returns>Task of ApiResponse (List&lt;Berth&gt;)</returns>
System.Threading.Tasks.Task<ApiResponse<List<Berth>>> BerthsGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Gets a list of notifications pursuant to a specified participant and ship call
/// History data
/// </summary>
/// <remarks>
/// List of notifications (tbd)
/// This endpoint returns a list of changes made to the specific shipcall
/// </remarks>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="participantId">**Id of participant**. *Example: 2*. Id returned through loading of participant</param>
/// <param name="shipcallId">**Id of ship call**. *Example: 52*. Id given in ship call list</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of Notification</returns>
System.Threading.Tasks.Task<Notification> NotificationsGetAsync(int participantId, int shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <returns>Task of List&lt;History&gt;</returns>
System.Threading.Tasks.Task<List<History>> HistoryGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// History data
/// </summary>
/// <remarks>
/// This endpoint returns a list of changes made to the specific shipcall
/// </remarks>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse (List&lt;History&gt;)</returns>
System.Threading.Tasks.Task<ApiResponse<List<History>>> HistoryGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Gets a list of notifications pursuant to a specified participant and ship call
/// </summary>
/// <remarks>
/// List of notifications (tbd)
/// </remarks>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="shipcallId">**Id of ship call**. *Example: 52*. Id given in ship call list</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of Notification</returns>
System.Threading.Tasks.Task<Notification> NotificationsGetAsync(int shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// Gets a list of notifications pursuant to a specified participant and ship call
/// </summary>
@ -851,12 +890,11 @@ namespace BreCalClient.misc.Api
/// List of notifications (tbd)
/// </remarks>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="participantId">**Id of participant**. *Example: 2*. Id returned through loading of participant</param>
/// <param name="shipcallId">**Id of ship call**. *Example: 52*. Id given in ship call list</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse (Notification)</returns>
System.Threading.Tasks.Task<ApiResponse<Notification>> NotificationsGetWithHttpInfoAsync(int participantId, int shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
System.Threading.Tasks.Task<ApiResponse<Notification>> NotificationsGetWithHttpInfoAsync(int shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
/// gets one or all participants
/// </summary>
@ -1121,27 +1159,137 @@ namespace BreCalClient.misc.Api
return localVarResponse;
}
/// <summary>
/// Gets a list of notifications pursuant to a specified participant and ship call List of notifications (tbd)
/// History data This endpoint returns a list of changes made to the specific shipcall
/// </summary>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="participantId">**Id of participant**. *Example: 2*. Id returned through loading of participant</param>
/// <param name="shipcallId">**Id of ship call**. *Example: 52*. Id given in ship call list</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>Notification</returns>
public Notification NotificationsGet(int participantId, int shipcallId, int operationIndex = 0)
/// <returns>List&lt;History&gt;</returns>
public List<History> HistoryGet(int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse<Notification> localVarResponse = NotificationsGetWithHttpInfo(participantId, shipcallId);
BreCalClient.misc.Client.ApiResponse<List<History>> localVarResponse = HistoryGetWithHttpInfo();
return localVarResponse.Data;
}
/// <summary>
/// Gets a list of notifications pursuant to a specified participant and ship call List of notifications (tbd)
/// History data This endpoint returns a list of changes made to the specific shipcall
/// </summary>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="participantId">**Id of participant**. *Example: 2*. Id returned through loading of participant</param>
/// <param name="shipcallId">**Id of ship call**. *Example: 52*. Id given in ship call list</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of Notification</returns>
public BreCalClient.misc.Client.ApiResponse<Notification> NotificationsGetWithHttpInfo(int participantId, int shipcallId, int operationIndex = 0)
/// <returns>ApiResponse of List&lt;History&gt;</returns>
public BreCalClient.misc.Client.ApiResponse<List<History>> HistoryGetWithHttpInfo(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 = "StaticApi.HistoryGet";
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<List<History>>("/history", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("HistoryGet", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
/// <summary>
/// History data This endpoint returns a list of changes made to the specific shipcall
/// </summary>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of List&lt;History&gt;</returns>
public async System.Threading.Tasks.Task<List<History>> HistoryGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse<List<History>> localVarResponse = await HistoryGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
/// <summary>
/// History data This endpoint returns a list of changes made to the specific shipcall
/// </summary>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse (List&lt;History&gt;)</returns>
public async System.Threading.Tasks.Task<BreCalClient.misc.Client.ApiResponse<List<History>>> HistoryGetWithHttpInfoAsync(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 = "StaticApi.HistoryGet";
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<List<History>>("/history", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("HistoryGet", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
/// <summary>
/// Gets a list of notifications pursuant to a specified participant and ship call List of notifications (tbd)
/// </summary>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="shipcallId">**Id of ship call**. *Example: 52*. Id given in ship call list</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>Notification</returns>
public Notification NotificationsGet(int shipcallId, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse<Notification> localVarResponse = NotificationsGetWithHttpInfo(shipcallId);
return localVarResponse.Data;
}
/// <summary>
/// Gets a list of notifications pursuant to a specified participant and ship call List of notifications (tbd)
/// </summary>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="shipcallId">**Id of ship call**. *Example: 52*. Id given in ship call list</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of Notification</returns>
public BreCalClient.misc.Client.ApiResponse<Notification> NotificationsGetWithHttpInfo(int shipcallId, int operationIndex = 0)
{
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
@ -1160,7 +1308,6 @@ namespace BreCalClient.misc.Api
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "participant_id", participantId));
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "shipcall_id", shipcallId));
localVarRequestOptions.Operation = "StaticApi.NotificationsGet";
localVarRequestOptions.OperationIndex = operationIndex;
@ -1185,26 +1332,24 @@ namespace BreCalClient.misc.Api
/// Gets a list of notifications pursuant to a specified participant and ship call List of notifications (tbd)
/// </summary>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="participantId">**Id of participant**. *Example: 2*. Id returned through loading of participant</param>
/// <param name="shipcallId">**Id of ship call**. *Example: 52*. Id given in ship call list</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of Notification</returns>
public async System.Threading.Tasks.Task<Notification> NotificationsGetAsync(int participantId, int shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public async System.Threading.Tasks.Task<Notification> NotificationsGetAsync(int shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse<Notification> localVarResponse = await NotificationsGetWithHttpInfoAsync(participantId, shipcallId, operationIndex, cancellationToken).ConfigureAwait(false);
BreCalClient.misc.Client.ApiResponse<Notification> localVarResponse = await NotificationsGetWithHttpInfoAsync(shipcallId, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
/// <summary>
/// Gets a list of notifications pursuant to a specified participant and ship call List of notifications (tbd)
/// </summary>
/// <exception cref="BreCalClient.misc.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="participantId">**Id of participant**. *Example: 2*. Id returned through loading of participant</param>
/// <param name="shipcallId">**Id of ship call**. *Example: 52*. Id given in ship call list</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse (Notification)</returns>
public async System.Threading.Tasks.Task<BreCalClient.misc.Client.ApiResponse<Notification>> NotificationsGetWithHttpInfoAsync(int participantId, int shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public async System.Threading.Tasks.Task<BreCalClient.misc.Client.ApiResponse<Notification>> NotificationsGetWithHttpInfoAsync(int shipcallId, 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[] {
@ -1223,7 +1368,6 @@ namespace BreCalClient.misc.Api
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "participant_id", participantId));
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "shipcall_id", shipcallId));
localVarRequestOptions.Operation = "StaticApi.NotificationsGet";
localVarRequestOptions.OperationIndex = operationIndex;
@ -5872,6 +6016,193 @@ namespace BreCalClient.misc.Model
}
}
/*
* Bremen calling API
*
* Administer DEBRE ship calls, times and notifications
*
* The version of the OpenAPI document: 1.1.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
namespace BreCalClient.misc.Model
{
/// <summary>
/// Single history entry with references
/// </summary>
[DataContract(Name = "history")]
public partial class History : IEquatable<History>, IValidatableObject
{
/// <summary>
/// Gets or Sets Operation
/// </summary>
[DataMember(Name = "operation", EmitDefaultValue = true)]
public OperationType? Operation { get; set; }
/// <summary>
/// Gets or Sets Type
/// </summary>
[DataMember(Name = "type", EmitDefaultValue = true)]
public ObjectType? Type { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="History" /> class.
/// </summary>
/// <param name="id">id.</param>
/// <param name="participantId">participantId.</param>
/// <param name="shipcallId">shipcallId.</param>
/// <param name="timestamp">timestamp.</param>
/// <param name="eta">eta.</param>
/// <param name="operation">operation.</param>
/// <param name="type">type.</param>
public History(int id = default(int), int participantId = default(int), int shipcallId = default(int), DateTime timestamp = default(DateTime), DateTime eta = default(DateTime), OperationType? operation = default(OperationType?), ObjectType? type = default(ObjectType?))
{
this.Id = id;
this.ParticipantId = participantId;
this.ShipcallId = shipcallId;
this.Timestamp = timestamp;
this.Eta = eta;
this.Operation = operation;
this.Type = type;
}
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name = "id", EmitDefaultValue = true)]
public int Id { get; set; }
/// <summary>
/// Gets or Sets ParticipantId
/// </summary>
[DataMember(Name = "participant_id", EmitDefaultValue = true)]
public int ParticipantId { get; set; }
/// <summary>
/// Gets or Sets ShipcallId
/// </summary>
[DataMember(Name = "shipcall_id", EmitDefaultValue = true)]
public int ShipcallId { get; set; }
/// <summary>
/// Gets or Sets Timestamp
/// </summary>
[DataMember(Name = "timestamp", EmitDefaultValue = true)]
public DateTime Timestamp { get; set; }
/// <summary>
/// Gets or Sets Eta
/// </summary>
[DataMember(Name = "eta", EmitDefaultValue = true)]
public DateTime Eta { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class History {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" ParticipantId: ").Append(ParticipantId).Append("\n");
sb.Append(" ShipcallId: ").Append(ShipcallId).Append("\n");
sb.Append(" Timestamp: ").Append(Timestamp).Append("\n");
sb.Append(" Eta: ").Append(Eta).Append("\n");
sb.Append(" Operation: ").Append(Operation).Append("\n");
sb.Append(" Type: ").Append(Type).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
{
return this.Equals(input as History);
}
/// <summary>
/// Returns true if History instances are equal
/// </summary>
/// <param name="input">Instance of History to be compared</param>
/// <returns>Boolean</returns>
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)
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
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;
}
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}
/*
* Bremen calling API
*
@ -6228,21 +6559,17 @@ namespace BreCalClient.misc.Model
/// Initializes a new instance of the <see cref="Notification" /> class.
/// </summary>
/// <param name="id">id.</param>
/// <param name="timesId">timesId.</param>
/// <param name="participantId">participantId.</param>
/// <param name="shipcallId">shipcallId.</param>
/// <param name="notificationType">notificationType.</param>
/// <param name="timestamp">timestamp.</param>
/// <param name="acknowledged">acknowledged.</param>
/// <param name="message">message.</param>
/// <param name="created">Readonly field set by the database.</param>
/// <param name="modified">Readonly field set by the database.</param>
public Notification(int id = default(int), int timesId = default(int), int participantId = default(int), NotificationType? notificationType = default(NotificationType?), DateTime timestamp = default(DateTime), bool acknowledged = default(bool), DateTime created = default(DateTime), DateTime? modified = default(DateTime?))
public Notification(int id = default(int), int shipcallId = default(int), NotificationType? notificationType = default(NotificationType?), string message = default(string), DateTime created = default(DateTime), DateTime? modified = default(DateTime?))
{
this.Id = id;
this.TimesId = timesId;
this.ParticipantId = participantId;
this.ShipcallId = shipcallId;
this.NotificationType = notificationType;
this.Timestamp = timestamp;
this.Acknowledged = acknowledged;
this.Message = message;
this.Created = created;
this.Modified = modified;
}
@ -6252,25 +6579,15 @@ namespace BreCalClient.misc.Model
[DataMember(Name = "id", EmitDefaultValue = true)]
public int Id { get; set; }
/// <summary>
/// Gets or Sets TimesId
/// Gets or Sets ShipcallId
/// </summary>
[DataMember(Name = "times_id", EmitDefaultValue = true)]
public int TimesId { get; set; }
[DataMember(Name = "shipcall_id", EmitDefaultValue = true)]
public int ShipcallId { get; set; }
/// <summary>
/// Gets or Sets ParticipantId
/// Gets or Sets Message
/// </summary>
[DataMember(Name = "participant_id", EmitDefaultValue = true)]
public int ParticipantId { get; set; }
/// <summary>
/// Gets or Sets Timestamp
/// </summary>
[DataMember(Name = "timestamp", EmitDefaultValue = true)]
public DateTime Timestamp { get; set; }
/// <summary>
/// Gets or Sets Acknowledged
/// </summary>
[DataMember(Name = "acknowledged", EmitDefaultValue = true)]
public bool Acknowledged { get; set; }
[DataMember(Name = "message", EmitDefaultValue = true)]
public string Message { get; set; }
/// <summary>
/// Readonly field set by the database
/// </summary>
@ -6292,11 +6609,9 @@ namespace BreCalClient.misc.Model
StringBuilder sb = new StringBuilder();
sb.Append("class Notification {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" TimesId: ").Append(TimesId).Append("\n");
sb.Append(" ParticipantId: ").Append(ParticipantId).Append("\n");
sb.Append(" ShipcallId: ").Append(ShipcallId).Append("\n");
sb.Append(" NotificationType: ").Append(NotificationType).Append("\n");
sb.Append(" Timestamp: ").Append(Timestamp).Append("\n");
sb.Append(" Acknowledged: ").Append(Acknowledged).Append("\n");
sb.Append(" Message: ").Append(Message).Append("\n");
sb.Append(" Created: ").Append(Created).Append("\n");
sb.Append(" Modified: ").Append(Modified).Append("\n");
sb.Append("}\n");
@ -6336,25 +6651,17 @@ namespace BreCalClient.misc.Model
this.Id.Equals(input.Id)
) &&
(
this.TimesId == input.TimesId ||
this.TimesId.Equals(input.TimesId)
) &&
(
this.ParticipantId == input.ParticipantId ||
this.ParticipantId.Equals(input.ParticipantId)
this.ShipcallId == input.ShipcallId ||
this.ShipcallId.Equals(input.ShipcallId)
) &&
(
this.NotificationType == input.NotificationType ||
this.NotificationType.Equals(input.NotificationType)
) &&
(
this.Timestamp == input.Timestamp ||
(this.Timestamp != null &&
this.Timestamp.Equals(input.Timestamp))
) &&
(
this.Acknowledged == input.Acknowledged ||
this.Acknowledged.Equals(input.Acknowledged)
this.Message == input.Message ||
(this.Message != null &&
this.Message.Equals(input.Message))
) &&
(
this.Created == input.Created ||
@ -6377,14 +6684,12 @@ namespace BreCalClient.misc.Model
{
int hashCode = 41;
hashCode = (hashCode * 59) + this.Id.GetHashCode();
hashCode = (hashCode * 59) + this.TimesId.GetHashCode();
hashCode = (hashCode * 59) + this.ParticipantId.GetHashCode();
hashCode = (hashCode * 59) + this.ShipcallId.GetHashCode();
hashCode = (hashCode * 59) + this.NotificationType.GetHashCode();
if (this.Timestamp != null)
if (this.Message != null)
{
hashCode = (hashCode * 59) + this.Timestamp.GetHashCode();
hashCode = (hashCode * 59) + this.Message.GetHashCode();
}
hashCode = (hashCode * 59) + this.Acknowledged.GetHashCode();
if (this.Created != null)
{
hashCode = (hashCode * 59) + this.Created.GetHashCode();
@ -6443,6 +6748,71 @@ namespace BreCalClient.misc.Model
}
}
/*
* Bremen calling API
*
* Administer DEBRE ship calls, times and notifications
*
* The version of the OpenAPI document: 1.1.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
namespace BreCalClient.misc.Model
{
/// <summary>
/// Defines ObjectType
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum ObjectType
{
/// <summary>
/// Enum Times for value: times
/// </summary>
[EnumMember(Value = "times")]
Times = 1,
/// <summary>
/// Enum Shipcall for value: shipcall
/// </summary>
[EnumMember(Value = "shipcall")]
Shipcall = 2
}
}
/*
* Bremen calling API
*
* Administer DEBRE ship calls, times and notifications
*
* The version of the OpenAPI document: 1.1.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
namespace BreCalClient.misc.Model
{
/// <summary>
/// Defines OperationType
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum OperationType
{
/// <summary>
/// Enum Insert for value: insert
/// </summary>
[EnumMember(Value = "insert")]
Insert = 1,
/// <summary>
/// Enum Update for value: update
/// </summary>
[EnumMember(Value = "update")]
Update = 2,
/// <summary>
/// Enum Delete for value: delete
/// </summary>
[EnumMember(Value = "delete")]
Delete = 3
}
}
/*
* Bremen calling API
*

View File

@ -313,12 +313,6 @@ paths:
- static
operationId: notificationsGet
parameters:
- name: participant_id
in: query
required: true
description: '**Id of participant**. *Example: 2*. Id returned through loading of participant'
schema:
type: integer
- name: shipcall_id
in: query
required: true
@ -374,7 +368,7 @@ paths:
description: list of history entries
content:
application/json:
schema:
schema:
$ref: '#/components/schemas/history_list'
'400':
$ref: '#/components/responses/400'
@ -728,17 +722,12 @@ components:
properties:
id:
type: integer
times_id:
type: integer
participant_id:
shipcall_id:
type: integer
notification_type:
$ref: '#/components/schemas/NotificationType'
timestamp:
message:
type: string
format: date-time
acknowledged:
type: boolean
created:
type: string
format: date-time

View File

@ -10,12 +10,10 @@ bp = Blueprint('notifications', __name__)
@bp.route('/notifications', methods=['get'])
@auth_guard() # no restriction by role
def GetNotifications():
if 'participant_id' in request.args:
if 'shipcall_id' in request.args:
options = {}
options["participant_id"] = request.args.get("participant_id")
options["shipcall_id"] = request.args.get("shipcall_id")
return impl.notifications.GetNotifications(options)
else:
logging.warning("attempt to load notifications without participant id")
logging.warning("attempt to load notifications without shipcall id")
return json.dumps("missing argument"), 400

View File

@ -8,22 +8,25 @@ from .. import local_db
def GetNotifications(options):
"""
:param options: A dictionary containing all the paramters for the Operations
options["participant_id"]: **Id of participant**. *Example: 2*. Id returned through loading of participant
options["shipcall_id"]: **Id of ship call**. *Example: 52*. Id given in ship call list
options["shipcall_id"]: **Id**. *Example: 42*. Id of referenced ship call.
"""
# Implement your business logic here
# All the parameters are present in the options argument
return json.dumps({
"acknowledged": "<boolean>",
"id": "<integer>",
"notification_type": "<string>",
"participant_id": "<integer>",
"times_id": "<integer>",
"timestamp": "<date-time>",
}), 200, {'Content-Type': 'application/json; charset=utf-8'}
try:
pooledConnection = local_db.getPoolConnection()
commands = pydapper.using(pooledConnection)
data = commands.query("SELECT id, shipcall_id, level, type, message, created, modified FROM notification " +
"WHERE shipcall_id = ?scid?", model=model.Notification, param={"scid" : options["shipcall_id"]})
pooledConnection.close()
except Exception as ex:
logging.error(ex)
print(ex)
result = {}
result["message"] = "call failed"
return json.dumps(result), 500, {'Content-Type': 'application/json; charset=utf-8'}
return json.dumps(data, default=model.obj_dict), 200, {'Content-Type': 'application/json; charset=utf-8'}

View File

@ -67,11 +67,9 @@ class GetVerifyInlineResp(Schema):
pass
@dataclass
class Notification(Schema):
class Notification:
id: int
times_id: int
acknowledged: bool
shipcall_id: int
level: int
type: int
message: str