/// <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; }
/// <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; }
/// <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)); }
public SecureRestCommand(string name, string uritemplate, RestCommandD callback, params string[] permissions) : base(name, uritemplate, null) { this.callback = callback; Permissions = permissions; }
/// <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) { }
public SecureRestCommand(string uritemplate, RestCommandD callback, params string[] permissions) : this(string.Empty, uritemplate, callback, permissions) { }
/// <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) { }
public void Register(string path, RestCommandD callback) { AddCommand(new RestCommand(path, callback)); }