//----------------------------------------------------------------------- // // Copyright (c) Outercurve Foundation. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.Messaging { using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; using System.Text; /// /// The interface that classes must implement to be serialized/deserialized /// as protocol or extension messages that uses POST multi-part data for binary content. /// [ContractClass(typeof(IMessageWithBinaryDataContract))] public interface IMessageWithBinaryData : IDirectedProtocolMessage { /// /// Gets the parts of the message that carry binary data. /// /// A list of parts. Never null. IList BinaryData { get; } /// /// Gets a value indicating whether this message should be sent as multi-part POST. /// bool SendAsMultipart { get; } } /// /// The contract class for the interface. /// [ContractClassFor(typeof(IMessageWithBinaryData))] internal abstract class IMessageWithBinaryDataContract : IMessageWithBinaryData { /// /// Prevents a default instance of the class from being created. /// private IMessageWithBinaryDataContract() { } #region IMessageWithBinaryData Members /// /// Gets the parts of the message that carry binary data. /// /// A list of parts. Never null. IList IMessageWithBinaryData.BinaryData { get { Contract.Ensures(Contract.Result>() != null); throw new NotImplementedException(); } } /// /// Gets a value indicating whether this message should be sent as multi-part POST. /// bool IMessageWithBinaryData.SendAsMultipart { get { throw new NotImplementedException(); } } #endregion #region IMessage Properties /// /// Gets the version of the protocol or extension this message is prepared to implement. /// /// /// /// Implementations of this interface should ensure that this property never returns null. /// Version IMessage.Version { get { return default(Version); // dummy return } } /// /// Gets the extra, non-standard Protocol parameters included in the message. /// /// /// /// Implementations of this interface should ensure that this property never returns null. /// IDictionary IMessage.ExtraData { get { return default(IDictionary); } } #endregion #region IDirectedProtocolMessage Members /// /// Gets the preferred method of transport for the message. /// /// /// For indirect messages this will likely be GET+POST, which both can be simulated in the user agent: /// the GET with a simple 301 Redirect, and the POST with an HTML form in the response with javascript /// to automate submission. /// HttpDeliveryMethods IDirectedProtocolMessage.HttpMethods { get { throw new NotImplementedException(); } } /// /// Gets the URL of the intended receiver of this message. /// Uri IDirectedProtocolMessage.Recipient { get { throw new NotImplementedException(); } } #endregion #region IProtocolMessage Members /// /// Gets the level of protection this message requires. /// MessageProtections IProtocolMessage.RequiredProtection { get { throw new NotImplementedException(); } } /// /// Gets a value indicating whether this is a direct or indirect message. /// MessageTransport IProtocolMessage.Transport { get { throw new NotImplementedException(); } } #endregion #region IMessage methods /// /// Checks the message state for conformity to the protocol specification /// and throws an exception if the message is invalid. /// /// /// Some messages have required fields, or combinations of fields that must relate to each other /// in specialized ways. After deserializing a message, this method checks the state of the /// message to see if it conforms to the protocol. /// Note that this property should not check signatures or perform any state checks /// outside this scope of this particular message. /// /// Thrown if the message is invalid. void IMessage.EnsureValidMessage() { throw new NotImplementedException(); } #endregion } }