Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add webhooks function (Http, SlackIncomingWebhook) #259

Merged
merged 3 commits into from
Feb 29, 2024

Conversation

Ari-suhyeon
Copy link
Contributor

@Ari-suhyeon Ari-suhyeon commented Feb 28, 2024

Types of changes

  • type: Bug
  • type: Documentation
  • type: New feature
  • type: Small improvement
  • type: Refactoring
  • type: CI/CD, Github

Which issue/s this PR fixes (#)

#239

How Has This Been Tested?

  • unit test
  • moon run test (expression, cron_expression, wa_logger)

@Ari-suhyeon Ari-suhyeon added this to the v0.2.0 milestone Feb 28, 2024
@Ari-suhyeon Ari-suhyeon self-assigned this Feb 28, 2024
@Ari-suhyeon Ari-suhyeon linked an issue Feb 28, 2024 that may be closed by this pull request
#[serde(default = "default_webhooks_headers")]
pub headers: Option<HashMap<String, String>>,
#[serde(default = "default_webhooks_webhook_url")]
pub webhook_url: Option<String>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge webhook_url with url

#[derive(PartialEq, Clone, Deserialize, Debug)]
pub struct Webhooks {
pub id: String,
pub webhook_type: WebhookType,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignore the upper or the lower cases

pub async fn new(
wave_config: WaveConfig,
shared_data_layer: Arc<DataLayer>,
webhooks: Option<Vec<utils::wave_config::Webhooks>>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the webhooks and reuse the wave_config

let mut app = app::App::new(
wave_config.clone(),
shared_data_layer.clone(),
wave_config.webhooks.clone(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the line

}))
}

pub fn response_for_slack(&self) -> Option<serde_json::Value> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to_slack

pub fail_message: Option<String>,
}
impl WebhookResponse {
pub fn response_for_http(&self) -> Option<serde_json::Value> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to_http

use utils::wave_config::Webhooks;

#[derive(Clone)]
pub struct WebhookResponse {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WebhookResponse => WebhookRequestBody

}
}

pub enum WebhookResponseStatus {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • PlanStatus
  • remove 'pub'

@pueding pueding merged commit 781c5d5 into main Feb 29, 2024
1 check passed
@pueding pueding deleted the 239-webhooks-feature-http-call-slack branch February 29, 2024 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

webhooks feature - http call, slack
2 participants