public Task <Response <SendGridResult <List <ApiKey> > > > ApiKeys(ApiKeyListQuery query = null) { return(_context.ApiKeys(query?.Limit)); }
public async Task <IResult <List <SubUser> > > Execute() { var subUserListResult = await QueryProcessor.Process <SubUser, ISubUserListQuery, SubUserListQuery>(this, context => context.SubUsers(this)); if (subUserListResult.IsSuccess && subUserListResult.Data.Any()) { foreach (var subUser in subUserListResult.Data) { if (ReputationListQuery != null) { ReputationListQuery .UseContextOption(ContextOptionAction) .AddSubUser(subUser.UserName); var reputationResult = await ReputationListQuery.Execute(); if (reputationResult.IsSuccess) { subUser.Reputations = reputationResult.Data; } } if (MonitorSettingSingleQuery != null) { MonitorSettingSingleQuery .BySubUserName(subUser.UserName) .UseContextOption(ContextOptionAction); var monitorSettingResult = await MonitorSettingSingleQuery.Execute(); if (monitorSettingResult.IsSuccess) { subUser.MonitorSetting = monitorSettingResult.Data; } } Action <IContextOption> contextOption = option => option .OnBehalfOfSubUser(subUser.UserName) .UseApiKey(ContextOption?.ApiKey ?? _defaultApiKey); if (BlockedEmailAddressListQuery != null) { BlockedEmailAddressListQuery.UseContextOption(contextOption); var blockedEmailAddressListResult = await BlockedEmailAddressListQuery.Execute(); if (blockedEmailAddressListResult.IsSuccess) { subUser.BlockedEmailReports = blockedEmailAddressListResult.Data; } } if (BouncedEmailAddressListQuery != null) { BouncedEmailAddressListQuery.UseContextOption(contextOption); var blockedEmailAddressListResult = await BouncedEmailAddressListQuery.Execute(); if (blockedEmailAddressListResult.IsSuccess) { subUser.BlockedEmailReports = blockedEmailAddressListResult.Data; } } if (InvalidEmailAddressListQuery != null) { InvalidEmailAddressListQuery.UseContextOption(contextOption); var invalidEmailAddressListQuery = await InvalidEmailAddressListQuery.Execute(); if (invalidEmailAddressListQuery.IsSuccess) { subUser.InvalidEmailReports = invalidEmailAddressListQuery.Data; } } if (SpamReportedEmailAddressListQuery != null) { SpamReportedEmailAddressListQuery.UseContextOption(contextOption); var spamReportedEmailAddressListQuery = await SpamReportedEmailAddressListQuery.Execute(); if (spamReportedEmailAddressListQuery.IsSuccess) { subUser.SpamReportedEmails = spamReportedEmailAddressListQuery.Data; } } if (AlertListQuery != null) { AlertListQuery.UseContextOption(contextOption); var alertListQuery = await AlertListQuery.Execute(); if (alertListQuery.IsSuccess) { subUser.Alerts = alertListQuery.Data; } } if (ApiKeyListQuery != null) { ApiKeyListQuery.UseContextOption(contextOption); var apiKeyListQuery = await ApiKeyListQuery.Execute(); if (apiKeyListQuery.IsSuccess) { subUser.ApiKeys = apiKeyListQuery.Data; } } } } return(subUserListResult); }