Skip to content

Commit

Permalink
Update based on new spec
Browse files Browse the repository at this point in the history
  • Loading branch information
qimingyuan committed Dec 10, 2015
1 parent 68e2e7e commit cac6176
Show file tree
Hide file tree
Showing 56 changed files with 2,433 additions and 1,489 deletions.
9 changes: 6 additions & 3 deletions Dropbox.Api/Dropbox.Api.Doc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,10 @@
<Compile Include="Sharing\AddFolderMemberError.cs" />
<Compile Include="Sharing\AddMember.cs" />
<Compile Include="Sharing\AddMemberSelectorError.cs" />
<Compile Include="Sharing\BasicSharedFolderMetadata.cs" />
<Compile Include="Sharing\CollectionLinkMetadata.cs" />
<Compile Include="Sharing\CreateSharedLinkArg.cs" />
<Compile Include="Sharing\CreateSharedLinkError.cs" />
<Compile Include="Sharing\FolderPolicy.cs" />
<Compile Include="Sharing\FullSharedFolderMetadata.cs" />
<Compile Include="Sharing\GetMetadataArgs.cs" />
<Compile Include="Sharing\GetSharedLinksArg.cs" />
<Compile Include="Sharing\GetSharedLinksError.cs" />
Expand All @@ -162,7 +160,11 @@
<Compile Include="Sharing\JobError.cs" />
<Compile Include="Sharing\JobStatus.cs" />
<Compile Include="Sharing\LinkMetadata.cs" />
<Compile Include="Sharing\ListFoldersArgs.cs" />
<Compile Include="Sharing\ListFolderMembersArgs.cs" />
<Compile Include="Sharing\ListFolderMembersContinueArg.cs" />
<Compile Include="Sharing\ListFolderMembersContinueError.cs" />
<Compile Include="Sharing\ListFoldersContinueArg.cs" />
<Compile Include="Sharing\ListFoldersContinueError.cs" />
<Compile Include="Sharing\ListFoldersResult.cs" />
<Compile Include="Sharing\MemberPolicy.cs" />
<Compile Include="Sharing\MemberSelector.cs" />
Expand All @@ -184,6 +186,7 @@
<Compile Include="Sharing\SharePathError.cs" />
<Compile Include="Sharing\SharedFolderAccessError.cs" />
<Compile Include="Sharing\SharedFolderMemberError.cs" />
<Compile Include="Sharing\SharedFolderMembers.cs" />
<Compile Include="Sharing\SharedFolderMetadata.cs" />
<Compile Include="Sharing\SharedLinkPolicy.cs" />
<Compile Include="Sharing\SharingRoutes.cs" />
Expand Down
9 changes: 6 additions & 3 deletions Dropbox.Api/Dropbox.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,10 @@
<Compile Include="Sharing\AddFolderMemberError.cs" />
<Compile Include="Sharing\AddMember.cs" />
<Compile Include="Sharing\AddMemberSelectorError.cs" />
<Compile Include="Sharing\BasicSharedFolderMetadata.cs" />
<Compile Include="Sharing\CollectionLinkMetadata.cs" />
<Compile Include="Sharing\CreateSharedLinkArg.cs" />
<Compile Include="Sharing\CreateSharedLinkError.cs" />
<Compile Include="Sharing\FolderPolicy.cs" />
<Compile Include="Sharing\FullSharedFolderMetadata.cs" />
<Compile Include="Sharing\GetMetadataArgs.cs" />
<Compile Include="Sharing\GetSharedLinksArg.cs" />
<Compile Include="Sharing\GetSharedLinksError.cs" />
Expand All @@ -182,7 +180,11 @@
<Compile Include="Sharing\JobError.cs" />
<Compile Include="Sharing\JobStatus.cs" />
<Compile Include="Sharing\LinkMetadata.cs" />
<Compile Include="Sharing\ListFoldersArgs.cs" />
<Compile Include="Sharing\ListFolderMembersArgs.cs" />
<Compile Include="Sharing\ListFolderMembersContinueArg.cs" />
<Compile Include="Sharing\ListFolderMembersContinueError.cs" />
<Compile Include="Sharing\ListFoldersContinueArg.cs" />
<Compile Include="Sharing\ListFoldersContinueError.cs" />
<Compile Include="Sharing\ListFoldersResult.cs" />
<Compile Include="Sharing\MemberPolicy.cs" />
<Compile Include="Sharing\MemberSelector.cs" />
Expand All @@ -204,6 +206,7 @@
<Compile Include="Sharing\SharePathError.cs" />
<Compile Include="Sharing\SharedFolderAccessError.cs" />
<Compile Include="Sharing\SharedFolderMemberError.cs" />
<Compile Include="Sharing\SharedFolderMembers.cs" />
<Compile Include="Sharing\SharedFolderMetadata.cs" />
<Compile Include="Sharing\SharedLinkPolicy.cs" />
<Compile Include="Sharing\SharingRoutes.cs" />
Expand Down
4 changes: 2 additions & 2 deletions Dropbox.Api/Dropbox.Api.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata>
<id>$id$</id>
<version>2.0.3</version>
<version>2.1.0</version>
<title>Dropbox v2 API Beta</title>
<authors>Dropbox Inc</authors>
<owners>Dropbox Inc</owners>
Expand All @@ -12,7 +12,7 @@
<iconUrl>https://cf.dropboxstatic.com/static/images/icons/blue_dropbox_glyph.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Portable class library for accessing the Dropbox v2 API</description>
<releaseNotes>Preview Release. Bug fixes.</releaseNotes>
<releaseNotes>Preview Release. Update shared folder APIs.</releaseNotes>
<copyright>Copyright (c) Dropbox Inc. 2015</copyright>
<tags>Dropbox Api</tags>
</metadata>
Expand Down
2 changes: 1 addition & 1 deletion Dropbox.Api/Files/CommitInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public CommitInfo(string path,
{
throw new sys.ArgumentNullException("path");
}
else if (!re.Regex.IsMatch(path, @"/.*"))
else if (!re.Regex.IsMatch(path, @"\A/.*\z"))
{
throw new sys.ArgumentOutOfRangeException("path");
}
Expand Down
2 changes: 1 addition & 1 deletion Dropbox.Api/Files/CreateFolderArg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public CreateFolderArg(string path)
{
throw new sys.ArgumentNullException("path");
}
else if (!re.Regex.IsMatch(path, @"/.*"))
else if (!re.Regex.IsMatch(path, @"\A/.*\z"))
{
throw new sys.ArgumentOutOfRangeException("path");
}
Expand Down
2 changes: 1 addition & 1 deletion Dropbox.Api/Files/DeleteArg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public DeleteArg(string path)
{
throw new sys.ArgumentNullException("path");
}
else if (!re.Regex.IsMatch(path, @"/.*"))
else if (!re.Regex.IsMatch(path, @"\A/.*\z"))
{
throw new sys.ArgumentOutOfRangeException("path");
}
Expand Down
14 changes: 12 additions & 2 deletions Dropbox.Api/Files/DeletedMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ public class DeletedMetadata : Metadata
/// contains a slash.</param>
/// <param name="pathLower">The lowercased full path in the user's Dropbox. This always
/// starts with a slash.</param>
/// <param name="parentSharedFolderId">Set if this file or folder is contained in a
/// shared folder.</param>
public DeletedMetadata(string name,
string pathLower)
: base(name, pathLower)
string pathLower,
string parentSharedFolderId = null)
: base(name, pathLower, parentSharedFolderId)
{
}

