Byron / google-apis-rs

A binding and CLI generator for all Google APIs
http://byron.github.io/google-apis-rs
Other
1.03k stars 135 forks source link

Youtube video statistics dont work #180

Closed FliegendeWurst closed 5 years ago

FliegendeWurst commented 7 years ago

Minimal example:

extern crate hyper;
extern crate hyper_native_tls;
extern crate yup_oauth2 as oauth2;
extern crate google_youtube3 as youtube3;
use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, DiskTokenStorage, FlowType};
use youtube3::YouTube;
use hyper::Client;
use hyper::net::HttpsConnector;
use hyper_native_tls::NativeTlsClient;

fn main() {
    // Get an ApplicationSecret instance by some means. It contains the `client_id` and 
    // `client_secret`, among other things.
    let secret: ApplicationSecret = ApplicationSecret {
        client_id: "xxx.apps.googleusercontent.com".to_owned(),
        project_id: Some("xxx".to_owned()),
        auth_uri: "https://accounts.google.com/o/oauth2/auth".to_owned(),
        token_uri: "https://accounts.google.com/o/oauth2/token".to_owned(),
        auth_provider_x509_cert_url: Some("https://www.googleapis.com/oauth2/v1/certs".to_owned()),
        client_secret:"xxx".to_owned(),
        client_email: None,
        client_x509_cert_url: None,
        redirect_uris: vec!["urn:ietf:wg:oauth:2.0:oob".to_owned(), "oob".to_owned(), "http://localhost".to_owned()]
    };
    // Instantiate the authenticator. It will choose a suitable authentication flow for you, 
    // unless you replace  `None` with the desired Flow.
    // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about 
    // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
    // retrieve them from storage.
    let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
        Client::with_connector(HttpsConnector::new(NativeTlsClient::new().unwrap())),
        DiskTokenStorage::new(&"xxx".to_owned()).unwrap(), Some(FlowType::InstalledInteractive));
    let mut hub = YouTube::new(Client::with_connector(HttpsConnector::new(NativeTlsClient::new().unwrap())), auth);
    hub.user_agent("testing/0.0.0".to_owned());

    hub.videos()
        .list("statistics")
        .id("4om1rQKPijI")
        .doit().unwrap();
}

Panic:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: JsonDecodeError("{\n \"kind\": \"youtube#videoListResponse\",\n \"etag\": \"\\\"cbz3lIQ2N25AfwNr-BdxUVxJ_QY/Bnu1FDe1zSk-iAFYG2N-ydiHVIA\\\"\",\n \"pageInfo\": {\n  \"totalResults\": 1,\n  \"resultsPerPage\": 1\n },\n \"items\": [\n  {\n   \"kind\": \"youtube#video\",\n   \"etag\": \"\\\"cbz3lIQ2N25AfwNr-BdxUVxJ_QY/4EBeP_dv8ufXutUJ1FALWls3nuo\\\"\",\n   \"id\": \"4om1rQKPijI\",\n   \"statistics\": {\n    \"viewCount\": \"22994107\",\n    \"likeCount\": \"214236\",\n    \"dislikeCount\": \"4469\",\n    \"favoriteCount\": \"0\",\n    \"commentCount\": \"32125\"\n   }\n  }\n ]\n}\n", ErrorImpl { code: Message("invalid type: string \"22994107\", expected i64"), line: 14, column: 27 })', /checkout/src/libcore/result.rs:906:4
FliegendeWurst commented 6 years ago

