saguiitay / DropboxRestAPI

Dropbox REST API client in C#
MIT License
46 stars 38 forks source link

Failed to get metadata and membership details of folder shared with group #23

Closed GOneKumar closed 8 years ago

GOneKumar commented 8 years ago

Hi there, In my Dropbox account, I have one folder which is shared with few users and with one group. When I try to get sharing information for this folder, I am getting Json exception for below method call, _Client.Core.Metadata.MetadataAsync(path: path, include_membership:true);

After doing some dry running code, I figured out that the Group sharing is not handled. Currently the JsonConvert.DeserializeObject(content); failed to parse the content if folder is shared with group.

I did the following changes to temporarily fix this issue:

  1. // dropboxrestapi\models\core\sharedfolder.cs Change
    public string[] groups {get;set;}
    to
    public Groups[] groups { get; set; }
  2. Added new class file as //dropboxrestapi\models\core\Groups.cs
namespace DropboxRestAPI.Models.Core
{
    public class Groups
    {
        public string access_type { get; set; }
        public Group group { get; set; }
    }
    public class Group
    {
        public string display_name { get; set; }
        public string id { get; set; }
        public int member_count { get; set; }
        public bool is_team_group { get; set; }
        public string access_type { get; set; }
        public bool same_team { get; set; }
    }
}

After this change, I am able to fetch the sharing information properly.

Thanks,

saguiitay commented 8 years ago

Seems like a reasonable change. Can you provide a PR?

GOneKumar commented 8 years ago

I'm very new to GitHub and don't know how to create Pull Request. It will take some time for me to create PR for this change. Please create the same OBO me. Thanks

GOneKumar commented 8 years ago

Thanks saguiitay..I can see the new code changes to fix this issue.