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

Method get

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

Source from the content-addressed store, hash-verified

63 }
64
65 async fn get(
66 &self,
67 request: Request<api::GetApplicationRequest>,
68 ) -> Result<Response<api::GetApplicationResponse>, Status> {
69 let req = request.get_ref();
70 let app_id = Uuid::from_str(&req.id).map_err(|e| e.status())?;
71
72 self.validator
73 .validate(
74 request.extensions(),
75 validator::ValidateApplicationAccess::new(validator::Flag::Read, app_id),
76 )
77 .await?;
78
79 let a = application::get(&app_id).await.map_err(|e| e.status())?;
80 let measurement_keys = application::get_measurement_keys(&app_id)
81 .await
82 .map_err(|e| e.status())?;
83
84 let mut resp = Response::new(api::GetApplicationResponse {
85 application: Some(api::Application {
86 id: a.id.to_string(),
87 tenant_id: a.tenant_id.to_string(),
88 name: a.name,
89 description: a.description,
90 tags: a.tags.into_hashmap(),
91 }),
92 created_at: Some(helpers::datetime_to_prost_timestamp(&a.created_at)),
93 updated_at: Some(helpers::datetime_to_prost_timestamp(&a.updated_at)),
94 measurement_keys,
95 });
96 resp.metadata_mut()
97 .insert("x-log-application_id", req.id.parse().unwrap());
98
99 Ok(resp)
100 }
101
102 async fn update(
103 &self,

Callers 3

test_applicationFunction · 0.45

Calls 9

get_measurement_keysFunction · 0.85
statusMethod · 0.80
to_stringMethod · 0.80
insertMethod · 0.80
unwrapMethod · 0.80
getFunction · 0.50
validateMethod · 0.45
into_hashmapMethod · 0.45

Tested by 1

test_applicationFunction · 0.36