I already tried regening the APIs myself, didnt work :(

skyne98 commented 6 years ago

Have the same problem here with Youtube Analytics

JsonDecodeError(
    "{\n \"kind\": \"youtubeAnalytics#resultTable\",\n \"columnHeaders\": [\n  {\n   \"name\": \"30DayTotals\",\n   \"columnType\": \"DIMENSION\",\n   \"dataType\": \"STRING\"\n  },\n  {\n   \"name\": \"views\",\n   \"columnType\": \"METRIC\",\n   \"dataType\": \"INTEGER\"\n  }\n ],\n \"rows\": [\n  [\n   \"2016-05-01\",\n   0.0\n  ],\n  [\n   \"2016-05-02\",\n   0.0\n  ],\n  [\n   \"2016-05-03\",\n   0.0\n  ],\n  [\n   \"2016-05-04\",\n   0.0\n  ],\n  [\n   \"2016-05-05\",\n   0.0\n  ],\n  [\n   \"2016-05-06\",\n   0.0\n  ],\n  [\n   \"2016-05-07\",\n   0.0\n  ],\n  [\n   \"2016-05-08\",\n   0.0\n  ],\n  [\n   \"2016-05-09\",\n   0.0\n  ],\n  [\n   \"2016-05-10\",\n   0.0\n  ],\n  [\n   \"2016-05-11\",\n   0.0\n  ],\n  [\n   \"2016-05-12\",\n   0.0\n  ],\n  [\n   \"2016-05-13\",\n   0.0\n  ],\n  [\n  \"2016-05-14\",\n   0.0\n  ],\n  [\n   \"2016-05-15\",\n   0.0\n  ],\n  [\n   \"2016-05-16\",\n   0.0\n  ],\n  [\n   \"2016-05-17\",\n   0.0\n  ],\n  [\n   \"2016-05-18\",\n   0.0\n  ],\n  [\n   \"2016-05-19\",\n   0.0\n  ],\n  [\n   \"2016-05-20\",\n   0.0\n  ],\n  [\n   \"2016-05-21\",\n   0.0\n  ],\n  [\n   \"2016-05-22\",\n   0.0\n  ],\n  [\n   \"2016-05-23\",\n   0.0\n  ],\n  [\n   \"2016-05-24\",\n   0.0\n  ],\n  [\n   \"2016-05-25\",\n   0.0\n  ],\n  [\n   \"2016-05-26\",\n   0.0\n  ],\n  [\n   \"2016-05-27\",\n   0.0\n  ],\n  [\n   \"2016-05-28\",\n   0.0\n  ],\n  [\n   \"2016-05-29\",\n   0.0\n  ],\n  [\n   \"2016-05-30\",\n   0.0\n  ],\n  [\n   \"2016-05-31\",\n   0.0\n  ],\n  [\n   \"2016-06-01\",\n   0.0\n  ],\n  [\n   \"2016-06-02\",\n   0.0\n  ],\n  [\n   \"2016-06-03\",\n   0.0\n  ],\n  [\n   \"2016-06-04\",\n   0.0\n  ],\n  [\n   \"2016-06-05\",\n   0.0\n  ],\n  [\n   \"2016-06-06\",\n   0.0\n  ],\n  [\n   \"2016-06-07\",\n   0.0\n  ],\n  [\n   \"2016-06-08\",\n   0.0\n  ],\n  [\n \"2016-06-09\",\n   0.0\n  ],\n  [\n   \"2016-06-10\",\n   0.0\n  ],\n  [\n   \"2016-06-11\",\n   0.0\n  ],\n  [\n   \"2016-06-12\",\n   0.0\n  ],\n  [\n   \"2016-06-13\",\n   0.0\n  ],\n  [\n   \"2016-06-14\",\n   0.0\n  ],\n  [\n   \"2016-06-15\",\n   0.0\n  ],\n  [\n   \"2016-06-16\",\n   0.0\n  ],\n  [\n   \"2016-06-17\",\n   0.0\n  ],\n  [\n   \"2016-06-18\",\n   0.0\n  ],\n  [\n   \"2016-06-19\",\n   0.0\n  ],\n  [\n   \"2016-06-20\",\n   0.0\n  ],\n  [\n   \"2016-06-21\",\n   0.0\n  ],\n  [\n   \"2016-06-22\",\n   0.0\n  ],\n  [\n   \"2016-06-23\",\n   0.0\n  ],\n  [\n   \"2016-06-24\",\n   0.0\n  ],\n  [\n   \"2016-06-25\",\n   0.0\n  ],\n  [\n   \"2016-06-26\",\n   0.0\n  ],\n  [\n   \"2016-06-27\",\n   0.0\n  ],\n  [\n   \"2016-06-28\",\n   0.0\n  ],\n  [\n   \"2016-06-29\",\n   0.0\n  ],\n  [\n   \"2016-06-30\",\n   0.0\n  ],\n  [\n   \"2016-07-01\",\n   0.0\n  ],\n  [\n   \"2016-07-02\",\n   0.0\n  ],\n  [\n   \"2016-07-03\",\n   0.0\n  ],\n  [\n   \"2016-07-04\",\n   0.0\n  ],\n  [\n\"2016-07-05\",\n   0.0\n  ],\n  [\n   \"2016-07-06\",\n   0.0\n  ],\n  [\n   \"2016-07-07\",\n   0.0\n  ],\n  [\n   \"2016-07-08\",\n   0.0\n  ],\n  [\n   \"2016-07-09\",\n   0.0\n  ],\n  [\n   \"2016-07-10\",\n   0.0\n  ],\n  [\n   \"2016-07-11\",\n   0.0\n  ],\n  [\n   \"2016-07-12\",\n   0.0\n  ],\n  [\n   \"2016-07-13\",\n   0.0\n  ],\n  [\n   \"2016-07-14\",\n   0.0\n  ],\n  [\n   \"2016-07-15\",\n   0.0\n  ],\n  [\n   \"2016-07-16\",\n   0.0\n  ],\n  [\n   \"2016-07-17\",\n   0.0\n  ],\n  [\n   \"2016-07-18\",\n   0.0\n  ],\n  [\n   \"2016-07-19\",\n   0.0\n  ],\n  [\n   \"2016-07-20\",\n   0.0\n  ],\n  [\n   \"2016-07-21\",\n   0.0\n  ],\n  [\n   \"2016-07-22\",\n   0.0\n  ],\n  [\n   \"2016-07-23\",\n   0.0\n  ],\n  [\n   \"2016-07-24\",\n   0.0\n  ],\n  [\n   \"2016-07-25\",\n   0.0\n  ],\n [\n   \"2016-07-26\",\n   0.0\n  ],\n  [\n   \"2016-07-27\",\n   0.0\n  ],\n  [\n   \"2016-07-28\",\n   0.0\n  ],\n  [\n   \"2016-07-29\",\n   0.0\n  ],\n  [\n   \"2016-07-30\",\n   0.0\n  ],\n  [\n   \"2016-07-31\",\n   0.0\n  ],\n  [\n   \"2016-08-01\",\n   0.0\n  ],\n  [\n   \"2016-08-02\",\n   0.0\n  ],\n  [\n   \"2016-08-03\",\n   0.0\n  ],\n  [\n   \"2016-08-04\",\n   0.0\n  ],\n  [\n   \"2016-08-05\",\n   0.0\n  ],\n  [\n   \"2016-08-06\",\n   0.0\n  ],\n  [\n   \"2016-08-07\",\n   0.0\n  ],\n  [\n   \"2016-08-08\",\n   0.0\n  ],\n  [\n   \"2016-08-09\",\n   0.0\n  ],\n  [\n   \"2016-08-10\",\n   0.0\n  ],\n  [\n   \"2016-08-11\",\n   0.0\n  ],\n  [\n   \"2016-08-12\",\n   0.0\n  ],\n  [\n   \"2016-08-13\",\n   0.0\n  ],\n  [\n   \"2016-08-14\",\n   0.0\n  ],\n  [\n   \"2016-08-15\",\n   0.0\n  ],\n  [\n   \"2016-08-16\",\n   0.0\n  ],\n  [\n   \"2016-08-17\",\n   0.0\n  ],\n  [\n   \"2016-08-18\",\n   0.0\n  ],\n  [\n   \"2016-08-19\",\n   0.0\n  ],\n  [\n   \"2016-08-20\",\n   0.0\n  ],\n[\n   \"2016-08-21\",\n   0.0\n  ],\n  [\n   \"2016-08-22\",\n   0.0\n  ],\n  [\n   \"2016-08-23\",\n   0.0\n  ],\n  [\n   \"2016-08-24\",\n   0.0\n  ],\n  [\n   \"2016-08-25\",\n   0.0\n  ],\n  [\n   \"2016-08-26\",\n   0.0\n  ],\n  [\n   \"2016-08-27\",\n   0.0\n  ],\n  [\n   \"2016-08-28\",\n   0.0\n  ],\n  [\n   \"2016-08-29\",\n   0.0\n  ],\n  [\n   \"2016-08-30\",\n   0.0\n  ],\n  [\n   \"2016-08-31\",\n   0.0\n  ],\n  [\n   \"2016-09-01\",\n   0.0\n  ],\n  [\n   \"2016-09-02\",\n   0.0\n  ],\n  [\n   \"2016-09-03\",\n   0.0\n  ],\n  [\n   \"2016-09-04\",\n   0.0\n  ],\n  [\n   \"2016-09-05\",\n  0.0\n  ],\n  [\n   \"2016-09-06\",\n   0.0\n  ],\n  [\n   \"2016-09-07\",\n   0.0\n  ],\n  [\n   \"2016-09-08\",\n   0.0\n  ],\n  [\n   \"2016-09-09\",\n   0.0\n  ],\n  [\n   \"2016-09-10\",\n   0.0\n ],\n  [\n   \"2016-09-11\",\n   0.0\n  ],\n  [\n   \"2016-09-12\",\n   0.0\n  ],\n  [\n   \"2016-09-13\",\n   0.0\n  ],\n  [\n   \"2016-09-14\",\n   0.0\n  ],\n  [\n   \"2016-09-15\",\n   0.0\n  ],\n  [\n   \"2016-09-16\",\n   0.0\n  ],\n  [\n   \"2016-09-17\",\n   0.0\n  ],\n  [\n   \"2016-09-18\",\n   0.0\n  ],\n  [\n   \"2016-09-19\",\n   0.0\n  ],\n  [\n   \"2016-09-20\",\n   0.0\n  ],\n  [\n   \"2016-09-21\",\n   0.0\n  ],\n  [\n   \"2016-09-22\",\n   0.0\n  ],\n  [\n   \"2016-09-23\",\n   0.0\n  ],\n  [\n   \"2016-09-24\",\n   0.0\n  ],\n  [\n   \"2016-09-25\",\n   0.0\n  ],\n  [\n   \"2016-09-26\",\n   0.0\n  ],\n  [\n   \"2016-09-27\",\n   0.0\n  ],\n  [\n   \"2016-09-28\",\n   0.0\n  ],\n  [\n   \"2016-09-29\",\n   1.0\n  ],\n  [\n   \"2016-09-30\",\n   1.0\n  ],\n  [\n   \"2016-10-01\",\n 1.0\n  ],\n  [\n   \"2016-10-02\",\n   1.0\n  ],\n  [\n   \"2016-10-03\",\n   1.0\n  ],\n  [\n   \"2016-10-04\",\n   1.0\n  ],\n  [\n   \"2016-10-05\",\n   1.0\n  ],\n  [\n   \"2016-10-06\",\n   1.0\n],\n  [\n   \"2016-10-07\",\n   1.0\n  ],\n  [\n   \"2016-10-08\",\n   1.0\n  ],\n  [\n   \"2016-10-09\",\n   1.0\n  ],\n  [\n   \"2016-10-10\",\n   1.0\n  ],\n  [\n   \"2016-10-11\",\n   1.0\n  ],\n  [\n   \"2016-10-12\",\n   1.0\n  ],\n  [\n   \"2016-10-13\",\n   1.0\n  ],\n  [\n   \"2016-10-14\",\n   1.0\n  ],\n  [\n   \"2016-10-15\",\n   1.0\n  ],\n  [\n   \"2016-10-16\",\n   1.0\n  ],\n  [\n   \"2016-10-17\",\n   1.0\n  ],\n  [\n   \"2016-10-18\",\n   1.0\n  ],\n  [\n   \"2016-10-19\",\n   1.0\n  ],\n  [\n   \"2016-10-20\",\n   1.0\n  ],\n  [\n   \"2016-10-21\",\n   1.0\n  ],\n  [\n   \"2016-10-22\",\n   1.0\n  ],\n  [\n   \"2016-10-23\",\n   1.0\n  ],\n  [\n   \"2016-10-24\",\n   1.0\n  ],\n  [\n   \"2016-10-25\",\n   1.0\n  ],\n  [\n   \"2016-10-26\",\n   1.0\n  ],\n  [\n   \"2016-10-27\",\n1.0\n  ],\n  [\n   \"2016-10-28\",\n   1.0\n  ],\n  [\n   \"2016-10-29\",\n   0.0\n  ],\n  [\n   \"2016-10-30\",\n   0.0\n  ],\n  [\n   \"2016-10-31\",\n   0.0\n  ],\n  [\n   \"2016-11-01\",\n   0.0\n  ],\n  [\n   \"2016-11-02\",\n   0.0\n  ],\n  [\n   \"2016-11-03\",\n   0.0\n  ],\n  [\n   \"2016-11-04\",\n   0.0\n  ],\n  [\n   \"2016-11-05\",\n   0.0\n  ],\n  [\n   \"2016-11-06\",\n   0.0\n  ],\n  [\n   \"2016-11-07\",\n   0.0\n  ],\n  [\n   \"2016-11-08\",\n   0.0\n  ],\n  [\n   \"2016-11-09\",\n   0.0\n  ],\n  [\n   \"2016-11-10\",\n   0.0\n  ],\n  [\n   \"2016-11-11\",\n   0.0\n  ],\n  [\n   \"2016-11-12\",\n   0.0\n  ],\n  [\n   \"2016-11-13\",\n   0.0\n  ],\n  [\n   \"2016-11-14\",\n   0.0\n  ],\n  [\n   \"2016-11-15\",\n   0.0\n  ],\n  [\n   \"2016-11-16\",\n   0.0\n  ],\n  [\n   \"2016-11-17\",\n   0.0\n  ],\n  [\n   \"2016-11-18\",\n   0.0\n  ],\n  [\n   \"2016-11-19\",\n   0.0\n  ],\n  [\n   \"2016-11-20\",\n   0.0\n  ],\n  [\n   \"2016-11-21\",\n   0.0\n  ],\n  [\n   \"2016-11-22\",\n   0.0\n  ],\n  [\n   \"2016-11-23\",\n   0.0\n  ],\n  [\n   \"2016-11-24\",\n   0.0\n  ],\n  [\n   \"2016-11-25\",\n   0.0\n  ],\n  [\n   \"2016-11-26\",\n   0.0\n  ],\n  [\n   \"2016-11-27\",\n   0.0\n  ],\n  [\n   \"2016-11-28\",\n   0.0\n  ],\n  [\n   \"2016-11-29\",\n   0.0\n  ],\n  [\n   \"2016-11-30\",\n   0.0\n  ],\n  [\n   \"2016-12-01\",\n   0.0\n  ],\n  [\n   \"2016-12-02\",\n   0.0\n  ],\n  [\n  \"2016-12-03\",\n   0.0\n  ],\n  [\n   \"2016-12-04\",\n   0.0\n  ],\n  [\n   \"2016-12-05\",\n   0.0\n  ],\n  [\n   \"2016-12-06\",\n   0.0\n  ],\n  [\n   \"2016-12-07\",\n   0.0\n  ],\n  [\n   \"2016-12-08\",\n   0.0\n  ],\n  [\n   \"2016-12-09\",\n   0.0\n  ],\n  [\n   \"2016-12-10\",\n   0.0\n  ],\n  [\n   \"2016-12-11\",\n   0.0\n  ],\n  [\n   \"2016-12-12\",\n   0.0\n  ],\n  [\n   \"2016-12-13\",\n   0.0\n  ],\n  [\n   \"2016-12-14\",\n   0.0\n  ],\n  [\n   \"2016-12-15\",\n   0.0\n  ],\n  [\n   \"2016-12-16\",\n   0.0\n  ],\n  [\n   \"2016-12-17\",\n   0.0\n  ],\n  [\n   \"2016-12-18\",\n   0.0\n  ],\n  [\n   \"2016-12-19\",\n   0.0\n  ],\n  [\n   \"2016-12-20\",\n   0.0\n  ],\n  [\n   \"2016-12-21\",\n   0.0\n  ],\n  [\n   \"2016-12-22\",\n   0.0\n  ],\n  [\n   \"2016-12-23\",\n   0.0\n  ],\n  [\n   \"2016-12-24\",\n   0.0\n  ],\n  [\n   \"2016-12-25\",\n   0.0\n  ],\n  [\n   \"2016-12-26\",\n   0.0\n  ],\n  [\n   \"2016-12-27\",\n   0.0\n  ],\n  [\n   \"2016-12-28\",\n   0.0\n  ],\n  [\n \"2016-12-29\",\n   0.0\n  ],\n  [\n   \"2016-12-30\",\n   0.0\n  ],\n  [\n   \"2016-12-31\",\n   0.0\n  ],\n  [\n   \"2017-01-01\",\n   0.0\n  ],\n  [\n   \"2017-01-02\",\n   0.0\n  ],\n  [\n   \"2017-01-03\",\n   0.0\n  ],\n  [\n   \"2017-01-04\",\n   0.0\n  ],\n  [\n   \"2017-01-05\",\n   0.0\n  ],\n  [\n   \"2017-01-06\",\n   0.0\n  ],\n  [\n   \"2017-01-07\",\n   0.0\n  ],\n  [\n   \"2017-01-08\",\n   0.0\n  ],\n  [\n   \"2017-01-09\",\n   0.0\n  ],\n  [\n   \"2017-01-10\",\n   0.0\n  ],\n  [\n   \"2017-01-11\",\n   0.0\n  ],\n  [\n   \"2017-01-12\",\n   0.0\n  ],\n  [\n   \"2017-01-13\",\n   0.0\n  ],\n  [\n   \"2017-01-14\",\n   0.0\n  ],\n  [\n   \"2017-01-15\",\n   0.0\n  ],\n  [\n   \"2017-01-16\",\n   0.0\n  ],\n  [\n   \"2017-01-17\",\n   0.0\n  ],\n  [\n   \"2017-01-18\",\n   0.0\n  ],\n  [\n   \"2017-01-19\",\n   0.0\n  ],\n  [\n   \"2017-01-20\",\n   0.0\n  ],\n  [\n   \"2017-01-21\",\n   0.0\n  ],\n  [\n   \"2017-01-22\",\n   0.0\n  ],\n  [\n   \"2017-01-23\",\n   0.0\n  ],\n  [\n\"2017-01-24\",\n   0.0\n  ],\n  [\n   \"2017-01-25\",\n   0.0\n  ],\n  [\n   \"2017-01-26\",\n   0.0\n  ],\n  [\n   \"2017-01-27\",\n   0.0\n  ],\n  [\n   \"2017-01-28\",\n   0.0\n  ],\n  [\n   \"2017-01-29\",\n   0.0\n  ],\n  [\n   \"2017-01-30\",\n   0.0\n  ],\n  [\n   \"2017-01-31\",\n   0.0\n  ],\n  [\n   \"2017-02-01\",\n   0.0\n  ],\n  [\n   \"2017-02-02\",\n   0.0\n  ],\n  [\n   \"2017-02-03\",\n   0.0\n  ],\n  [\n   \"2017-02-04\",\n   0.0\n  ],\n  [\n   \"2017-02-05\",\n   0.0\n  ],\n  [\n   \"2017-02-06\",\n   0.0\n  ],\n  [\n   \"2017-02-07\",\n   0.0\n  ],\n  [\n   \"2017-02-08\",\n   0.0\n  ],\n  [\n   \"2017-02-09\",\n   0.0\n  ],\n  [\n   \"2017-02-10\",\n   0.0\n  ],\n  [\n   \"2017-02-11\",\n   0.0\n  ],\n  [\n   \"2017-02-12\",\n   0.0\n  ],\n  [\n   \"2017-02-13\",\n   0.0\n  ],\n [\n   \"2017-02-14\",\n   0.0\n  ],\n  [\n   \"2017-02-15\",\n   0.0\n  ],\n  [\n   \"2017-02-16\",\n   0.0\n  ],\n  [\n   \"2017-02-17\",\n   0.0\n  ],\n  [\n   \"2017-02-18\",\n   0.0\n  ],\n  [\n   \"2017-02-19\",\n   0.0\n  ],\n  [\n   \"2017-02-20\",\n   0.0\n  ],\n  [\n   \"2017-02-21\",\n   0.0\n  ],\n  [\n   \"2017-02-22\",\n   0.0\n  ],\n  [\n   \"2017-02-23\",\n   0.0\n  ],\n  [\n   \"2017-02-24\",\n   0.0\n  ],\n  [\n   \"2017-02-25\",\n   0.0\n  ],\n  [\n   \"2017-02-26\",\n   0.0\n  ],\n  [\n   \"2017-02-27\",\n   0.0\n  ],\n  [\n   \"2017-02-28\",\n   0.0\n  ],\n  [\n   \"2017-03-01\",\n   0.0\n  ],\n  [\n   \"2017-03-02\",\n   0.0\n  ],\n  [\n   \"2017-03-03\",\n   0.0\n  ],\n  [\n   \"2017-03-04\",\n   0.0\n  ],\n  [\n   \"2017-03-05\",\n   0.0\n  ],\n  [\n   \"2017-03-06\",\n   0.0\n  ],\n  [\n   \"2017-03-07\",\n   0.0\n  ],\n  [\n   \"2017-03-08\",\n   0.0\n  ],\n  [\n   \"2017-03-09\",\n   0.0\n  ],\n  [\n   \"2017-03-10\",\n   0.0\n  ],\n  [\n   \"2017-03-11\",\n   0.0\n  ],\n[\n   \"2017-03-12\",\n   0.0\n  ],\n  [\n   \"2017-03-13\",\n   0.0\n  ],\n  [\n   \"2017-03-14\",\n   1.0\n  ],\n  [\n   \"2017-03-15\",\n   1.0\n  ],\n  [\n   \"2017-03-16\",\n   1.0\n  ],\n  [\n   \"2017-03-17\",\n   1.0\n  ],\n  [\n   \"2017-03-18\",\n   1.0\n  ],\n  [\n   \"2017-03-19\",\n   1.0\n  ],\n  [\n   \"2017-03-20\",\n   1.0\n  ],\n  [\n   \"2017-03-21\",\n   1.0\n  ],\n  [\n   \"2017-03-22\",\n   1.0\n  ],\n  [\n   \"2017-03-23\",\n   1.0\n  ],\n  [\n   \"2017-03-24\",\n   1.0\n  ],\n  [\n   \"2017-03-25\",\n   1.0\n  ],\n  [\n   \"2017-03-26\",\n   1.0\n  ],\n  [\n   \"2017-03-27\",\n  1.0\n  ],\n  [\n   \"2017-03-28\",\n   1.0\n  ],\n  [\n   \"2017-03-29\",\n   1.0\n  ],\n  [\n   \"2017-03-30\",\n   2.0\n  ],\n  [\n   \"2017-03-31\",\n   2.0\n  ],\n  [\n   \"2017-04-01\",\n   2.0\n ],\n  [\n   \"2017-04-02\",\n   2.0\n  ],\n  [\n   \"2017-04-03\",\n   2.0\n  ],\n  [\n   \"2017-04-04\",\n   2.0\n  ],\n  [\n   \"2017-04-05\",\n   2.0\n  ],\n  [\n   \"2017-04-06\",\n   2.0\n  ],\n  [\n   \"2017-04-07\",\n   2.0\n  ],\n  [\n   \"2017-04-08\",\n   2.0\n  ],\n  [\n   \"2017-04-09\",\n   2.0\n  ],\n  [\n   \"2017-04-10\",\n   2.0\n  ],\n  [\n   \"2017-04-11\",\n   2.0\n  ],\n  [\n   \"2017-04-12\",\n   2.0\n  ],\n  [\n   \"2017-04-13\",\n   1.0\n  ],\n  [\n   \"2017-04-14\",\n   1.0\n  ],\n  [\n   \"2017-04-15\",\n   1.0\n  ],\n  [\n   \"2017-04-16\",\n   1.0\n  ],\n  [\n   \"2017-04-17\",\n   1.0\n  ],\n  [\n   \"2017-04-18\",\n   1.0\n  ],\n  [\n   \"2017-04-19\",\n   1.0\n  ],\n  [\n   \"2017-04-20\",\n   1.0\n  ],\n  [\n   \"2017-04-21\",\n   1.0\n  ],\n  [\n   \"2017-04-22\",\n 1.0\n  ],\n  [\n   \"2017-04-23\",\n   1.0\n  ],\n  [\n   \"2017-04-24\",\n   1.0\n  ],\n  [\n   \"2017-04-25\",\n   1.0\n  ],\n  [\n   \"2017-04-26\",\n   1.0\n  ],\n  [\n   \"2017-04-27\",\n   1.0\n],\n  [\n   \"2017-04-28\",\n   1.0\n  ],\n  [\n   \"2017-04-29\",\n   0.0\n  ],\n  [\n   \"2017-04-30\",\n   0.0\n  ],\n  [\n   \"2017-05-01\",\n   0.0\n  ],\n  [\n   \"2017-05-02\",\n   0.0\n  ],\n  [\n   \"2017-05-03\",\n   0.0\n  ],\n  [\n   \"2017-05-04\",\n   0.0\n  ],\n  [\n   \"2017-05-05\",\n   0.0\n  ],\n  [\n   \"2017-05-06\",\n   0.0\n  ],\n  [\n   \"2017-05-07\",\n   0.0\n  ],\n  [\n   \"2017-05-08\",\n   0.0\n  ],\n  [\n   \"2017-05-09\",\n   0.0\n  ],\n  [\n   \"2017-05-10\",\n   0.0\n  ],\n  [\n   \"2017-05-11\",\n   0.0\n  ],\n  [\n   \"2017-05-12\",\n   0.0\n  ],\n  [\n   \"2017-05-13\",\n   3.0\n  ],\n  [\n   \"2017-05-14\",\n   3.0\n  ],\n  [\n   \"2017-05-15\",\n   3.0\n  ],\n  [\n   \"2017-05-16\",\n   3.0\n  ],\n  [\n   \"2017-05-17\",\n   3.0\n  ],\n  [\n   \"2017-05-18\",\n3.0\n  ],\n  [\n   \"2017-05-19\",\n   3.0\n  ],\n  [\n   \"2017-05-20\",\n   3.0\n  ],\n  [\n   \"2017-05-21\",\n   3.0\n  ],\n  [\n   \"2017-05-22\",\n   3.0\n  ],\n  [\n   \"2017-05-23\",\n   3.0\n  ],\n  [\n   \"2017-05-24\",\n   3.0\n  ],\n  [\n   \"2017-05-25\",\n   3.0\n  ],\n  [\n   \"2017-05-26\",\n   3.0\n  ],\n  [\n   \"2017-05-27\",\n   3.0\n  ],\n  [\n   \"2017-05-28\",\n   3.0\n  ],\n  [\n   \"2017-05-29\",\n   3.0\n  ],\n  [\n   \"2017-05-30\",\n   3.0\n  ],\n  [\n   \"2017-05-31\",\n   3.0\n  ],\n  [\n   \"2017-06-01\",\n   3.0\n  ],\n  [\n   \"2017-06-02\",\n   3.0\n  ],\n  [\n   \"2017-06-03\",\n   3.0\n  ],\n  [\n   \"2017-06-04\",\n   3.0\n  ],\n  [\n   \"2017-06-05\",\n   3.0\n  ],\n  [\n   \"2017-06-06\",\n   3.0\n  ],\n  [\n   \"2017-06-07\",\n   3.0\n  ],\n  [\n   \"2017-06-08\",\n   3.0\n  ],\n  [\n   \"2017-06-09\",\n   3.0\n  ],\n  [\n   \"2017-06-10\",\n   3.0\n  ],\n  [\n   \"2017-06-11\",\n   3.0\n  ],\n  [\n   \"2017-06-12\",\n   0.0\n  ],\n  [\n   \"2017-06-13\",\n   0.0\n  ],\n  [\n   \"2017-06-14\",\n   0.0\n  ],\n  [\n   \"2017-06-15\",\n   0.0\n  ],\n  [\n   \"2017-06-16\",\n   0.0\n  ],\n  [\n   \"2017-06-17\",\n   0.0\n  ],\n  [\n   \"2017-06-18\",\n   0.0\n  ],\n  [\n   \"2017-06-19\",\n   0.0\n  ],\n  [\n   \"2017-06-20\",\n   0.0\n  ],\n  [\n   \"2017-06-21\",\n   0.0\n  ],\n  [\n   \"2017-06-22\",\n   0.0\n  ],\n  [\n   \"2017-06-23\",\n   0.0\n  ],\n  [\n  \"2017-06-24\",\n   0.0\n  ],\n  [\n   \"2017-06-25\",\n   0.0\n  ],\n  [\n   \"2017-06-26\",\n   0.0\n  ],\n  [\n   \"2017-06-27\",\n   0.0\n  ],\n  [\n   \"2017-06-28\",\n   0.0\n  ],\n  [\n   \"2017-06-29\",\n   0.0\n  ],\n  [\n   \"2017-06-30\",\n   0.0\n  ],\n  [\n   \"2017-07-01\",\n   0.0\n  ],\n  [\n   \"2017-07-02\",\n   0.0\n  ],\n  [\n   \"2017-07-03\",\n   0.0\n  ],\n  [\n   \"2017-07-04\",\n   0.0\n  ],\n  [\n   \"2017-07-05\",\n   0.0\n  ],\n  [\n   \"2017-07-06\",\n   0.0\n  ],\n  [\n   \"2017-07-07\",\n   0.0\n  ],\n  [\n   \"2017-07-08\",\n   0.0\n  ],\n  [\n   \"2017-07-09\",\n   0.0\n  ],\n  [\n   \"2017-07-10\",\n   0.0\n  ],\n  [\n   \"2017-07-11\",\n   0.0\n  ],\n  [\n   \"2017-07-12\",\n   0.0\n  ],\n  [\n   \"2017-07-13\",\n   0.0\n  ],\n  [\n   \"2017-07-14\",\n   0.0\n  ],\n  [\n   \"2017-07-15\",\n   0.0\n  ],\n  [\n   \"2017-07-16\",\n   0.0\n  ],\n  [\n   \"2017-07-17\",\n   0.0\n  ],\n  [\n   \"2017-07-18\",\n   0.0\n  ],\n  [\n   \"2017-07-19\",\n   0.0\n  ],\n  [\n \"2017-07-20\",\n   0.0\n  ],\n  [\n   \"2017-07-21\",\n   0.0\n  ],\n  [\n   \"2017-07-22\",\n   0.0\n  ],\n  [\n   \"2017-07-23\",\n   0.0\n  ],\n  [\n   \"2017-07-24\",\n   0.0\n  ],\n  [\n   \"2017-07-25\",\n   0.0\n  ],\n  [\n   \"2017-07-26\",\n   0.0\n  ],\n  [\n   \"2017-07-27\",\n   0.0\n  ],\n  [\n   \"2017-07-28\",\n   0.0\n  ],\n  [\n   \"2017-07-29\",\n   0.0\n  ],\n  [\n   \"2017-07-30\",\n   0.0\n  ],\n  [\n   \"2017-07-31\",\n   0.0\n  ],\n  [\n   \"2017-08-01\",\n   0.0\n  ],\n  [\n   \"2017-08-02\",\n   0.0\n  ],\n  [\n   \"2017-08-03\",\n   0.0\n  ],\n  [\n   \"2017-08-04\",\n   0.0\n  ],\n  [\n   \"2017-08-05\",\n   0.0\n  ],\n  [\n   \"2017-08-06\",\n   0.0\n  ],\n  [\n   \"2017-08-07\",\n   0.0\n  ],\n  [\n   \"2017-08-08\",\n   0.0\n  ],\n  [\n   \"2017-08-09\",\n   0.0\n  ],\n  [\n   \"2017-08-10\",\n   0.0\n  ],\n  [\n   \"2017-08-11\",\n   0.0\n  ],\n  [\n   \"2017-08-12\",\n   0.0\n  ],\n  [\n   \"2017-08-13\",\n   0.0\n  ],\n  [\n   \"2017-08-14\",\n   0.0\n  ],\n  [\n\"2017-08-15\",\n   0.0\n  ],\n  [\n   \"2017-08-16\",\n   0.0\n  ],\n  [\n   \"2017-08-17\",\n   0.0\n  ],\n  [\n   \"2017-08-18\",\n   0.0\n  ],\n  [\n   \"2017-08-19\",\n   0.0\n  ],\n  [\n   \"2017-08-20\",\n   0.0\n  ],\n  [\n   \"2017-08-21\",\n   0.0\n  ],\n  [\n   \"2017-08-22\",\n   0.0\n  ],\n  [\n   \"2017-08-23\",\n   0.0\n  ],\n  [\n   \"2017-08-24\",\n   0.0\n  ],\n  [\n   \"2017-08-25\",\n   0.0\n  ],\n  [\n   \"2017-08-26\",\n   0.0\n  ],\n  [\n   \"2017-08-27\",\n   0.0\n  ],\n  [\n   \"2017-08-28\",\n   0.0\n  ],\n  [\n   \"2017-08-29\",\n   0.0\n  ],\n  [\n   \"2017-08-30\",\n   0.0\n  ],\n  [\n   \"2017-08-31\",\n   0.0\n  ],\n  [\n   \"2017-09-01\",\n   0.0\n  ],\n  [\n   \"2017-09-02\",\n   0.0\n  ],\n  [\n   \"2017-09-03\",\n   0.0\n  ],\n  [\n   \"2017-09-04\",\n   0.0\n  ],\n [\n   \"2017-09-05\",\n   0.0\n  ],\n  [\n   \"2017-09-06\",\n   0.0\n  ],\n  [\n   \"2017-09-07\",\n   0.0\n  ],\n  [\n   \"2017-09-08\",\n   0.0\n  ],\n  [\n   \"2017-09-09\",\n   0.0\n  ],\n  [\n   \"2017-09-10\",\n   0.0\n  ],\n  [\n   \"2017-09-11\",\n   0.0\n  ],\n  [\n   \"2017-09-12\",\n   0.0\n  ],\n  [\n   \"2017-09-13\",\n   0.0\n  ],\n  [\n   \"2017-09-14\",\n   0.0\n  ],\n  [\n   \"2017-09-15\",\n   0.0\n  ],\n  [\n   \"2017-09-16\",\n   0.0\n  ],\n  [\n   \"2017-09-17\",\n   0.0\n  ],\n  [\n   \"2017-09-18\",\n   0.0\n  ],\n  [\n   \"2017-09-19\",\n   0.0\n  ],\n  [\n   \"2017-09-20\",\n   0.0\n  ],\n  [\n   \"2017-09-21\",\n   0.0\n  ],\n  [\n   \"2017-09-22\",\n   0.0\n  ],\n  [\n   \"2017-09-23\",\n   0.0\n  ],\n  [\n   \"2017-09-24\",\n   0.0\n  ],\n  [\n   \"2017-09-25\",\n   0.0\n  ],\n  [\n   \"2017-09-26\",\n   0.0\n  ],\n  [\n   \"2017-09-27\",\n   0.0\n  ],\n  [\n   \"2017-09-28\",\n   0.0\n  ],\n  [\n   \"2017-09-29\",\n   0.0\n  ],\n  [\n   \"2017-09-30\",\n   0.0\n  ],\n[\n   \"2017-10-01\",\n   0.0\n  ],\n  [\n   \"2017-10-02\",\n   0.0\n  ],\n  [\n   \"2017-10-03\",\n   0.0\n  ],\n  [\n   \"2017-10-04\",\n   0.0\n  ],\n  [\n   \"2017-10-05\",\n   0.0\n  ],\n  [\n   \"2017-10-06\",\n   0.0\n  ],\n  [\n   \"2017-10-07\",\n   0.0\n  ],\n  [\n   \"2017-10-08\",\n   0.0\n  ],\n  [\n   \"2017-10-09\",\n   0.0\n  ],\n  [\n   \"2017-10-10\",\n   0.0\n  ],\n  [\n   \"2017-10-11\",\n   0.0\n  ],\n  [\n   \"2017-10-12\",\n   0.0\n  ],\n  [\n   \"2017-10-13\",\n   0.0\n  ],\n  [\n   \"2017-10-14\",\n   0.0\n  ],\n  [\n   \"2017-10-15\",\n   0.0\n  ],\n  [\n   \"2017-10-16\",\n  0.0\n  ],\n  [\n   \"2017-10-17\",\n   0.0\n  ],\n  [\n   \"2017-10-18\",\n   0.0\n  ],\n  [\n   \"2017-10-19\",\n   0.0\n  ],\n  [\n   \"2017-10-20\",\n   0.0\n  ],\n  [\n   \"2017-10-21\",\n   0.0\n ],\n  [\n   \"2017-10-22\",\n   0.0\n  ],\n  [\n   \"2017-10-23\",\n   0.0\n  ],\n  [\n   \"2017-10-24\",\n   0.0\n  ],\n  [\n   \"2017-10-25\",\n   0.0\n  ],\n  [\n   \"2017-10-26\",\n   0.0\n  ],\n  [\n   \"2017-10-27\",\n   0.0\n  ],\n  [\n   \"2017-10-28\",\n   0.0\n  ],\n  [\n   \"2017-10-29\",\n   0.0\n  ],\n  [\n   \"2017-10-30\",\n   0.0\n  ],\n  [\n   \"2017-10-31\",\n   0.0\n  ],\n  [\n   \"2017-11-01\",\n   0.0\n  ],\n  [\n   \"2017-11-02\",\n   0.0\n  ],\n  [\n   \"2017-11-03\",\n   0.0\n  ],\n  [\n   \"2017-11-04\",\n   0.0\n  ],\n  [\n   \"2017-11-05\",\n   0.0\n  ],\n  [\n   \"2017-11-06\",\n   0.0\n  ],\n  [\n   \"2017-11-07\",\n   0.0\n  ],\n  [\n   \"2017-11-08\",\n   0.0\n  ],\n  [\n   \"2017-11-09\",\n   0.0\n  ],\n  [\n   \"2017-11-10\",\n   0.0\n  ],\n  [\n   \"2017-11-11\",\n 0.0\n  ],\n  [\n   \"2017-11-12\",\n   0.0\n  ],\n  [\n   \"2017-11-13\",\n   0.0\n  ],\n  [\n   \"2017-11-14\",\n   0.0\n  ],\n  [\n   \"2017-11-15\",\n   0.0\n  ],\n  [\n   \"2017-11-16\",\n   0.0\n],\n  [\n   \"2017-11-17\",\n   0.0\n  ],\n  [\n   \"2017-11-18\",\n   0.0\n  ],\n  [\n   \"2017-11-19\",\n   0.0\n  ],\n  [\n   \"2017-11-20\",\n   0.0\n  ],\n  [\n   \"2017-11-21\",\n   0.0\n  ],\n  [\n   \"2017-11-22\",\n   0.0\n  ]\n ]\n}\n",
    ErrorImpl {
        code: Message(
            "invalid type: floating point `0`, expected a string"
        ),
        line: 18,
        column: 6
    }
)
FliegendeWurst commented 6 years ago

@Byron please look into this :)

