//----------------------------------------------------------------------- // // Copyright (c) Outercurve Foundation. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.Messaging { using System; using System.Diagnostics; using Validation; /// /// An immutable description of a URL that receives messages. /// [DebuggerDisplay("{AllowedMethods} {Location}")] [Serializable] public class MessageReceivingEndpoint { /// /// Initializes a new instance of the class. /// /// The URL of this endpoint. /// The HTTP method(s) allowed. public MessageReceivingEndpoint(string locationUri, HttpDeliveryMethods method) : this(new Uri(locationUri), method) { Requires.NotNull(locationUri, "locationUri"); Requires.Range(method != HttpDeliveryMethods.None, "method"); Requires.Range((method & HttpDeliveryMethods.HttpVerbMask) != 0, "method", MessagingStrings.GetOrPostFlagsRequired); } /// /// Initializes a new instance of the class. /// /// The URL of this endpoint. /// The HTTP method(s) allowed. public MessageReceivingEndpoint(Uri location, HttpDeliveryMethods method) { Requires.NotNull(location, "location"); Requires.Range(method != HttpDeliveryMethods.None, "method"); Requires.Range((method & HttpDeliveryMethods.HttpVerbMask) != 0, "method", MessagingStrings.GetOrPostFlagsRequired); this.Location = location; this.AllowedMethods = method; } /// /// Gets the URL of this endpoint. /// public Uri Location { get; private set; } /// /// Gets the HTTP method(s) allowed. /// public HttpDeliveryMethods AllowedMethods { get; private set; } } }