Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

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 requested a review from pueding February 28, 2024 08:36
@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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

webhooks feature - http call, slack
2 participants