Esempio n. 1
0
        public static async Task <string> GetFolderByName(GetFolderByNameRequest request)
        {
            System.Collections.Specialized.NameValueCollection qs = HttpUtility.ParseQueryString(string.Empty);
            qs.Add("access_token", request.Token);
            qs.Add("name", request.Name);
            if (request.Type != null)
            {
                qs.Add("type", request.Type);
            }
            if (request.Root != null)
            {
                qs.Add("root", JsonConvert.SerializeObject(request.Root));
            }
            if (request.WorkSpace != null)
            {
                qs.Add("workSpace", request.WorkSpace);
            }
            string              url      = request.Host + "/rest/asset/v1/folder/byName.json?" + qs.ToString();
            HttpClient          client   = new HttpClient();
            HttpResponseMessage response = await client.GetAsync(url);

            response.EnsureSuccessStatusCode();

            string content = await response.Content.ReadAsStringAsync();

            return(content);
        }
Esempio n. 2
0
        public GetFolderByNameRequest CreateGetFolderByNameRequest(string host, string token)
        {
            Dictionary <string, dynamic> root = new Dictionary <string, dynamic>();

            root.Add("id", 17445);
            root.Add("type", "folder");

            GetFolderByNameRequest getFolderByNameRequest = new GetFolderByNameRequest()
            {
                Host  = host,
                Token = token,
                Name  = "LATAM",  //required
                Type  = "Folder", //optional
                //WorkSpace = "GL LS - Global Life Sciences",
                Root = null       //optional
            };

            return(getFolderByNameRequest);
        }