MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / get_ifttt_integration

Method get_ifttt_integration

chirpstack/src/api/application.rs:1546–1581  ·  view source on GitHub ↗
(
        &self,
        request: Request<api::GetIftttIntegrationRequest>,
    )

Source from the content-addressed store, hash-verified

1544 }
1545
1546 async fn get_ifttt_integration(
1547 &self,
1548 request: Request<api::GetIftttIntegrationRequest>,
1549 ) -> Result<Response<api::GetIftttIntegrationResponse>, Status> {
1550 let req = request.get_ref();
1551 let app_id = Uuid::from_str(&req.application_id).map_err(|e| e.status())?;
1552
1553 self.validator
1554 .validate(
1555 request.extensions(),
1556 validator::ValidateApplicationAccess::new(validator::Flag::Read, app_id),
1557 )
1558 .await?;
1559
1560 let i = application::get_integration(&app_id, application::IntegrationKind::Ifttt)
1561 .await
1562 .map_err(|e| e.status())?;
1563
1564 if let application::IntegrationConfiguration::Ifttt(conf) = &i.configuration {
1565 let mut resp = Response::new(api::GetIftttIntegrationResponse {
1566 integration: Some(api::IftttIntegration {
1567 application_id: app_id.to_string(),
1568 key: conf.key.clone(),
1569 uplink_values: conf.uplink_values.to_vec(),
1570 arbitrary_json: conf.arbitrary_json,
1571 event_prefix: conf.event_prefix.clone(),
1572 }),
1573 });
1574 resp.metadata_mut()
1575 .insert("x-log-application_id", req.application_id.parse().unwrap());
1576
1577 Ok(resp)
1578 } else {
1579 Err(Status::internal("Integration has no Ifttt configuration"))
1580 }
1581 }
1582
1583 async fn update_ifttt_integration(
1584 &self,

Callers 1

test_ifttt_integrationFunction · 0.80

Calls 7

get_integrationFunction · 0.85
statusMethod · 0.80
to_stringMethod · 0.80
insertMethod · 0.80
unwrapMethod · 0.80
validateMethod · 0.45
to_vecMethod · 0.45

Tested by 1

test_ifttt_integrationFunction · 0.64