FliegendeWurst commented 6 years ago

I managed to work around the issue by manually using the API

Byron commented 6 years ago

Thanks for the great example! I didn't try to reproduce it yet, and would hope you could try again with the local example you probably already have with a Cargo.toml ready to go with the latest v1.0.7 you find on crates.io. It uses the latest API definition, as of 2017-12-06.

I will see if I can reproduce it soon, as well.

FliegendeWurst commented 6 years ago

It still happens with 1.0.7.

TheBiggerGuy commented 6 years ago

I believe this is also the issue I ran into with the Google Photo API. I have opened to tracking issue #211 to discuss the broader issue outside specific APIs.

kyle-mccarthy commented 5 years ago

This is still broken as of the latest version. The problem is that metrics return numbers, but the QueryResponse expects rows to have type Option<Vec<Vec<String>>>. Perhaps it should just use use Option<Vec<Vec<serde_json::value::Value>>> instead?

Byron commented 5 years ago

I have taken a closer look at this and want to share my findings. First, the source JSON schema definition looks like this (might be truncated, you are looking for VideoStatistics.

Here the copy

        "VideoStatistics": {
            "description": "Statistics about the video, such as the number of times the video was viewed or liked.", 
            "id": "VideoStatistics", 
            "properties": {
                "commentCount": {
                    "description": "The number of comments for the video.", 
                    "format": "uint64", 
                    "type": "string"
                }, 
                "dislikeCount": {
                    "description": "The number of users who have indicated that they disliked the video by giving it a negative rating.", 
                    "format": "uint64", 
                    "type": "string"
                }, 
                "favoriteCount": {
                    "description": "The number of users who currently have the video marked as a favorite video.", 
                    "format": "uint64", 
                    "type": "string"
                }, 
                "likeCount": {
                    "description": "The number of users who have indicated that they liked the video by giving it a positive rating.", 
                    "format": "uint64", 
                    "type": "string"
                }, 
                "viewCount": {
                    "description": "The number of times the video has been viewed.", 
                    "format": "uint64", 
                    "type": "string"
                }
            }, 
            "type": "object"
        }

Usually the type field is used to derive the Rust type. However, thanks to this code there is very special rule that just wants to make it an i64, which in fact should rather be a u64. In any case, this won't work if serde sees a string, which is the error this issue describes. A proof that the corresponding Rust structure indeed runs into this special code path is here, as denoted by the fields being Option<i64>.

I will simply delete this special case and re-publish all changed APIs as a new version.

skyne98 commented 5 years ago

@Byron, ok, thanks!