Exemple #1
0
        static public async Task <CloudInfo> GetProperties(Api api, string path, Properties properties = Properties.Basic)
        {
            XDocument postParams = EncodeProperties(properties);
            XElement  data       = await api.SendMessageAsyncAndGetXmlResponse(Api.PROPFIND, ConvertFilePathToUriPath(path), postParams,
                                                                               new {
                Depth = 0
            });

            return(CloudInfo.Parse(data.Elements().First()));
        }
Exemple #2
0
        static public async Task <List <CloudInfo> > List(Api api, string path, Properties properties = Properties.Basic, int maxDepth = -1)
        {
            XDocument postParams = EncodeProperties(properties);
            object    headers    = null;

            if (maxDepth >= 0)
            {
                headers = new {
                    Depth = maxDepth
                }
            }
            ;
            XElement result = await api.SendMessageAsyncAndGetXmlResponse(Api.PROPFIND, ConvertFilePathToUriPath(path), postParams, headers);

            return(new List <CloudInfo>(result.Elements().Select(t => CloudInfo.Parse(t))));
        }
Exemple #3
0
        static public async Task <List <CloudInfo> > GetFavorites(Api api, string path, Properties properties = Properties.Basic)
        {
            XDocument postParams = new XDocument();
            XElement  p          = new XElement("{http://owncloud.org/ns}filter-files");

            postParams.Add(p);
            XElement rules = new XElement("{http://owncloud.org/ns}filter-rules");

            p.Add(rules);
            rules.Add(new XElement("{http://owncloud.org/ns}favorite", "1"));
            XDocument propParams = EncodeProperties(properties);

            if (propParams != null)
            {
                p.Add(propParams.Element("{DAV:}propfind").Element("{DAV:}prop"));
            }
            XElement result = await api.SendMessageAsyncAndGetXmlResponse(Api.REPORT, ConvertFilePathToUriPath(path), postParams);

            return(new List <CloudInfo>(result.Elements().Select(t => CloudInfo.Parse(t))));
        }
Exemple #4
0
        static public async Task <List <CloudInfo> > Search(Api api, XDocument query)
        {
            XElement result = await api.SendMessageAsyncAndGetXmlResponse(Api.REPORT, "remote.php/dav", query);

            return(new List <CloudInfo>(result.Elements().Select(t => CloudInfo.Parse(t))));
        }