pub struct PersonsDevicesResource<'a> { /* private fields */ }Expand description
client.persons().devices()
Implementations§
Source§impl<'a> PersonsDevicesResource<'a>
impl<'a> PersonsDevicesResource<'a>
Sourcepub fn delete(
&self,
person_id: impl Display,
device_id: impl Display,
) -> Result<()>
pub fn delete( &self, person_id: impl Display, device_id: impl Display, ) -> Result<()>
Delete device for person
DELETE /persons/{personId}/devices/{deviceId}
Removes the registration identified by personId/deviceId. Requires the person themselves, a super administrator, or administer persons permission. An unknown registration is a successful no-op. Returns 204 without a response body; no other device registrations are deleted.
§Example
client.persons().devices().delete(42, "abc123")?;Sourcepub fn get(
&self,
person_id: impl Display,
device_id: impl Display,
) -> Result<Device>
pub fn get( &self, person_id: impl Display, device_id: impl Display, ) -> Result<Device>
Get specified device
GET /persons/{personId}/devices/{deviceId}
Returns the device identified by the personId/deviceId pair. Requires the same person-settings read access as the device list. Unknown registrations return 404. deviceId is the registration identifier; the deprecated response id is actually the push token. Reading does not refresh expiration.
§Example
let device = client.persons().devices().get(42, "abc123")?;
println!("{:?}", device.app_version);Sourcepub fn list(&self, person_id: impl Display) -> Result<Vec<Device>>
pub fn list(&self, person_id: impl Display) -> Result<Vec<Device>>
Get all registered devices for person
GET /persons/{personId}/devices
Lists all device registrations stored for the person, including registrations whose expirationDate has passed until cleanup removes them. Requires access to the person’s settings: the person themselves, a super administrator, or someone with administer persons permission. The read policy also accepts the special person ID -1. There is no pagination or guaranteed order, and this operation does not refresh expiration.
§Example
for device in client.persons().devices().list(42)? {
println!("{:?}", device.app_version);
}Sourcepub fn update(
&self,
person_id: impl Display,
device_id: impl Display,
body: &DeviceUpdate,
) -> Result<Vec<Device>>
pub fn update( &self, person_id: impl Display, device_id: impl Display, body: &DeviceUpdate, ) -> Result<Vec<Device>>
Create or update new device for person
PUT /persons/{personId}/devices/{deviceId}
Creates or refreshes the registration identified by personId/deviceId and returns the person’s complete device list. Requires access to update the person’s settings: the person themselves, a super administrator, or someone with administer persons permission. type is required on every call. Expiration is extended by three months, or one day during simulation. Omitted pushId becomes deviceId; empty pushId preserves the previous token; null clears it. Omitted appVersion clears the previous version. Other registrations of the same person with the same non-null push token are removed. Saving is transactional. When chat is active, a supplied appVersion outside simulation also sets the person’s hasMatrixUser setting.
§Example
let body = models::DeviceUpdate {
r#type: "FCM".into(),
..Default::default()
};
for device in client.persons().devices().update(42, "abc123", &body)? {
println!("{:?}", device.app_version);
}