Exemple #1
0
        private static bool RunAuthorize(AuthorizeOptions opts)
        {
            var deviceManager = new DeviceManager(Storage, ApiClient);
            var authorizationResponse = deviceManager.Authorize();

            Console.WriteLine("Open the browser and navigate to: {0}?user_code={1}" +
                              "\nWhen asked for the code, enter: {1}", authorizationResponse.verification_url, authorizationResponse.user_code);

            return true;
        }
Exemple #2
0
        private static bool RunQuery(QueryOptions opts)
        {
            var deviceManager = new DeviceManager(Storage, ApiClient);

            var deviceCode = deviceManager.GetDeviceCode();
            if (deviceCode == null)
                return false;

            var data = AuthenticateAndRetrieveData(deviceCode, opts);

            Console.WriteLine(JsonConvert.SerializeObject(opts.OnlyTotals ? data.totalsForAllResults : data, Formatting.Indented));
            return true;
        }