pub struct SyncEntityMappingsResource<'a> { /* private fields */ }Expand description
client.sync().entity_mappings()
Implementations§
Source§impl<'a> SyncEntityMappingsResource<'a>
impl<'a> SyncEntityMappingsResource<'a>
Sourcepub fn create(
&self,
body: &SyncEntityMappingCreate,
) -> Result<SyncEntityMapping>
pub fn create( &self, body: &SyncEntityMappingCreate, ) -> Result<SyncEntityMapping>
Create an entity mapping
POST /sync/entitymappings
Registers a relationship without creating either underlying record. Provided ChurchTools or external IDs must not be linked for the same domain and source. Requires “churchcore: administer persons” permission.
§Example
let body = models::SyncEntityMappingCreate {
domain_id: Some("42".into()),
domain_type: "status".into(),
source_entity_id: Some("p-42".into()),
source_id: 1,
status: "synced".into(),
..Default::default()
};
let result = client.sync().entity_mappings().create(&body)?;
println!("{}", result.id);Sourcepub fn delete(&self, id: impl Display) -> Result<()>
pub fn delete(&self, id: impl Display) -> Result<()>
Delete an entity mapping
DELETE /sync/entitymappings/{id}
Removes only the stored relationship; neither the ChurchTools record nor the external record is deleted. A missing mapping also returns 204. Requires “churchcore: administer persons” permission.
§Example
client.sync().entity_mappings().delete(1)?;Sourcepub fn get(&self, id: impl Display) -> Result<SyncEntityMapping>
pub fn get(&self, id: impl Display) -> Result<SyncEntityMapping>
Get an entity mapping
GET /sync/entitymappings/{id}
Returns a stored relationship. Requires “churchcore: administer persons” permission.
§Example
let entity_mapping = client.sync().entity_mappings().get(1)?;
println!("{}", entity_mapping.id);Sourcepub fn list(&self) -> Result<Vec<SyncEntityMapping>>
pub fn list(&self) -> Result<Vec<SyncEntityMapping>>
List entity mappings
GET /sync/entitymappings
Lists relationships between ChurchTools records and external records, newest mapping ID first. domainId and sourceEntityId are record identifiers; sourceId identifies the external connection. Requires “churchcore: administer persons” permission.
Use Self::list_with to pass query parameters.
§Example
for entity_mapping in client.sync().entity_mappings().list()? {
println!("{}", entity_mapping.id);
}Sourcepub fn list_with(
&self,
query: &GetSyncEntitymappingsQuery,
) -> Result<Vec<SyncEntityMapping>>
pub fn list_with( &self, query: &GetSyncEntitymappingsQuery, ) -> Result<Vec<SyncEntityMapping>>
List entity mappings
Like Self::list, with query parameters.
GET /sync/entitymappings
Lists relationships between ChurchTools records and external records, newest mapping ID first. domainId and sourceEntityId are record identifiers; sourceId identifies the external connection. Requires “churchcore: administer persons” permission.
Sourcepub fn list_iter(
&self,
query: &GetSyncEntitymappingsQuery,
) -> Items<SyncEntityMapping> ⓘ
pub fn list_iter( &self, query: &GetSyncEntitymappingsQuery, ) -> Items<SyncEntityMapping> ⓘ
List entity mappings
Like Self::list_with, but lazy: each page is fetched only when the iteration reaches it.
Breaking off early saves the remaining requests.
Sourcepub fn update(
&self,
id: impl Display,
body: &SyncEntityMappingUpdate,
) -> Result<SyncEntityMapping>
pub fn update( &self, id: impl Display, body: &SyncEntityMappingUpdate, ) -> Result<SyncEntityMapping>
Update or create an entity mapping
PUT /sync/entitymappings/{id}
Updates the relationship. Requires “churchcore: administer persons” permission.
§Example
let body = models::SyncEntityMappingUpdate {
domain_id: Some("42".into()),
domain_type: "status".into(),
source_entity_id: Some("p-42".into()),
source_id: 1,
status: "synced".into(),
..Default::default()
};
let result = client.sync().entity_mappings().update(1, &body)?;
println!("{}", result.id);