Expand Down Expand Up @@ -69,6 +72,10 @@ public override void EncodeFields(DeletedMetadata value, enc.IJsonWriter writer)
{
WriteProperty("name", value.Name, writer, enc.StringEncoder.Instance);
WriteProperty("path_lower", value.PathLower, writer, enc.StringEncoder.Instance);
if (value.ParentSharedFolderId != null)
{
WriteProperty("parent_shared_folder_id", value.ParentSharedFolderId, writer, enc.StringEncoder.Instance);
}
}
}

Expand Down Expand Up @@ -107,6 +114,9 @@ protected override void SetField(DeletedMetadata value, string fieldName, enc.IJ
case "path_lower":
value.PathLower = enc.StringDecoder.Instance.Decode(reader);
break;
case "parent_shared_folder_id":
value.ParentSharedFolderId = enc.StringDecoder.Instance.Decode(reader);
break;
default:
reader.Skip();
break;
Expand Down
4 changes: 2 additions & 2 deletions Dropbox.Api/Files/DownloadArg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ public DownloadArg(string path,
{
throw new sys.ArgumentNullException("path");
}
else if (!re.Regex.IsMatch(path, @"((/|id:).*)|(rev:[0-9a-f]{9,})"))
else if (!re.Regex.IsMatch(path, @"\A((/|id:).*)|(rev:[0-9a-f]{9,})\z"))
{
throw new sys.ArgumentOutOfRangeException("path");
}

if (rev != null && (rev.Length < 9 || !re.Regex.IsMatch(rev, @"[0-9a-f]+")))
if (rev != null && (rev.Length < 9 || !re.Regex.IsMatch(rev, @"\A[0-9a-f]+\z")))
{
throw new sys.ArgumentOutOfRangeException("rev");
}
Expand Down
14 changes: 12 additions & 2 deletions Dropbox.Api/Files/FileMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public class FileMetadata : Metadata
/// field is the same rev as elsewhere in the API and can be used to detect changes and
/// avoid conflicts.</param>
/// <param name="size">The file size in bytes.</param>
/// <param name="parentSharedFolderId">Set if this file or folder is contained in a
/// shared folder.</param>
/// <param name="id">A unique identifier for the file.</param>
/// <param name="mediaInfo">Additional information if the file is a photo or
/// video.</param>
Expand All @@ -55,15 +57,16 @@ public FileMetadata(string name,
sys.DateTime serverModified,
string rev,
ulong size,
string parentSharedFolderId = null,
string id = null,
MediaInfo mediaInfo = null)
: base(name, pathLower)
: base(name, pathLower, parentSharedFolderId)
{
if (rev == null)
{
throw new sys.ArgumentNullException("rev");
}
else if (rev.Length < 9 || !re.Regex.IsMatch(rev, @"[0-9a-f]+"))
else if (rev.Length < 9 || !re.Regex.IsMatch(rev, @"\A[0-9a-f]+\z"))
{
throw new sys.ArgumentOutOfRangeException("rev");
}
Expand Down Expand Up @@ -146,6 +149,10 @@ public override void EncodeFields(FileMetadata value, enc.IJsonWriter writer)
WriteProperty("server_modified", value.ServerModified, writer, enc.DateTimeEncoder.Instance);
WriteProperty("rev", value.Rev, writer, enc.StringEncoder.Instance);
WriteProperty("size", value.Size, writer, enc.UInt64Encoder.Instance);
if (value.ParentSharedFolderId != null)
{
WriteProperty("parent_shared_folder_id", value.ParentSharedFolderId, writer, enc.StringEncoder.Instance);
}
if (value.Id != null)
{
WriteProperty("id", value.Id, writer, enc.StringEncoder.Instance);
Expand Down Expand Up @@ -204,6 +211,9 @@ protected override void SetField(FileMetadata value, string fieldName, enc.IJson
case "size":
value.Size = enc.UInt64Decoder.Instance.Decode(reader);
break;
case "parent_shared_folder_id":
value.ParentSharedFolderId = enc.StringDecoder.Instance.Decode(reader);
break;
case "id":
value.Id = enc.StringDecoder.Instance.Decode(reader);
break;
Expand Down
Loading

0 comments on commit cac6176

Please sign in to comment.