public async Task <ActionResult> Post(Event eventPayload)
 {
     return(eventPayload switch
     {
         UrlVerification verification => VerificationResponse(verification),
         _ => new OkResult()
     });
Beispiel #2
0
 public async Task <ActionResult> Post(Event eventPayload)
 {
     return(eventPayload switch
     {
         EventCallback callback => await CallbackResponse(callback),
         UrlVerification verification => VerificationResponse(verification),
         _ => new OkResult()
     });
 private void CheckClipBoardForURL()
 {
     if (string.IsNullOrWhiteSpace(textBox1.Text))
     {
         string url = Clipboard.GetText();
         if (UrlVerification.Verify(url))
         {
             textBox1.Text = url;
         }
     }
 }
 private void Button1_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(textBox1.Text))
     {
         if (UrlVerification.Verify(textBox1.Text))
         {
             DialogResult = DialogResult.OK;
             URL          = textBox1.Text;
             Close();
         }
         else
         {
             MessageBox.Show($"URL: {textBox1.Text} is invalid .", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     else
     {
         MessageBox.Show($"URL: {textBox1.Text} is Null or Whitespace .", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Beispiel #5
0
        public async Task <ActionResult> Event([FromBody] Event payload)
        {
            async Task <object> ProcessEventCallBack(EventCallback ec)
            {
                await _slackEventDispatcher.Dispatch(ec.Event);

                return(new object());
            }

            return(Ok(
                       payload switch
            {
                AppRateLimited appRateLimited => throw new NotImplementedException(),
                EventCallback eventCallback => ProcessEventCallBack(eventCallback),
                // EventCallback<TODO> eventCallback1 => throw new NotImplementedException(),
                EventCallbackBase eventCallbackBase => throw new NotImplementedException(),
                UrlVerification urlVerification => new
                {
                    challenge = urlVerification.Challenge
                },
                _ => throw new ArgumentOutOfRangeException(nameof(payload))
            }