Esempio n. 1
0
 public VkontakteClient(
     IFlightsConfiguration flightsConfiguration,
     ILogger <VkApi> log = null
     )
 {
     client = new Lazy <Task <VkApi> >(() => CreateClientAsync(flightsConfiguration.VkApplicationId, flightsConfiguration.VkAccessToken, log));
 }
Esempio n. 2
0
 public TelegramNotificationSender(
     IFlightsConfiguration configuration
     )
 {
     sended    = new List <FlightNews>();
     botClient = new TelegramBotClient(configuration.TelegramBotToken);
 }
Esempio n. 3
0
 public LastNewsMenuCommand(
     IFlightsConfiguration configuration,
     ITelegramClient telegramClient
     )
 {
     this.configuration  = configuration;
     this.telegramClient = telegramClient;
 }
 public SetUpSearchMenuCommand(
     ITelegramClient telegramClient,
     IFlightsConfiguration configuration
     )
 {
     this.telegramClient = telegramClient;
     this.configuration  = configuration;
 }
Esempio n. 5
0
 public TelegramClient(
     IFlightsConfiguration configuration,
     ILogger logger
     )
 {
     this.logger       = logger;
     telegramBotClient = new TelegramBotClient(configuration.TelegramBotToken);
 }
        public static async Task <CloudTable> GetAzureTableAsync(this IFlightsConfiguration flightsConfiguration, string tableName)
        {
            var storageAccount = CloudStorageAccount.Parse(flightsConfiguration.AzureTableConnectionString);
            var tableClient    = storageAccount.CreateCloudTableClient();
            var table          = tableClient.GetTableReference(tableName);
            await table.CreateIfNotExistsAsync();

            return(table);
        }
 public CommandParser(
     IFlightsConfiguration configuration,
     ILogger log,
     ICommandFactory commandFactory
     )
 {
     this.configuration  = configuration;
     this.log            = log;
     this.commandFactory = commandFactory;
 }
Esempio n. 8
0
        public FlightsFunctions(
            IFlightsConfiguration flightsConfiguration
            )
        {
            this.flightsConfiguration = flightsConfiguration;
            this.client = new RestClient(flightsConfiguration.AzureFunctionsUrl);

            //note: https://bytefish.de/blog/restsharp_custom_json_serializer/
            client.AddHandler("application/json", Serializer.Instance);
            client.AddHandler("text/json", Serializer.Instance);
            client.AddHandler("text/x-json", Serializer.Instance);
            client.AddHandler("text/javascript", Serializer.Instance);
            client.AddHandler("*+json", Serializer.Instance);
        }
Esempio n. 9
0
 public CommandFactory(
     IFlightsConfiguration configuration,
     ITelegramClient telegramClient,
     INotifier notifier,
     ITimeline[] timelines,
     ILogger log,
     ISubscriberStorage subscriberStorage
     )
 {
     this.configuration     = configuration;
     this.telegramClient    = telegramClient;
     this.notifier          = notifier;
     this.timelines         = timelines;
     this.log               = log;
     this.subscriberStorage = subscriberStorage;
 }
Esempio n. 10
0
 public LastNewsCommand(
     int lastNewsDays,
     IFlightsConfiguration configuration,
     ITelegramClient telegramClient,
     INotifier notifier,
     ITimeline[] timelines,
     ILogger log
     )
 {
     this.lastNewsDays   = lastNewsDays;
     this.configuration  = configuration;
     this.telegramClient = telegramClient;
     this.notifier       = notifier;
     this.timelines      = timelines;
     this.log            = log;
 }
Esempio n. 11
0
 public SubscriberStorage(IFlightsConfiguration flightsConfiguration)
 {
     subscribersTable = flightsConfiguration.GetAzureTableAsync("Subscribers").Result;
 }
 public AzureTableOffsetStorage(IFlightsConfiguration flightsConfiguration)
 {
     offsetsTable = flightsConfiguration.GetAzureTableAsync("Offsets").Result;
 }
 public AzureTableFlightNewsStorage(IFlightsConfiguration flightsConfiguration)
 {
     flightNewsTable = flightsConfiguration.GetAzureTableAsync("FlightNews").Result;
 }