Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added 'delta' feature support [SPRNETSOCIALDB-7]

  • Loading branch information...
commit 53044f12bfaa711d253fad315c88466af0034abc 1 parent c4dfa56
@bbaia bbaia authored
Showing with 569 additions and 1 deletion.
  1. +6 −0 doc/reference/src/api.xml
  2. +1 −1  doc/reference/src/index.xml
  3. +2 −0  examples/Spring.ConsoleQuickStart/src/Spring.ConsoleQuickStart/Program.cs
  4. +77 −0 src/Spring.Social.Dropbox/Social/Dropbox/Api/DeltaEntry.cs
  5. +68 −0 src/Spring.Social.Dropbox/Social/Dropbox/Api/DeltaPage.cs
  6. +68 −0 src/Spring.Social.Dropbox/Social/Dropbox/Api/IDropbox.cs
  7. +96 −0 src/Spring.Social.Dropbox/Social/Dropbox/Api/Impl/DropboxTemplate.cs
  8. +58 −0 src/Spring.Social.Dropbox/Social/Dropbox/Api/Impl/Json/DeltaPageDeserializer.cs
  9. +3 −0  src/Spring.Social.Dropbox/Spring.Social.Dropbox.2008-NET20.csproj
  10. +3 −0  src/Spring.Social.Dropbox/Spring.Social.Dropbox.2008-NET35.csproj
  11. +3 −0  src/Spring.Social.Dropbox/Spring.Social.Dropbox.2010-NET40.csproj
  12. +3 −0  src/Spring.Social.Dropbox/Spring.Social.Dropbox.2010-WP70.csproj
  13. +3 −0  src/Spring.Social.Dropbox/Spring.Social.Dropbox.2010-WP71.csproj
  14. +150 −0 test/Spring.Social.Dropbox.Tests/Social/Dropbox/Api/Impl/Delta.json
  15. +25 −0 test/Spring.Social.Dropbox.Tests/Social/Dropbox/Api/Impl/DropboxTemplateTests.cs
  16. +1 −0  test/Spring.Social.Dropbox.Tests/Spring.Social.Dropbox.Tests.2008-NET20.csproj
  17. +1 −0  test/Spring.Social.Dropbox.Tests/Spring.Social.Dropbox.Tests.2008-NET35.csproj
  18. +1 −0  test/Spring.Social.Dropbox.Tests/Spring.Social.Dropbox.Tests.2010-NET40.csproj
