Пример #1
0
 public TwitterTriggerBinding(ParameterInfo parameter, ILogger logger)
 {
     _parameter       = parameter;
     _logger          = logger;
     _attribute       = parameter.GetCustomAttribute <TwitterTriggerAttribute>(inherit: false);
     _bindingContract = CreateBindingContract();
 }
Пример #2
0
        public Task <ITriggerBinding> TryCreateAsync(TriggerBindingProviderContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            //Retrieve Parameter
            ParameterInfo           parameter = context.Parameter;
            TwitterTriggerAttribute attribute = parameter.GetCustomAttribute <TwitterTriggerAttribute>(inherit: false);

            if (attribute == null)
            {
                return(Task.FromResult <ITriggerBinding>(null));
            }

            //Validate Trigger
            if (!IsSupportedBindingType(parameter.ParameterType))
            {
                throw new InvalidOperationException($"Can't bind TwitterTriggerAttribute to type '{parameter.ParameterType}'");
            }

            return(Task.FromResult <ITriggerBinding>(new TwitterTriggerBinding(parameter, _logger)));
        }
Пример #3
0
 public TwitterListener(ITriggeredFunctionExecutor executor, TwitterTriggerAttribute attribute)
 {
     Executor   = executor ?? throw new ArgumentNullException(nameof(executor));
     _attribute = attribute ?? throw new ArgumentNullException(nameof(attribute));
 }