Esempio n. 1
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="name">Used for identification</param>
		/// <param name="uritemplate">Url template</param>
		/// <param name="callback">Rest Command callback</param>
		public RestCommand(string name, string uritemplate, RestCommandD callback)
		{
			Name = name;
			UriTemplate = uritemplate;
			UriVerbMatch = string.Format("^{0}$", string.Join("([^/]*)", Regex.Split(uritemplate, "\\{[^\\{\\}]*\\}")));
			var matches = Regex.Matches(uritemplate, "\\{([^\\{\\}]*)\\}");
			UriVerbs = (from Match match in matches select match.Groups[1].Value).ToArray();
			this.callback = callback;
			DoLog = true;
		}
Esempio n. 2
0
        /// <summary>
        /// Creates a new <see cref="RestCommand"/> used with the REST API
        /// </summary>
        /// <param name="name">Used for identification</param>
        /// <param name="uritemplate">Url template</param>
        /// <param name="callback">Rest Command callback</param>
        public RestCommand(string name, string uritemplate, RestCommandD callback)
        {
            Name         = name;
            UriTemplate  = uritemplate;
            UriVerbMatch = string.Format("^{0}$", string.Join("([^/]*)", Regex.Split(uritemplate, "\\{[^\\{\\}]*\\}")));
            var matches = Regex.Matches(uritemplate, "\\{([^\\{\\}]*)\\}");

            UriVerbs      = (from Match match in matches select match.Groups[1].Value).ToArray();
            this.callback = callback;
            DoLog         = true;
        }
Esempio n. 3
0
 /// <summary>
 /// Registers a command using the given route
 /// </summary>
 /// <param name="path">URL route</param>
 /// <param name="callback">Command callback</param>
 public void Register(string path, RestCommandD callback)
 {
     AddCommand(new RestCommand(path, callback));
 }
Esempio n. 4
0
 public SecureRestCommand(string name, string uritemplate, RestCommandD callback, params string[] permissions)
     : base(name, uritemplate, null)
 {
     this.callback = callback;
     Permissions   = permissions;
 }
Esempio n. 5
0
 /// <summary>
 /// Creates a new <see cref="RestCommand"/> used with the REST API
 /// </summary>
 /// <param name="uritemplate">Url template</param>
 /// <param name="callback">Rest Command callback</param>
 public RestCommand(string uritemplate, RestCommandD callback)
     : this(string.Empty, uritemplate, callback)
 {
 }
Esempio n. 6
0
 public SecureRestCommand(string uritemplate, RestCommandD callback, params string[] permissions)
     : this(string.Empty, uritemplate, callback, permissions)
 {
 }
Esempio n. 7
0
		public SecureRestCommand(string uritemplate, RestCommandD callback, params string[] permissions)
			: this(string.Empty, uritemplate, callback, permissions)
		{
		}
Esempio n. 8
0
		public SecureRestCommand(string name, string uritemplate, RestCommandD callback, params string[] permissions)
			: base(name, uritemplate, null)
		{
			this.callback = callback;
			Permissions = permissions;
		}
Esempio n. 9
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="uritemplate">Url template</param>
		/// <param name="callback">Rest Command callback</param>
		public RestCommand(string uritemplate, RestCommandD callback)
			: this(string.Empty, uritemplate, callback)
		{
		}
Esempio n. 10
0
 public void Register(string path, RestCommandD callback)
 {
     AddCommand(new RestCommand(path, callback));
 }