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

Method get_things_board_integration

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

Source from the content-addressed store, hash-verified

641 }
642
643 async fn get_things_board_integration(
644 &self,
645 request: Request<api::GetThingsBoardIntegrationRequest>,
646 ) -> Result<Response<api::GetThingsBoardIntegrationResponse>, Status> {
647 let req = request.get_ref();
648 let app_id = Uuid::from_str(&req.application_id).map_err(|e| e.status())?;
649
650 self.validator
651 .validate(
652 request.extensions(),
653 validator::ValidateApplicationAccess::new(validator::Flag::Read, app_id),
654 )
655 .await?;
656
657 let i = application::get_integration(&app_id, application::IntegrationKind::ThingsBoard)
658 .await
659 .map_err(|e| e.status())?;
660
661 if let application::IntegrationConfiguration::ThingsBoard(conf) = &i.configuration {
662 let mut resp = Response::new(api::GetThingsBoardIntegrationResponse {
663 integration: Some(api::ThingsBoardIntegration {
664 application_id: app_id.to_string(),
665 server: conf.server.clone(),
666 }),
667 });
668 resp.metadata_mut()
669 .insert("x-log-application_id", req.application_id.parse().unwrap());
670
671 Ok(resp)
672 } else {
673 Err(Status::internal(
674 "Integration has no ThingsBoard configuration",
675 ))
676 }
677 }
678
679 async fn update_things_board_integration(
680 &self,

Callers 1

Calls 6

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

Tested by 1