Exemplo n.º 1
0
        public VkApi(VkConfig config, string token = null)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            this.config  = config;
            this.version = "5.92";

            SetToken(token);
        }
Exemplo n.º 2
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <FrontConfig>(_configuration.GetSection("frontConfig"));

            var vkConfig = new VkConfig();

            _configuration.GetSection("vkConfig").Bind(vkConfig);
            services.AddSingleton <IVkService, VkService>(x => new VkService(vkConfig));

            var flickrConfig = new FlickrConfig();

            _configuration.GetSection("flickrConfig").Bind(flickrConfig);
            services.AddSingleton <IFlickrService, FlickrService>(x => new FlickrService(flickrConfig));

            services.AddSingleton <IDataService, DataService>();

            services.AddMvc()
            .AddJsonOptions(x => x.UseCamelCasing(true));
        }
Exemplo n.º 3
0
 public VkService(VkConfig config) : base(config)
 {
     _accessToken = config.AccessToken;
     _version     = config.Version;
 }