Code Monkey home page Code Monkey logo

dropnetrt's Issues

Upload url for background transfers.

I'm writing app on Windows Phone 8.

I get upload url via UploadUrl method and add it to background transfers. I receive error code 400 when background transfer finish.

And why MakeUploadRequest method don't use filename parameter?

Provide information about Modifier to Metadata

Since July 2014, Dropbox Core API supports Modifier data for files in personal accounts. This is available only to those apps that requested permission for that, but this is a very, very useful feature.

For now, I used the following approach:

  1. own method to obtain metadata
  2. own class with metadata
  3. method:

private async Task GetMetadataEx(string relativePath)
{
string webFilePath = relativePath.Replace("", "/");

        HttpClientHandler handler = new HttpClientHandler();

        // OAuth
        DropNetRT.Authentication.OAuthMessageHandler oauthHandler =
            new DropNetRT.Authentication.OAuthMessageHandler(handler, apiKey, apiSecret, client.UserLogin.Token, client.UserLogin.Secret);

        HttpClient c = new HttpClient(oauthHandler);

        string str = string.Format("https://api.dropbox.com/1/metadata/auto/{0}", webFilePath);

        HttpRequest httpRequest = new HttpRequest(HttpMethod.Get, str);

        // we don't need list
        httpRequest.Parameters.Add(new HttpParameter("list", (object)false));
        //httpRequest.Parameters.Add(new HttpParameter("include_deleted", (object)includeDeleted));

        // we need membership data
        httpRequest.Parameters.Add(new HttpParameter("include_membership", (object)true));

        HttpResponseMessage httpResponseMessage;
        oauthHandler.Authenticate(httpRequest);
        try
        {
            httpResponseMessage = await c.SendAsync(httpRequest);
        }
        catch (Exception exception)
        {
            //throw new DropboxException(exception);

            return null;
        }
        if (httpResponseMessage.StatusCode != HttpStatusCode.OK)
        {
            return null;
            //throw new DropboxException(httpResponseMessage);
        }

        string responseString = await httpResponseMessage.Content.ReadAsStringAsync();


        var metadataEx = JsonConvert.DeserializeObject<DropboxMetadataEx>(responseString);

        return metadataEx;
    }
  1. extended metadata class:

    public class DropboxMetadataEx : DropNetRT.Models.Metadata
    

    {
    [JsonProperty("modifier")]
    public Modifier Modifier
    {
    get;
    set;
    }

    } // class

    public class Modifier
    {
    [JsonProperty("display_name")]
    public string DisplayName { get; set; }
    [JsonProperty("uid")]
    public string Uid { get; set; }
    } // class

Unable to use DropNetRT w/o forking it and updating its references to the latest NuGet packages of Microsoft.Net.Http and Newtonsoft.Json.dll

We use these libraries in other parts of our product, and it seems that w/o forking DropNetRT and changing its NuGet references it is impossible to use DropNetRT in our project.

Is it an expected behavior?

System.IO.FileLoadException: Could not load file or assembly 'System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. 

Here's an example of our error log:

DEBUG   2016-01-14 04:53:47Z EXCEPTION: System.IO.FileLoadException: Could not load file or assembly 'System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at ZU.Apps.Dropbox.DropboxApp.<TrySignIn>d__111.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at ZU.Apps.Dropbox.DropboxApp.TrySignIn(String userToken, String userSecret)
   at ZU.Apps.Dropbox.DropboxApp.TrySignInAsync() in C:\stuff\dev\zu_src\ZU\ZU.Core.Apps.Dropbox\DropboxApp.Internal.cs:line 420
   at ZU.Apps.Dropbox.AppPane.dropboxApp_Loaded(Object sender, RoutedEventArgs e) in C:\stuff\dev\zu_src\ZU\ZU.Core.Apps.Dropbox\AppPane.xaml.cs:line 177
   at ZU.Apps.Dropbox.DropboxApp.Initialize(IAppSettings settings, ISystemInformationModel sim, IAppManager appManager) in C:\stuff\dev\zu_src\ZU\ZU.Core.Apps.Dropbox\DropboxApp.cs:line 555
   at ZU.Apps.Dropbox.DropboxApp.OnConnection(ConnectMode mode) in C:\stuff\dev\zu_src\ZU\ZU.Core.Apps.Dropbox\DropboxApp.ZetApp.cs:line 48
   at SAL.Flatbed.PluginStorage.InitializePlugins()

=== Pre-bind state information ===
LOG: DisplayName = System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 (Fully-specified)
LOG: Appbase = file:///C:/stuff/dev/zu_src/Drops/Latest/
LOG: Initial PrivatePath = NULL
Calling assembly : DropNetRT, Version=1.5.20.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\stuff\dev\zu_src\Drops\Latest\ZetUniverse.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: Attempting download of new URL file:///C:/stuff/dev/zu_src/Drops/Latest/System.Net.Http.Primitives.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Add support for getting oauth2 token

I am trying to use another API in conjunction with DropNetRT and the other API needs the OAuth2 bearer token which can be obtained from the oauth1 token using a simple call (https://www.dropbox.com/developers/core/docs#oa2-from-oa1). For me to make that call requires duplicating functionality that already exists in DropNetClient, but which is made private and inaccessible.

Would be very convenient if this call were added to DropNetClient.

DropNetRT.Models.DeltaPageInternal.Entries seems to be of the wrong type

I'm getting errors using this, and it seems to be due to deserialization issues. This is the response that I get from Dropbox:

{   
    "has_more": true, 
    "cursor": "BLAGHABLAGAbigDarn-StringTHing123", 
    "entries": 
    [
        ["/exampleFile.pdf", {"revision": 1, "rev": "1131aa664", "thumb_exists": false, "bytes": 249159, "modified": "Mon, 12 Aug 2013 18:55:30 +0000", "client_mtime": "Mon, 12 Aug 2013 18:55:30 +0000", "path": \"/exampleFole.pdf\", "is_dir": false, "icon": "page_white_acrobat", "root": "dropbox", "mime_type": "application/pdf", "size": "243.3 KB"}],
        ["/examplefolder", {"revision": 2, "rev": "2131aa664", "thumb_exists": false, "bytes": 0, "modified": "Tue, 13 Aug 2013 17:30:35 +0000", "path": "/examplefolder", "is_dir": true, "icon": "folder_user", "root": "dropbox", "size": "0 bytes"}]
    ], 
    "reset": true
}

And this is the model:

internal class DeltaPageInternal
{
    public string Cursor { get; set; }
    public bool Has_More { get; set; }
    public bool Reset { get; set; }
    public List<List<string>> Entries { get; set; }
}

As you can see, Entries doesn't seem to be a List of Lists of strings.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.