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

Method list_regions

chirpstack/src/api/internal.rs:909–940  ·  view source on GitHub ↗
(
        &self,
        request: Request<()>,
    )

Source from the content-addressed store, hash-verified

907 }
908
909 async fn list_regions(
910 &self,
911 request: Request<()>,
912 ) -> Result<Response<api::ListRegionsResponse>, Status> {
913 self.validator
914 .validate(request.extensions(), validator::ValidateActiveUser::new())
915 .await?;
916
917 let conf = config::get();
918
919 let mut out: api::ListRegionsResponse = Default::default();
920
921 for region_config in &conf.regions {
922 // Check if region is enabled.
923 if !conf.network.enabled_regions.contains(&region_config.id) {
924 continue;
925 }
926
927 out.regions.push(api::RegionListItem {
928 id: region_config.id.clone(),
929 description: if region_config.description.is_empty() {
930 region_config.id.clone()
931 } else {
932 region_config.description.clone()
933 },
934 region: region_config.common_name.to_proto().into(),
935 });
936 }
937
938 out.regions.sort_by(|a, b| a.id.cmp(&b.id));
939 Ok(Response::new(out))
940 }
941
942 async fn get_region(
943 &self,

Callers

nothing calls this directly

Calls 6

containsMethod · 0.80
pushMethod · 0.80
to_protoMethod · 0.80
getFunction · 0.50
validateMethod · 0.45
intoMethod · 0.45

Tested by

no test coverage detected