summaryrefslogtreecommitdiffstats
path: root/src/DotNetOAuth/Messaging/MessageReceivingEndpoint.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOAuth/Messaging/MessageReceivingEndpoint.cs')
-rw-r--r--src/DotNetOAuth/Messaging/MessageReceivingEndpoint.cs49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/DotNetOAuth/Messaging/MessageReceivingEndpoint.cs b/src/DotNetOAuth/Messaging/MessageReceivingEndpoint.cs
new file mode 100644
index 0000000..9ad749b
--- /dev/null
+++ b/src/DotNetOAuth/Messaging/MessageReceivingEndpoint.cs
@@ -0,0 +1,49 @@
+//-----------------------------------------------------------------------
+// <copyright file="MessageReceivingEndpoint.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOAuth.Messaging {
+ using System;
+
+ /// <summary>
+ /// An immutable description of a URL that receives messages.
+ /// </summary>
+ public class MessageReceivingEndpoint {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="MessageReceivingEndpoint"/> class.
+ /// </summary>
+ /// <param name="locationUri">The URL of this endpoint.</param>
+ /// <param name="method">The HTTP method(s) allowed.</param>
+ public MessageReceivingEndpoint(string locationUri, HttpDeliveryMethod method)
+ : this(new Uri(locationUri), method) { }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="MessageReceivingEndpoint"/> class.
+ /// </summary>
+ /// <param name="location">The URL of this endpoint.</param>
+ /// <param name="method">The HTTP method(s) allowed.</param>
+ public MessageReceivingEndpoint(Uri location, HttpDeliveryMethod method) {
+ if (location == null) {
+ throw new ArgumentNullException("location");
+ }
+ if (method == HttpDeliveryMethod.None) {
+ throw new ArgumentOutOfRangeException("method");
+ }
+
+ this.Location = location;
+ this.AllowedMethods = method;
+ }
+
+ /// <summary>
+ /// Gets the URL of this endpoint.
+ /// </summary>
+ public Uri Location { get; private set; }
+
+ /// <summary>
+ /// Gets the HTTP method(s) allowed.
+ /// </summary>
+ public HttpDeliveryMethod AllowedMethods { get; private set; }
+ }
+}