|
| 1 | +using GoogleApis.Blazor.Auth; |
| 2 | +using GoogleApis.Blazor.Calendar; |
| 3 | +using Microsoft.Extensions.DependencyInjection; |
| 4 | +using Microsoft.Extensions.DependencyInjection.Extensions; |
| 5 | +using System; |
| 6 | +using System.Collections.Generic; |
| 7 | +using System.Linq; |
| 8 | +using System.Text; |
| 9 | +using System.Threading.Tasks; |
| 10 | + |
| 11 | +namespace GoogleApis.Blazor.Extensions |
| 12 | +{ |
| 13 | + /// <summary> |
| 14 | + /// A static class contains codebeam google api services. The lifetime is scoped. |
| 15 | + /// </summary> |
| 16 | + public static class ServiceCollectionExtension |
| 17 | + { |
| 18 | + /// <summary> |
| 19 | + /// Adds all codebeam google services. |
| 20 | + /// </summary> |
| 21 | + /// <param name="services"></param> |
| 22 | + /// <returns></returns> |
| 23 | + public static IServiceCollection AddCodeBeamGoogleApiServices(this IServiceCollection services) |
| 24 | + { |
| 25 | + return services |
| 26 | + .AddCodeBeamGoogleAuthService() |
| 27 | + .AddCodeBeamGoogleCalendarService(); |
| 28 | + } |
| 29 | + |
| 30 | + /// <summary> |
| 31 | + /// Adds codebeam google auth service as scoped. |
| 32 | + /// </summary> |
| 33 | + /// <param name="services"></param> |
| 34 | + /// <returns></returns> |
| 35 | + public static IServiceCollection AddCodeBeamGoogleAuthService(this IServiceCollection services) |
| 36 | + { |
| 37 | + services.TryAddScoped<AuthService>(); |
| 38 | + return services; |
| 39 | + } |
| 40 | + |
| 41 | + /// <summary> |
| 42 | + /// Adds codebeam google calendar service as scoped. |
| 43 | + /// </summary> |
| 44 | + /// <param name="services"></param> |
| 45 | + /// <returns></returns> |
| 46 | + public static IServiceCollection AddCodeBeamGoogleCalendarService(this IServiceCollection services) |
| 47 | + { |
| 48 | + services.TryAddScoped<CalendarService>(); |
| 49 | + return services; |
| 50 | + } |
| 51 | + |
| 52 | + } |
| 53 | +} |
0 commit comments