示例#1
0
        public void Connect(string key)
        {
            if (string.IsNullOrWhiteSpace(key))
            {
                throw new ArgumentNullException(nameof(key));
            }

            _credentialsRepository.SaveIfttt(key);

            if (_deviceRepository.Exists("IFTTT", DeviceCapability.WebService))
            {
                return;
            }

            var iftttService = new Device
            {
                Identifier = Guid.NewGuid(),
                Name       = "IFTTT",
                Capability = DeviceCapability.WebService,
                Type       = DeviceType.Ifttt
            };

            _deviceRepository.Add(iftttService);
        }