Exemple #1
0
        /// <summary>
        /// Configures the <see cref="IServiceCollection"/> to use.
        /// </summary>
        /// <param name="services">The service collection to configure.</param>
        protected virtual void ConfigureServices(IServiceCollection services)
        {
            services.AddLogging((builder) =>
            {
                var options = new LambdaLoggerOptions()
                {
                    Filter = FilterLogs,
                };

                builder.AddLambdaLogger(options);
            });

            services.AddHttpClients();
            services.AddPolly();

            services.TryAddSingleton((_) => SkillConfiguration.CreateDefaultConfiguration());

            services.AddSingleton <AlexaSkill>();
            services.AddSingleton <FunctionHandler>();
            services.AddSingleton <IntentFactory>();
            services.AddSingleton((_) => TelemetryConfiguration.CreateDefault());
            services.AddSingleton(CreateTelemetryClient);

            services.AddSingleton <EmptyIntent>();
            services.AddSingleton <HelpIntent>();
            services.AddSingleton <UnknownIntent>();

            services.AddTransient <CommuteIntent>();
            services.AddTransient <DisruptionIntent>();
            services.AddTransient <StatusIntent>();
        }
Exemple #2
0
        protected virtual SkillConfiguration CreateConfiguration()
        {
            var config = SkillConfiguration.CreateDefaultConfiguration();

            config.ApplicationInsightsKey = "my-application-insights-key";
            config.SkillApiUrl            = "https://londontravel.martincostello.local/";
            config.SkillId           = "my-skill-id";
            config.TflApplicationId  = "my-tfl-app-id";
            config.TflApplicationKey = "my-tfl-app-key";
            config.VerifySkillId     = true;

            return(config);
        }