View
6 doc/reference/src/api.xml
@@ -66,7 +66,11 @@ IDropbox dropboxApi = serviceProvider.GetApi(accessToken.Value, accessToken.Secr
Entry Move(string fromPath, string toPath);
+ FileRef CreateFileRef(string path);
+
Entry Copy(string fromPath, string toPath);
+
+ Entry CopyFileRef(string fromFileRef, string toPath);
Entry UploadFile(IResource file, string path);
@@ -76,6 +80,8 @@ IDropbox dropboxApi = serviceProvider.GetApi(accessToken.Value, accessToken.Secr
DropboxFile DownloadFile(string path, string revision);
+ DeltaPage Delta(string cursor);
+
Entry GetMetadata(string path);
Entry GetMetadata(string path, MetadataParameters parameters);
View
2  doc/reference/src/index.xml
@@ -13,7 +13,7 @@
<!-- auto-generated -->
<copyright>Copyright 2012 SpringSource</copyright>
<!-- auto-generated -->
- <pubdate>Last Updated 2/7/2012</pubdate>
+ <pubdate>Last Updated 11/3/2012</pubdate>
<authorgroup>
<author>
<firstname>Bruno</firstname>
View
2  examples/Spring.ConsoleQuickStart/src/Spring.ConsoleQuickStart/Program.cs
@@ -55,6 +55,7 @@ static void Main(string[] args)
// Use step by step debugging, or not
/*
+ DeltaPage deltaPage = dropbox.DeltaAsync(null).Result;
Entry createFolderEntry = dropbox.CreateFolderAsync("Spring Social").Result;
Entry uploadFileEntry = dropbox.UploadFileAsync(
new AssemblyResource("assembly://Spring.ConsoleQuickStart/Spring.ConsoleQuickStart/File.txt"),
@@ -138,6 +139,7 @@ static void Main(string[] args)
// Use step by step debugging, or not
/*
+ DeltaPage deltaPage = dropbox.Delta(null);
Entry createFolderEntry = dropbox.CreateFolder("Spring Social");
Entry uploadFileEntry = dropbox.UploadFile(
new AssemblyResource("assembly://Spring.ConsoleQuickStart/Spring.ConsoleQuickStart/File.txt"),
View
77 src/Spring.Social.Dropbox/Social/Dropbox/Api/DeltaEntry.cs
@@ -0,0 +1,77 @@
+#region License
+
+/*
+ * Copyright 2002-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#endregion
+
+using System;
+
+namespace Spring.Social.Dropbox.Api
+{
+ /// <summary>
+ /// Represents a single entry in a <see cref="DeltaPage">delta page</see>.
+ /// </summary>
+ /// <author>Bruno Baia</author>
+#if !SILVERLIGHT
+ [Serializable]
+#endif
+ public class DeltaEntry
+ {
+ /// <summary>
+ /// Gets or sets the lower-cased path of the entry.
+ /// <para/>
+ /// Value is lower-cased because Dropbox treats file names in a case-insensitive but case-preserving way.
+ /// The Metadata property has the original case-preserved path.
+ /// </summary>
+ public string Path { get; set; }
+
+ /// <summary>
+ /// Gets or sets the <see cref="Entry">metadata information</see> for the entry to update your local state.
+ /// <para/>
+ /// If <see langword="null"/>, it means that this path should not exist on your Dropbox's copy of the file system.
+ /// Otherwise, it means that Dropbox has a file/folder at this path with the given metadata.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If <see langword="null"/>, indicates that there is no file/folder at the given path.
+ /// To update your local state to match, anything at path and all its children should be deleted.
+ /// Deleting a folder in your Dropbox will sometimes send down a single deleted entry for that folder,
+ /// and sometimes separate entries for the folder and all child paths.
+ /// If your local state doesn't have anything at path, ignore this entry.
+ /// </para>
+ /// <para>
+ /// If not <see langword="null"/>, indicates that there is a file/folder at the given path.
+ /// You should add the entry to your local path. To correctly process delta entries:
+ /// <list type="bullet">
+ /// <item>
+ /// If the new entry includes parent folders that don't yet exist in your local state,
+ /// create those parent folders in your local state.
+ /// </item>
+ /// <item>
+ /// If the new entry is a file, replace whatever your local state has at path with the new entry.
+ /// </item>
+ /// <item>
+ /// If the new entry is a folder, check what your local state has at path.
+ /// If it's a file, replace it with the new entry.
+ /// If it's a folder, apply the new entry to the folder, but do not modify the folder's children.
+ /// </item>
+ /// </list>
+ /// </para>
+ /// </remarks>
+ public Entry Metadata { get; set; }
+ }
+}
View
68 src/Spring.Social.Dropbox/Social/Dropbox/Api/DeltaPage.cs
@@ -0,0 +1,68 @@
+#region License
+
+/*
+ * Copyright 2002-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+
+namespace Spring.Social.Dropbox.Api
+{
+ /// <summary>
+ /// Represents a page of delta entries returned by <code>Delta(string cursor)</code> method.
+ /// </summary>
+ /// <author>Bruno Baia</author>
+#if !SILVERLIGHT
+ [Serializable]
+#endif
+ public class DeltaPage
+ {
+ /// <summary>
+ /// Gets or sets a value that encodes the latest information that has been returned.
+ /// It is used to keep track of your current state.
+ /// <para/>
+ /// On the next call to <code>Delta(string cursor)</code> method, pass in this value
+ /// to return delta entries that have been recorded since this cursor was returned.
+ /// </summary>
+ public string Cursor { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether or not more entries are available.
+ /// <para/>
+ /// If <see langword="true"/> you can call <code>Delta(string cursor)</code> method again immediately to retrieve those entries.
+ /// If <see langword="false"/>, then wait for at least five minutes (preferably longer) before checking again.
+ /// </summary>
+ public bool HasMore { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether or not to clear your local state before processing the delta entries.
+ /// <para/>
+ /// Always <see langword="true"/> on the initial call to <code>Delta(string cursor)</code> method (i.e. when no cursor is passed in).
+ /// Otherwise, it is <see langword="true"/> in rare situations, such as after server or account maintenance,
+ /// or if a user deletes their app folder.
+ /// </summary>
+ public bool Reset { get; set; }
+
+ /// <summary>
+ /// Gets or sets the list of <see cref="DeltaEntry">delta entries</see>.
+ /// <para/>
+ /// Apply these entries to your local state to catch up with the Dropbox server's state.
+ /// </summary>
+ public IList<DeltaEntry> Entries { get; set; }
+ }
+}
View
68 src/Spring.Social.Dropbox/Social/Dropbox/Api/IDropbox.cs
@@ -213,6 +213,28 @@ public interface IDropbox : IApiBinding
Task<DropboxFile> DownloadFileAsync(string path, string revision, CancellationToken cancellationToken);
/// <summary>
+ /// Asynchronously keeps up with changes to files and folders in a user's Dropbox.
+ /// <para/>
+ /// You can periodically call this method to get a list of metadatas,
+ /// which are instructions on how to update your local state to match the server's state.
+ /// </summary>
+ /// <param name="cursor">
+ /// A value that is used to keep track of your current state.
+ /// <para/>
+ /// On the first call, you should pass in <see langword="null"/>.
+ /// On subsequent calls, pass in the cursor value returned by the previous call.
+ /// </param>
+ /// <returns>
+ /// A <code>Task</code> that represents the asynchronous operation that can return
+ /// a single <see cref="DeltaPage">delta page</see> of results.
+ /// <para/>
+ /// The <see cref="DeltaPage"/>'s HasMore property will tell you whether the server has more pages of results to return.
+ /// If the server doesn't have more results, wait for at least five minutes (preferably longer) and poll again.
+ /// </returns>
+ /// <exception cref="DropboxApiException">If there is an error while communicating with Dropbox.</exception>
+ Task<DeltaPage> DeltaAsync(string cursor);
+
+ /// <summary>
/// Asynchronously retrieves file or folder metadata.
/// </summary>
/// <param name="path">The Dropbox path to the file or folder, relative to root.</param>
@@ -480,6 +502,27 @@ public interface IDropbox : IApiBinding
DropboxFile DownloadFile(string path, string revision);
/// <summary>
+ /// Keeps up with changes to files and folders in a user's Dropbox.
+ /// <para/>
+ /// You can periodically call this method to get a list of metadatas,
+ /// which are instructions on how to update your local state to match the server's state.
+ /// </summary>
+ /// <param name="cursor">
+ /// A value that is used to keep track of your current state.
+ /// <para/>
+ /// On the first call, you should pass in <see langword="null"/>.
+ /// On subsequent calls, pass in the cursor value returned by the previous call.
+ /// </param>
+ /// <returns>
+ /// A single <see cref="DeltaPage">delta page</see> of results.
+ /// <para/>
+ /// The <see cref="DeltaPage"/>'s HasMore property will tell you whether the server has more pages of results to return.
+ /// If the server doesn't have more results, wait for at least five minutes (preferably longer) and poll again.
+ /// </returns>
+ /// <exception cref="DropboxApiException">If there is an error while communicating with Dropbox.</exception>
+ DeltaPage Delta(string cursor);
+
+ /// <summary>
/// Retrieves file or folder metadata.
/// </summary>
/// <param name="path">The Dropbox path to the file or folder, relative to root.</param>
@@ -787,6 +830,31 @@ public interface IDropbox : IApiBinding
RestOperationCanceler DownloadFileAsync(string path, string revision, Action<RestOperationCompletedEventArgs<DropboxFile>> operationCompleted);
/// <summary>
+ /// Asynchronously keeps up with changes to files and folders in a user's Dropbox.
+ /// <para/>
+ /// You can periodically call this method to get a list of metadatas,
+ /// which are instructions on how to update your local state to match the server's state.
+ /// </summary>
+ /// <param name="cursor">
+ /// A value that is used to keep track of your current state.
+ /// <para/>
+ /// On the first call, you should pass in <see langword="null"/>.
+ /// On subsequent calls, pass in the cursor value returned by the previous call.
+ /// </param>
+ /// <param name="operationCompleted">
+ /// The <code>Action&lt;&gt;</code> to perform when the asynchronous request completes.
+ /// Provides a single <see cref="DeltaPage">delta page</see> of results.
+ /// <para/>
+ /// The <see cref="DeltaPage"/>'s HasMore property will tell you whether the server has more pages of results to return.
+ /// If the server doesn't have more results, wait for at least five minutes (preferably longer) and poll again.
+ /// </param>
+ /// <returns>
+ /// A <see cref="RestOperationCanceler"/> instance that allows to cancel the asynchronous operation.
+ /// </returns>
+ /// <exception cref="DropboxApiException">If there is an error while communicating with Dropbox.</exception>
+ RestOperationCanceler DeltaAsync(string cursor, Action<RestOperationCompletedEventArgs<DeltaPage>> operationCompleted);
+
+ /// <summary>
/// Asynchronously retrieves file or folder metadata.
/// </summary>
/// <param name="path">The Dropbox path to the file or folder, relative to root.</param>
View
96 src/Spring.Social.Dropbox/Social/Dropbox/Api/Impl/DropboxTemplate.cs
@@ -328,6 +328,37 @@ public Task<DropboxFile> DownloadFileAsync(string path, string revision, Cancell
}
/// <summary>
+ /// Asynchronously keeps up with changes to files and folders in a user's Dropbox.
+ /// <para/>
+ /// You can periodically call this method to get a list of metadatas,
+ /// which are instructions on how to update your local state to match the server's state.
+ /// </summary>
+ /// <param name="cursor">
+ /// A value that is used to keep track of your current state.
+ /// <para/>
+ /// On the first call, you should pass in <see langword="null"/>.
+ /// On subsequent calls, pass in the cursor value returned by the previous call.
+ /// </param>
+ /// <returns>
+ /// A <code>Task</code> that represents the asynchronous operation that can return
+ /// a single <see cref="DeltaPage">delta page</see> of results.
+ /// <para/>
+ /// The <see cref="DeltaPage"/>'s HasMore property will tell you whether the server has more pages of results to return.
+ /// If the server doesn't have more results, wait for at least five minutes (preferably longer) and poll again.
+ /// </returns>
+ /// <exception cref="DropboxApiException">If there is an error while communicating with Dropbox.</exception>
+ public Task<DeltaPage> DeltaAsync(string cursor)
+ {
+ NameValueCollection request = new NameValueCollection();
+ if (cursor != null)
+ {
+ request.Add("cursor", cursor);
+ }
+ this.AddLocaleTo(request);
+ return this.RestTemplate.PostForObjectAsync<DeltaPage>("delta/", request);
+ }
+
+ /// <summary>
/// Asynchronously retrieves file or folder metadata.
/// </summary>
/// <param name="path">The Dropbox path to the file or folder, relative to root.</param>
@@ -698,6 +729,36 @@ public DropboxFile DownloadFile(string path, string revision)
}
/// <summary>
+ /// Keeps up with changes to files and folders in a user's Dropbox.
+ /// <para/>
+ /// You can periodically call this method to get a list of metadatas,
+ /// which are instructions on how to update your local state to match the server's state.
+ /// </summary>
+ /// <param name="cursor">
+ /// A value that is used to keep track of your current state.
+ /// <para/>
+ /// On the first call, you should pass in <see langword="null"/>.
+ /// On subsequent calls, pass in the cursor value returned by the previous call.
+ /// </param>
+ /// <returns>
+ /// A single <see cref="DeltaPage">delta page</see> of results.
+ /// <para/>
+ /// The <see cref="DeltaPage"/>'s HasMore property will tell you whether the server has more pages of results to return.
+ /// If the server doesn't have more results, wait for at least five minutes (preferably longer) and poll again.
+ /// </returns>
+ /// <exception cref="DropboxApiException">If there is an error while communicating with Dropbox.</exception>
+ public DeltaPage Delta(string cursor)
+ {
+ NameValueCollection request = new NameValueCollection();
+ if (cursor != null)
+ {
+ request.Add("cursor", cursor);
+ }
+ this.AddLocaleTo(request);
+ return this.RestTemplate.PostForObject<DeltaPage>("delta/", request);
+ }
+
+ /// <summary>
/// Retrieves file or folder metadata.
/// </summary>
/// <param name="path">The Dropbox path to the file or folder, relative to root.</param>
@@ -1113,6 +1174,40 @@ public RestOperationCanceler DownloadFileAsync(string path, string revision, Act
}
/// <summary>
+ /// Asynchronously keeps up with changes to files and folders in a user's Dropbox.
+ /// <para/>
+ /// You can periodically call this method to get a list of metadatas,
+ /// which are instructions on how to update your local state to match the server's state.
+ /// </summary>
+ /// <param name="cursor">
+ /// A value that is used to keep track of your current state.
+ /// <para/>
+ /// On the first call, you should pass in <see langword="null"/>.
+ /// On subsequent calls, pass in the cursor value returned by the previous call.
+ /// </param>
+ /// <param name="operationCompleted">
+ /// The <code>Action&lt;&gt;</code> to perform when the asynchronous request completes.
+ /// Provides a single <see cref="DeltaPage">delta page</see> of results.
+ /// <para/>
+ /// The <see cref="DeltaPage"/>'s HasMore property will tell you whether the server has more pages of results to return.
+ /// If the server doesn't have more results, wait for at least five minutes (preferably longer) and poll again.
+ /// </param>
+ /// <returns>
+ /// A <see cref="RestOperationCanceler"/> instance that allows to cancel the asynchronous operation.
+ /// </returns>
+ /// <exception cref="DropboxApiException">If there is an error while communicating with Dropbox.</exception>
+ public RestOperationCanceler DeltaAsync(string cursor, Action<RestOperationCompletedEventArgs<DeltaPage>> operationCompleted)
+ {
+ NameValueCollection request = new NameValueCollection();
+ if (cursor != null)
+ {
+ request.Add("cursor", cursor);
+ }
+ this.AddLocaleTo(request);
+ return this.RestTemplate.PostForObjectAsync<DeltaPage>("delta/", request, operationCompleted);
+ }
+
+ /// <summary>
/// Asynchronously retrieves file or folder metadata.
/// </summary>
/// <param name="path">The Dropbox path to the file or folder, relative to root.</param>
@@ -1364,6 +1459,7 @@ protected override IList<IHttpMessageConverter> GetMessageConverters()
jsonMapper.RegisterDeserializer(typeof(IList<Entry>), new EntryListDeserializer());
jsonMapper.RegisterDeserializer(typeof(DropboxLink), new DropboxLinkDeserializer());
jsonMapper.RegisterDeserializer(typeof(FileRef), new FileRefDeserializer());
+ jsonMapper.RegisterDeserializer(typeof(DeltaPage), new DeltaPageDeserializer());
IList<IHttpMessageConverter> converters = base.GetMessageConverters();
converters.Add(new ResourceHttpMessageConverter());
View
58 src/Spring.Social.Dropbox/Social/Dropbox/Api/Impl/Json/DeltaPageDeserializer.cs
@@ -0,0 +1,58 @@
+#region License
+
+/*
+ * Copyright 2002-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#endregion
+
+using System.Collections.Generic;
+
+using Spring.Json;
+
+namespace Spring.Social.Dropbox.Api.Impl.Json
+{
+ /// <summary>
+ /// JSON deserializer for delta pages.
+ /// </summary>
+ /// <author>Bruno Baia</author>
+ class DeltaPageDeserializer : IJsonDeserializer
+ {
+ public object Deserialize(JsonValue value, JsonMapper mapper)
+ {
+ DeltaPage deltaPage = new DeltaPage();
+ deltaPage.Cursor = value.GetValue<string>("cursor");
+ deltaPage.HasMore = value.GetValue<bool>("has_more");
+ deltaPage.Reset = value.GetValue<bool>("reset");
+ deltaPage.Entries = new List<DeltaEntry>();
+ JsonValue entriesValue = value.GetValue("entries");
+ if (entriesValue != null)
+ {
+ foreach (JsonValue entryValue in entriesValue.GetValues())
+ {
+ DeltaEntry deltaEntry = new DeltaEntry();
+ deltaEntry.Path = entryValue.GetValue<string>(0);
+ JsonValue metadataValue = entryValue.GetValue(1) as JsonObject;
+ if (metadataValue != null)
+ {
+ deltaEntry.Metadata = mapper.Deserialize<Entry>(metadataValue);
+ }
+ deltaPage.Entries.Add(deltaEntry);
+ }
+ }
+ return deltaPage;
+ }
+ }
+}
View
3  src/Spring.Social.Dropbox/Spring.Social.Dropbox.2008-NET20.csproj
@@ -50,6 +50,8 @@
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Social\Dropbox\Api\AccessLevel.cs" />
+ <Compile Include="Social\Dropbox\Api\DeltaEntry.cs" />
+ <Compile Include="Social\Dropbox\Api\DeltaPage.cs" />
<Compile Include="Social\Dropbox\Api\DropboxApiError.cs" />
<Compile Include="Social\Dropbox\Api\DropboxApiException.cs" />
<Compile Include="Social\Dropbox\Api\DropboxFile.cs" />
@@ -61,6 +63,7 @@
<Compile Include="Social\Dropbox\Api\Impl\DropboxErrorHandler.cs" />
<Compile Include="Social\Dropbox\Api\Impl\DropboxFileHttpMessageConverter.cs" />
<Compile Include="Social\Dropbox\Api\Impl\DropboxTemplate.cs" />
+ <Compile Include="Social\Dropbox\Api\Impl\Json\DeltaPageDeserializer.cs" />
<Compile Include="Social\Dropbox\Api\Impl\Json\DropboxLinkDeserializer.cs" />
<Compile Include="Social\Dropbox\Api\Impl\Json\DropboxProfileDeserializer.cs" />
<Compile Include="Social\Dropbox\Api\Impl\Json\EntryDeserializer.cs" />
View
3  src/Spring.Social.Dropbox/Spring.Social.Dropbox.2008-NET35.csproj
@@ -50,6 +50,8 @@
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Social\Dropbox\Api\AccessLevel.cs" />
+ <Compile Include="Social\Dropbox\Api\DeltaEntry.cs" />
+ <Compile Include="Social\Dropbox\Api\DeltaPage.cs" />
<Compile Include="Social\Dropbox\Api\DropboxApiError.cs" />
<Compile Include="Social\Dropbox\Api\DropboxApiException.cs" />
<Compile Include="Social\Dropbox\Api\DropboxFile.cs" />
@@ -61,6 +63,7 @@
<Compile Include="Social\Dropbox\Api\Impl\DropboxErrorHandler.cs" />
<Compile Include="Social\Dropbox\Api\Impl\DropboxFileHttpMessageConverter.cs" />
<Compile Include="Social\Dropbox\Api\Impl\DropboxTemplate.cs" />
+ <Compile Include="Social\Dropbox\Api\Impl\Json\DeltaPageDeserializer.cs" />
<Compile Include="Social\Dropbox\Api\Impl\Json\DropboxLinkDeserializer.cs" />
<Compile Include="Social\Dropbox\Api\Impl\Json\DropboxProfileDeserializer.cs" />
<Compile Include="Social\Dropbox\Api\Impl\Json\EntryDeserializer.cs" />
View
3  src/Spring.Social.Dropbox/Spring.Social.Dropbox.2010-NET40.csproj
@@ -108,12 +108,15 @@
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Social\Dropbox\Api\AccessLevel.cs" />
+ <Compile Include="Social\Dropbox\Api\DeltaEntry.cs" />
+ <Compile Include="Social\Dropbox\Api\DeltaPage.cs" />
<Compile Include="Social\Dropbox\Api\DropboxFile.cs" />
<Compile Include="Social\Dropbox\Api\DropboxApiError.cs" />
<Compile Include="Social\Dropbox\Api\DropboxApiException.cs" />
<Compile Include="Social\Dropbox\Api\FileRef.cs" />
<Compile Include="Social\Dropbox\Api\Impl\DropboxFileHttpMessageConverter.cs" />
<Compile Include="Social\Dropbox\Api\Impl\DropboxErrorHandler.cs" />
+ <Compile Include="Social\Dropbox\Api\Impl\Json\DeltaPageDeserializer.cs" />
<Compile Include="Social\Dropbox\Api\Impl\Json\FileRefDeserializer.cs" />
<Compile Include="Social\Dropbox\Api\ThumbnailFormat.cs" />
<Compile Include="Social\Dropbox\Api\ThumbnailSize.cs" />
View
3  src/Spring.Social.Dropbox/Spring.Social.Dropbox.2010-WP70.csproj
@@ -59,6 +59,8 @@
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Social\Dropbox\Api\AccessLevel.cs" />
+ <Compile Include="Social\Dropbox\Api\DeltaEntry.cs" />
+ <Compile Include="Social\Dropbox\Api\DeltaPage.cs" />
<Compile Include="Social\Dropbox\Api\DropboxApiError.cs" />
<Compile Include="Social\Dropbox\Api\DropboxApiException.cs" />
<Compile Include="Social\Dropbox\Api\DropboxFile.cs" />
@@ -70,6 +72,7 @@
<Compile Include="Social\Dropbox\Api\Impl\DropboxErrorHandler.cs" />
<Compile Include="Social\Dropbox\Api\Impl\DropboxFileHttpMessageConverter.cs" />
<Compile Include="Social\Dropbox\Api\Impl\DropboxTemplate.cs" />
+ <Compile Include="Social\Dropbox\Api\Impl\Json\DeltaPageDeserializer.cs" />
<Compile Include="Social\Dropbox\Api\Impl\Json\DropboxLinkDeserializer.cs" />
<Compile Include="Social\Dropbox\Api\Impl\Json\DropboxProfileDeserializer.cs" />
<Compile Include="Social\Dropbox\Api\Impl\Json\EntryDeserializer.cs" />
View
3  src/Spring.Social.Dropbox/Spring.Social.Dropbox.2010-WP71.csproj
@@ -59,6 +59,8 @@
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Social\Dropbox\Api\AccessLevel.cs" />
+ <Compile Include="Social\Dropbox\Api\DeltaEntry.cs" />
+ <Compile Include="Social\Dropbox\Api\DeltaPage.cs" />
<Compile Include="Social\Dropbox\Api\DropboxApiError.cs" />
<Compile Include="Social\Dropbox\Api\DropboxApiException.cs" />
<Compile Include="Social\Dropbox\Api\DropboxFile.cs" />
@@ -70,6 +72,7 @@
<Compile Include="Social\Dropbox\Api\Impl\DropboxErrorHandler.cs" />
<Compile Include="Social\Dropbox\Api\Impl\DropboxFileHttpMessageConverter.cs" />
<Compile Include="Social\Dropbox\Api\Impl\DropboxTemplate.cs" />
+ <Compile Include="Social\Dropbox\Api\Impl\Json\DeltaPageDeserializer.cs" />
<Compile Include="Social\Dropbox\Api\Impl\Json\DropboxLinkDeserializer.cs" />
<Compile Include="Social\Dropbox\Api\Impl\Json\DropboxProfileDeserializer.cs" />
<Compile Include="Social\Dropbox\Api\Impl\Json\EntryDeserializer.cs" />
View
150 test/Spring.Social.Dropbox.Tests/Social/Dropbox/Api/Impl/Delta.json
@@ -0,0 +1,150 @@
+{
+ "cursor" : "AuYe6kpu-M6pToHfszmwEtnEuE8Xiz4NqiDs4BKp2w2OeJxj_JqrzMCww5VZ5l8SAwOjGwMDAzMDBAjpF-cmFpWoFeenlSjoKiSlpKQxi_n8YkAAff3EgoJi_eKCosy8dL281BKF4vzkzMQchcLSzOTs4hKgbgUNoBKFtPyclNQiTdb3W-yQtAvoJyVmJiok5-cVl-aUAI1gyWl_D5IAANo_J44",
+ "entries" : [
+ [ "/photos",
+ { "bytes" : 0,
+ "icon" : "folder_photos",
+ "is_dir" : true,
+ "modified" : "Sun, 19 Jun 2011 18:49:20 +0000",
+ "path" : "/Photos",
+ "rev" : "1031cfe62",
+ "revision" : 1,
+ "root" : "dropbox",
+ "size" : "0 bytes",
+ "thumb_exists" : false
+ }
+ ],
+ [ "/public",
+ { "bytes" : 0,
+ "icon" : "folder_public",
+ "is_dir" : true,
+ "modified" : "Sun, 19 Jun 2011 18:49:20 +0000",
+ "path" : "/Public",
+ "rev" : "2031cfe62",
+ "revision" : 2,
+ "root" : "dropbox",
+ "size" : "0 bytes",
+ "thumb_exists" : false
+ }
+ ],
+ [ "/photos/sample album",
+ { "bytes" : 0,
+ "icon" : "folder",
+ "is_dir" : true,
+ "modified" : "Sun, 19 Jun 2011 18:49:20 +0000",
+ "path" : "/Photos/Sample Album",
+ "rev" : "3031cfe62",
+ "revision" : 3,
+ "root" : "dropbox",
+ "size" : "0 bytes",
+ "thumb_exists" : false
+ }
+ ],
+ [ "/photos/sample album/boston city flow.jpg",
+ { "bytes" : 339773,
+ "client_mtime" : "Sun, 19 Jun 2011 18:49:20 +0000",
+ "icon" : "page_white_picture",
+ "is_dir" : false,
+ "mime_type" : "image/jpeg",
+ "modified" : "Sun, 19 Jun 2011 18:49:20 +0000",
+ "path" : "/Photos/Sample Album/Boston City Flow.jpg",
+ "rev" : "4031cfe62",
+ "revision" : 4,
+ "root" : "dropbox",
+ "size" : "331.8 KB",
+ "thumb_exists" : true
+ }
+ ],
+ [ "/photos/sample album/pensive parakeet.jpg",
+ { "bytes" : 480098,
+ "client_mtime" : "Sun, 19 Jun 2011 18:49:20 +0000",
+ "icon" : "page_white_picture",
+ "is_dir" : false,
+ "mime_type" : "image/jpeg",
+ "modified" : "Sun, 19 Jun 2011 18:49:20 +0000",
+ "path" : "/Photos/Sample Album/Pensive Parakeet.jpg",
+ "rev" : "5031cfe62",
+ "revision" : 5,
+ "root" : "dropbox",
+ "size" : "468.8 KB",
+ "thumb_exists" : true
+ }
+ ],
+ [ "/photos/sample album/costa rican frog.jpg",
+ { "bytes" : 354633,
+ "client_mtime" : "Sun, 19 Jun 2011 18:49:20 +0000",
+ "icon" : "page_white_picture",
+ "is_dir" : false,
+ "mime_type" : "image/jpeg",
+ "modified" : "Sun, 19 Jun 2011 18:49:20 +0000",
+ "path" : "/Photos/Sample Album/Costa Rican Frog.jpg",
+ "rev" : "6031cfe62",
+ "revision" : 6,
+ "root" : "dropbox",
+ "size" : "346.3 KB",
+ "thumb_exists" : true
+ }
+ ],
+ [ "/premiers pas.pdf",
+ { "bytes" : 234620,
+ "client_mtime" : "Sun, 19 Jun 2011 18:49:20 +0000",
+ "icon" : "page_white_acrobat",
+ "is_dir" : false,
+ "mime_type" : "application/pdf",
+ "modified" : "Sun, 19 Jun 2011 18:49:20 +0000",
+ "path" : "/Premiers pas.pdf",
+ "rev" : "7031cfe62",
+ "revision" : 7,
+ "root" : "dropbox",
+ "size" : "229.1 KB",
+ "thumb_exists" : false
+ }
+ ],
+ [ "/photos/comment utiliser le dossier photos.rtf",
+ { "bytes" : 6803,
+ "client_mtime" : "Sun, 19 Jun 2011 18:49:20 +0000",
+ "icon" : "page_white_text",
+ "is_dir" : false,
+ "mime_type" : "application/rtf",
+ "modified" : "Sun, 19 Jun 2011 18:49:20 +0000",
+ "path" : "/Photos/Comment utiliser le dossier Photos.rtf",
+ "rev" : "8031cfe62",
+ "revision" : 8,
+ "root" : "dropbox",
+ "size" : "6.6 KB",
+ "thumb_exists" : false
+ }
+ ],
+ [ "/public/comment utiliser le dossier public.rtf",
+ { "bytes" : 7075,
+ "client_mtime" : "Sun, 19 Jun 2011 18:49:20 +0000",
+ "icon" : "page_white_text",
+ "is_dir" : false,
+ "mime_type" : "application/rtf",
+ "modified" : "Sun, 19 Jun 2011 18:49:20 +0000",
+ "path" : "/Public/Comment utiliser le dossier Public.rtf",
+ "rev" : "9031cfe62",
+ "revision" : 9,
+ "root" : "dropbox",
+ "size" : "6.9 KB",
+ "thumb_exists" : false
+ }
+ ],
+ [ "/apps",
+ { "bytes" : 0,
+ "icon" : "folder",
+ "is_dir" : true,
+ "modified" : "Wed, 08 Feb 2012 22:20:08 +0000",
+ "path" : "/Apps",
+ "rev" : "11f031cfe62",
+ "revision" : 287,
+ "root" : "dropbox",
+ "size" : "0 bytes",
+ "thumb_exists" : false
+ }
+ ],
+ [ "/deleted_dir", null ]
+ ],
+ "has_more" : true,
+ "reset" : true
+}
View
25 test/Spring.Social.Dropbox.Tests/Social/Dropbox/Api/Impl/DropboxTemplateTests.cs
@@ -322,6 +322,31 @@ public void DownloadFile()
}
[Test]
+ public void Delta()
+ {
+ mockServer.ExpectNewRequest()
+ .AndExpectUri("https://api.dropbox.com/1/delta/")
+ .AndExpectMethod(HttpMethod.POST)
+ .AndExpectBody("cursor=123azed54")
+ .AndRespondWith(EmbeddedResource("Delta.json"), responseHeaders);
+
+#if NET_4_0 || SILVERLIGHT_5
+ DeltaPage deltaPage = dropbox.DeltaAsync("123azed54").Result;
+#else
+ DeltaPage deltaPage = dropbox.Delta("123azed54");
+#endif
+ Assert.AreEqual("AuYe6kpu-M6pToHfszmwEtnEuE8Xiz4NqiDs4BKp2w2OeJxj_JqrzMCww5VZ5l8SAwOjGwMDAzMDBAjpF-cmFpWoFeenlSjoKiSlpKQxi_n8YkAAff3EgoJi_eKCosy8dL281BKF4vzkzMQchcLSzOTs4hKgbgUNoBKFtPyclNQiTdb3W-yQtAvoJyVmJiok5-cVl-aUAI1gyWl_D5IAANo_J44", deltaPage.Cursor);
+ Assert.AreEqual(true, deltaPage.HasMore);
+ Assert.AreEqual(true, deltaPage.Reset);
+ Assert.AreEqual(11, deltaPage.Entries.Count);
+ Assert.AreEqual("/photos", deltaPage.Entries[0].Path);
+ Assert.IsNotNull(deltaPage.Entries[0].Metadata);
+ Assert.AreEqual("/Photos", deltaPage.Entries[0].Metadata.Path);
+ Assert.AreEqual("/deleted_dir", deltaPage.Entries[10].Path);
+ Assert.IsNull(deltaPage.Entries[10].Metadata);
+ }
+
+ [Test]
public void GetFileMetadata()
{
mockServer.ExpectNewRequest()
View
1  test/Spring.Social.Dropbox.Tests/Spring.Social.Dropbox.Tests.2008-NET20.csproj
@@ -114,6 +114,7 @@
<EmbeddedResource Include="Social\Dropbox\Api\Impl\Revisions.json" />
<EmbeddedResource Include="Social\Dropbox\Api\Impl\Search.json" />
<EmbeddedResource Include="Social\Dropbox\Api\Impl\Copy_Ref.json" />
+ <EmbeddedResource Include="Social\Dropbox\Api\Impl\Delta.json" />
<None Include="Spring.Social.Dropbox.Tests.dll.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
View
1  test/Spring.Social.Dropbox.Tests/Spring.Social.Dropbox.Tests.2008-NET35.csproj
@@ -114,6 +114,7 @@
<EmbeddedResource Include="Social\Dropbox\Api\Impl\Revisions.json" />
<EmbeddedResource Include="Social\Dropbox\Api\Impl\Search.json" />
<EmbeddedResource Include="Social\Dropbox\Api\Impl\Copy_Ref.json" />
+ <EmbeddedResource Include="Social\Dropbox\Api\Impl\Delta.json" />
<None Include="Spring.Social.Dropbox.Tests.dll.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
View
1  test/Spring.Social.Dropbox.Tests/Spring.Social.Dropbox.Tests.2010-NET40.csproj
@@ -132,6 +132,7 @@
<EmbeddedResource Include="Social\Dropbox\Api\Impl\GetShareableLink.json" />
<EmbeddedResource Include="Social\Dropbox\Api\Impl\GetMediaLink.json" />
<EmbeddedResource Include="Social\Dropbox\Api\Impl\Copy_Ref.json" />
+ <EmbeddedResource Include="Social\Dropbox\Api\Impl\Delta.json" />
<None Include="Spring.Social.Dropbox.Tests.dll.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Please sign in to comment.
Something went wrong with that request. Please try again.