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

Method list_vendors

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

Source from the content-addressed store, hash-verified

678 }
679
680 async fn list_vendors(
681 &self,
682 request: Request<api::ListDeviceProfileVendorsRequest>,
683 ) -> Result<Response<api::ListDeviceProfileVendorsResponse>, Status> {
684 let req = request.get_ref();
685
686 self.validator
687 .validate(
688 request.extensions(),
689 validator::ValidateDeviceProfileVendorsAccess::new(validator::Flag::List),
690 )
691 .await?;
692
693 let count = device_profile::get_vendor_count()
694 .await
695 .map_err(|e| e.status())?;
696 let items = device_profile::list_vendors(req.limit as i64, req.offset as i64)
697 .await
698 .map_err(|e| e.status())?;
699
700 Ok(Response::new(api::ListDeviceProfileVendorsResponse {
701 total_count: count as u32,
702 result: items
703 .iter()
704 .map(|v| api::DeviceProfileVendorListItem {
705 id: v.id.to_string(),
706 created_at: Some(helpers::datetime_to_prost_timestamp(&v.created_at)),
707 updated_at: Some(helpers::datetime_to_prost_timestamp(&v.updated_at)),
708 name: v.name.clone(),
709 vendor_id: v.vendor_id as u32,
710 ouis: v
711 .ouis
712 .iter()
713 .map(|v| v.clone().unwrap_or_default())
714 .collect(),
715 metadata: v.metadata.into_hashmap(),
716 })
717 .collect(),
718 }))
719 }
720
721 async fn get_vendor(
722 &self,

Callers 1

test_device_profileFunction · 0.80

Calls 8

get_vendor_countFunction · 0.85
list_vendorsFunction · 0.85
statusMethod · 0.80
iterMethod · 0.80
to_stringMethod · 0.80
validateMethod · 0.45
into_hashmapMethod · 0.45

Tested by 1

test_device_profileFunction · 0.64