コード例 #1
0
        public async Task <List <WebhookSubscription> > GetAllSubscriptionsIfFeaturesGrantedAsync(int?tenantId, string webhookName)
        {
            if (!await _webhookDefinitionManager.IsAvailableAsync(tenantId, webhookName))
            {
                return(new List <WebhookSubscription>());
            }

            return((await WebhookSubscriptionsStore.GetAllSubscriptionsAsync(tenantId, webhookName))
                   .Select(subscriptionInfo => subscriptionInfo.ToWebhookSubscription()).ToList());
        }
コード例 #2
0
        public async Task <ListResultDto <GetAllAvailableWebhooksOutput> > GetAllAvailableWebhooks()
        {
            var webhooks    = _webhookDefinitionManager.GetAll();
            var definitions = new List <GetAllAvailableWebhooksOutput>();

            foreach (var webhookDefinition in webhooks)
            {
                if (await _webhookDefinitionManager.IsAvailableAsync(AbpSession.TenantId, webhookDefinition.Name))
                {
                    definitions.Add(new GetAllAvailableWebhooksOutput()
                    {
                        Name        = webhookDefinition.Name,
                        Description = webhookDefinition.Description?.Localize(_localizationContext),
                        DisplayName = webhookDefinition.DisplayName?.Localize(_localizationContext)
                    });
                }
            }

            return(new ListResultDto <GetAllAvailableWebhooksOutput>(definitions.OrderBy(d => d.Name).ToList()));
        }