Example #1
0
        public async Task Test(string login, string password)
        {
            await _yandexApi.AuthorizeByLoginAsync(new AuthByLoginRequest
            {
                Login    = login,
                Password = password
            });

            var service = new QuasarService(_yandexApi);

            var devices = await service.GetDevicesAsync();

            var scenarios = await service.GetScenariosAsync();

            var scenario = await service.GetScenarioAsync(scenarios.Scenarios.First().Id);

            var device = await service
                         .GetDeviceAsync(
                devices.AllDevices.First(x => x.Type == "devices.types.smart_speaker.yandex.station")
                .Id);

            await service.AddScenarioAsync(new AddScenarioRequest
            {
                Name     = "Тестирование Колонки",
                Icon     = Icon.Home,
                Triggers = new []
                {
                    new Trigger
                    {
                        Type  = TriggerType.Voice,
                        Value = "Запусти мой тестовый навык",
                    }
                },
                Devices = new[]
                {
                    new ScenarioDevice
                    {
                        Id           = device.Id,
                        Capabilities = new[]
                        {
                            new Capability
                            {
                                Type  = "devices.capabilities.quasar.server_action",
                                State = new CapabilityState
                                {
                                    Instance = "phrase_action",
                                    Value    = "Hello",
                                }
                            }
                        }
                    }
                }
            });

            Assert.NotNull(devices);
        }
Example #2
0
        public async Task AuthorizeByLoginAsync(string login, string password)
        {
            await _yandexApi.AuthorizeByLoginAsync(new AuthByLoginRequest
            {
                Login    = login,
                Password = password
            });

            var isAuthorized = await _yandexApi.IsAuthorizedAsync();

            Assert.True(isAuthorized);
        }