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

Method get_vendor

chirpstack/src/api/device_profile.rs:721–760  ·  view source on GitHub ↗
(
        &self,
        request: Request<api::GetDeviceProfileVendorRequest>,
    )

Source from the content-addressed store, hash-verified

719 }
720
721 async fn get_vendor(
722 &self,
723 request: Request<api::GetDeviceProfileVendorRequest>,
724 ) -> Result<Response<api::GetDeviceProfileVendorResponse>, Status> {
725 let req = request.get_ref();
726 let vendor_id = Uuid::from_str(&req.id).map_err(|e| e.status())?;
727
728 self.validator
729 .validate(
730 request.extensions(),
731 validator::ValidateDeviceProfileVendorAccess::new(validator::Flag::Read),
732 )
733 .await?;
734
735 let v = device_profile::get_vendor(vendor_id)
736 .await
737 .map_err(|e| e.status())?;
738
739 let mut resp = Response::new(api::GetDeviceProfileVendorResponse {
740 vendor: Some(api::DeviceProfileVendor {
741 id: v.id.to_string(),
742 name: v.name.clone(),
743 vendor_id: v.vendor_id as u32,
744 ouis: v
745 .ouis
746 .iter()
747 .cloned()
748 .map(|v| v.unwrap_or_default())
749 .collect(),
750 metadata: v.metadata.into_hashmap(),
751 }),
752 created_at: Some(helpers::datetime_to_prost_timestamp(&v.created_at)),
753 updated_at: Some(helpers::datetime_to_prost_timestamp(&v.updated_at)),
754 });
755
756 resp.metadata_mut()
757 .insert("x-log-vendor_id", req.id.parse().unwrap());
758
759 Ok(resp)
760 }
761
762 async fn delete_vendor(
763 &self,

Callers 1

test_device_profileFunction · 0.80

Calls 9

get_vendorFunction · 0.85
statusMethod · 0.80
to_stringMethod · 0.80
iterMethod · 0.80
insertMethod · 0.80
unwrapMethod · 0.80
validateMethod · 0.45
into_hashmapMethod · 0.45

Tested by 1

test_device_profileFunction · 0.64