public OcApiMessage(OcApiMessageType type, [NotNull] string message) { if (type == OcApiMessageType.Unknown) { throw new ArgumentOutOfRangeException(nameof(type), $"PI Messages can not be of type {nameof(OcApiMessageType.Unknown)}"); } if (string.IsNullOrWhiteSpace(message)) { throw new ArgumentNullException(nameof(message), $"{nameof(message)} must have a non-blank value"); } ApiMessageType = type; Message = message.Trim(); }
public OcApiMessage(OcApiMessageType type, [NotNull] string message, string referenceType, string referenceKey) : this(type, message) { if (string.IsNullOrWhiteSpace(referenceType) && string.IsNullOrWhiteSpace(referenceKey)) { ReferenceType = null; ReferenceKey = null; return; } if (string.IsNullOrWhiteSpace(referenceType)) { throw new ArgumentNullException(nameof(referenceType), $"{nameof(referenceType)} must have a non-blank value if {nameof(referenceKey)} is specified"); } if (string.IsNullOrWhiteSpace(referenceKey)) { throw new ArgumentNullException(nameof(referenceKey), $"{nameof(referenceKey)} must have a non-blank value if {nameof(referenceType)} is specified"); } ReferenceType = referenceType.Trim(); ReferenceKey = referenceKey.Trim(); }
protected void ResponseMessageAdd(OcApiMessageType type, [NotNull] string message, string referenceType, string referenceKey) { Debug.Assert(Request?.ResponseMessages != null); Request.ResponseMessages.Add(type, message, referenceType, referenceKey); }
public void Add(OcApiMessageType type, [NotNull] string message, string referenceType, string referenceKey) { _messages.Add(new OcApiMessage(type, message, referenceType, referenceKey)); }
public void Add(OcApiMessageType type, [NotNull] string message) { _messages.Add(new OcApiMessage(type, message)); }