Example #1
0
        /// <summary>
        /// Gets the tree resources using the Discovery protocol.
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <param name="depth">The depth.</param>
        /// <param name="parent">The parent.</param>
        /// <returns>The message identifier.</returns>
        public Task <long> GetTreeResources(string uri, int?depth, ResourceViewModel parent = null)
        {
            var contentTypes = new string[0];
            var result       = EtpExtender.GetTreeResources(uri, depth ?? 0, contentTypes);

            return(Task.FromResult(result));
        }
Example #2
0
        /// <summary>
        /// Gets the resources using the Discovery protocol.
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <param name="parent">The parent.</param>
        /// <returns>The message identifier.</returns>
        public Task <long> GetResources(string uri, ResourceViewModel parent = null)
        {
            var  contentTypes = new string[0];
            long messageId;

            if (Model == null)
            {
                messageId = EtpExtender.GetResources(uri);
            }
            else if (Model.DiscoveryFunction == Functions.FindResources)
            {
                messageId = EtpExtender.FindResources(uri);
            }
            else if (Model.DiscoveryFunction == Functions.GetTreeResources)
            {
                messageId = EtpExtender.GetTreeResources(uri, Model.DiscoveryDepth, contentTypes);
            }
            else if (Model.DiscoveryFunction == Functions.GetGraphResources)
            {
                messageId = EtpExtender.GetGraphResources(uri, Model.DiscoveryScope, Model.GroupByType, Model.DiscoveryDepth, contentTypes);
            }
            else
            {
                messageId = EtpExtender.GetResources(uri);
            }

            return(Task.FromResult(messageId));
        }