Exemple #1
0
        /// <summary>
        /// Instantiates a new instance.
        /// </summary>
        /// <param name="apiKey">The API key to use to communicate with the Vultr
        /// API.</param>
        /// <param name="apiURL">The optional Vultr API URL to use. Set this if you want
        /// to override the default endpoint (e.g. for testing).</param>
        /// <exception cref="ArgumentNullException">If <paramref name="apiKey"/> is null
        /// or empty.</exception>
        public VultrClient(string apiKey, string apiURL = VultrApiURL)
        {
            if (string.IsNullOrEmpty(apiKey))
            {
                throw new ArgumentNullException("apiKey", "apiKey must not be null");
            }

            Account         = new AccountClient(apiKey, apiURL);
            Application     = new ApplicationClient(apiKey, apiURL);
            Auth            = new AuthClient(apiKey, apiURL);
            Backup          = new BackupClient(apiKey, apiURL);
            Block           = new BlockClient(apiKey, apiURL);
            DNS             = new DNSClient(apiKey, apiURL);
            Firewall        = new FirewallClient(apiKey, apiURL);
            ISOImage        = new ISOImageClient(apiKey, apiURL);
            Network         = new NetworkClient(apiKey, apiURL);
            OperatingSystem = new OperatingSystemClient(apiKey, apiURL);
            Plan            = new PlanClient(apiKey, apiURL);
            Region          = new RegionClient(apiKey, apiURL);
            ReservedIP      = new ReservedIPClient(apiKey, apiURL);
            Server          = new ServerClient(apiKey, apiURL);
            Snapshot        = new SnapshotClient(apiKey, apiURL);
            SSHKey          = new SSHKeyClient(apiKey, apiURL);
            StartupScript   = new StartupScriptClient(apiKey, apiURL);
            User            = new UserClient(apiKey, apiURL);
        }
        public void OnGetBeaconState()
        {
            // Configure your beacons first! https://developers.google.com/beacons/get-started#2-configure-your-beacons

            var theNamespace = "awareness-api-1534415879510";
            var beaconTypes  = new List <BeaconState.TypeFilter>
            {
                // must be registered on google dashboard https://developers.google.com/beacons/dashboard/
                BeaconState.TypeFilter.With(theNamespace, "string"),
                BeaconState.TypeFilter.With("com.google.nearby", "en"),
                BeaconState.TypeFilter.With(theNamespace, "x")
            };

            SnapshotClient.GetBeaconState(beaconTypes, state =>
            {
                if (state.BeaconInfos.Count == 0)
                {
                    LogSuccess("No beacons found");
                }
                else
                {
                    LogSuccess(state);
                }
            }, LogFailure);
        }
Exemple #3
0
        private void SetupSnapshotClient()
        {
            CleanupSnapshotClient();

            SnapshotClient = new SnapshotClient(new InstanceContext(this));

            SnapshotClient.InnerChannel.Opened  += InnerChannel_Opened;
            SnapshotClient.InnerChannel.Faulted += SnapshotClient_Faulted;
        }
 public void OnGetDetectedActivity()
 {
     SnapshotClient.GetDetectedActivity(result =>
     {
         Debug.Log("Still confidence: " + result.GetActivityConfidence(DetectedActivity.ActivityType.Still));
         Debug.Log("Running confidence: " + result.GetActivityConfidence(DetectedActivity.ActivityType.Running));
         LogSuccess(result);
     }, LogFailure);
 }
Exemple #5
0
 private void CleanupSnapshotClient()
 {
     if (SnapshotClient != null)
     {
         try
         {
             SnapshotClient.InnerChannel.Opened  -= InnerChannel_Opened;
             SnapshotClient.InnerChannel.Faulted -= SnapshotClient_Faulted;
             SnapshotClient.Abort();
             SnapshotClient = null;
         }
         catch (Exception)
         {
         }
     }
 }
Exemple #6
0
        private void SetupSnapshotClient()
        {
            if (SnapshotClient != null)
            {
                try
                {
                    SnapshotClient.InnerChannel.Opened  -= InnerChannel_Opened;
                    SnapshotClient.InnerChannel.Faulted -= SnapshotClient_Faulted;
                    SnapshotClient.Abort();
                    SnapshotClient = null;
                }
                catch (Exception)
                {
                }
            }

            SnapshotClient = new SnapshotClient(new InstanceContext(this));

            SnapshotClient.InnerChannel.Opened  += InnerChannel_Opened;
            SnapshotClient.InnerChannel.Faulted += SnapshotClient_Faulted;
        }
Exemple #7
0
 public SnapshotConverter(PZConverter c)
 {
     this.client = new SnapshotClient(c.client);
     this.input  = c.input;
     this.output = c.output;
 }
 public void OnGetNearbyPlaces()
 {
     SnapshotClient.GetPlaces(places => places.ForEach(LogSuccess), LogFailure);
 }
 public void OnGetTimeIntervals()
 {
     SnapshotClient.GetTimeIntervals(LogSuccess, LogFailure);
 }
 public void OnGetLocation()
 {
     SnapshotClient.GetLocation(location => LogSuccess(location), LogFailure);
 }
 public void OnGetWeather()
 {
     SnapshotClient.GetWeather(LogSuccess, LogFailure);
 }
 public void OnGetHeadphonesState()
 {
     SnapshotClient.GetHeadphoneState(state => LogSuccess(state), LogFailure);
 }