Esempio n. 1
0
        public string GetPublicURL(string path, CopyURLType urlType = CopyURLType.Default)
        {
            path = path.Trim('/');

            CopyContentInfo fileInfo = GetMetadata(path);

            foreach (CopyLinksInfo link in fileInfo.links)
            {
                if (!link.expired && link.@public)
                {
                    return(GetLinkURL(link, path, urlType));
                }
            }

            return(string.Empty);
        }
Esempio n. 2
0
        // https://developers.copy.com/documentation#api-calls/filesystem - Read Root Directory
        // GET https://api.copy.com/rest/meta/copy
        public CopyContentInfo GetMetadata(string path)
        {
            CopyContentInfo contentInfo = null;

            if (OAuthInfo.CheckOAuth(AuthInfo))
            {
                string url = URLHelpers.CombineURL(URLMetaData, URLHelpers.URLPathEncode(path));

                string query = OAuthManager.GenerateQuery(url, null, HttpMethod.GET, AuthInfo);

                string response = SendRequest(HttpMethod.GET, query);

                if (!string.IsNullOrEmpty(response))
                {
                    contentInfo = JsonConvert.DeserializeObject <CopyContentInfo>(response);
                }
            }

            return(contentInfo);
        }