public NotifoService(IOptions <NotifoOptions> options, IUrlGenerator urlGenerator, IUserResolver userResolver, IClock clock) { Guard.NotNull(options, nameof(options)); Guard.NotNull(urlGenerator, nameof(urlGenerator)); Guard.NotNull(userResolver, nameof(userResolver)); Guard.NotNull(clock, nameof(clock)); this.options = options.Value; this.urlGenerator = urlGenerator; this.userResolver = userResolver; this.clock = clock; if (options.Value.IsConfigured()) { var builder = NotifoClientBuilder.Create() .SetApiKey(options.Value.ApiKey); if (!string.IsNullOrWhiteSpace(options.Value.ApiUrl)) { builder = builder.SetApiUrl(options.Value.ApiUrl); } client = builder.Build(); } }
public NotifoService(IOptions <NotifoOptions> options, IUrlGenerator urlGenerator, IUserResolver userResolver, ILogger <NotifoService> log, IClock clock) { this.options = options.Value; this.urlGenerator = urlGenerator; this.userResolver = userResolver; this.clock = clock; this.log = log; if (options.Value.IsConfigured()) { var builder = NotifoClientBuilder.Create() .SetApiKey(options.Value.ApiKey); if (!string.IsNullOrWhiteSpace(options.Value.ApiUrl)) { builder = builder.SetApiUrl(options.Value.ApiUrl); } if (options.Value.Debug) { builder = builder.ReadResponseAsString(true); } client = builder.Build(); } }
public INotifoClient CreateUserClient(UserDto user) { var userClient = NotifoClientBuilder.Create() .ReadResponseAsString(true) .SetApiKey(user.ApiKey) .SetApiUrl(ServerUrl) .SetTimeout(Timeout()) .Build(); return(userClient); }
public ClientManagerWrapper() { AppName = TestHelpers.GetAndPrintValue("config:app:name", "integration-tests"); ClientId = TestHelpers.GetAndPrintValue("config:client:id", "root"); ClientSecret = TestHelpers.GetAndPrintValue("config:client:secret", "xeLd6jFxqbXJrfmNLlO2j1apagGGGSyZJhFnIuHp4I0="); ServerUrl = TestHelpers.GetAndPrintValue("config:server:url", "https://localhost:5002"); Client = NotifoClientBuilder.Create() .ReadResponseAsString(true) .SetClientId(ClientId) .SetClientSecret(ClientSecret) .SetApiUrl(ServerUrl) .SetTimeout(Timeout()) .Build(); }
public Task InitializeAsync(CancellationToken ct = default) { if (options.IsConfigured()) { var builder = NotifoClientBuilder.Create() .SetApiKey(options.ApiKey); if (!string.IsNullOrWhiteSpace(options.ApiUrl)) { builder = builder.SetApiUrl(options.ApiUrl); } client = builder.Build(); } return(Task.CompletedTask); }
public static async Task Main(string[] args) { var client = NotifoClientBuilder.Create() .SetApiKey(ApiKey) .SetApiUrl("https://*****:*****@squidex.io", Id = userId }; await client.Users.PostUsersAsync(AppId, new UpsertUsersDto { Requests = new List <UpsertUserDto> { request }, }); } Console.WriteLine("Generated Users..."); } if (args?.Contains("--subscriptions") == true) { Console.WriteLine("Generating Subscriptions..."); foreach (var userId in users) { var request = new SubscribeDto { TopicPrefix = TopicPrefix }; await client.Users.PostSubscriptionAsync(AppId, userId, request); } Console.WriteLine("Generated Subscriptions..."); } if (args?.Contains("--no-events") != true) { Console.WriteLine("Generating Events..."); for (var i = 0; i < 1; i++) { var request = new PublishRequestDto { Topic = Topic }; var formatting = new NotificationFormattingDto { Body = new LocalizedText { ["en"] = "Hello Body {{var}}", ["de"] = "Hallo Body {{var}}" }, Subject = new LocalizedText { ["en"] = "Hello Title {{var}}", ["de"] = "Hallo Title {{var}}" }, }; request.Properties = new EventProperties { ["var"] = "123" }; request.Preformatted = formatting; await client.Events.PostEventsAsync(AppId, new PublishManyRequestDto { Requests = new List <PublishRequestDto> { request } }); } Console.WriteLine("Generated Events..."); } }