pub struct ProfileEditor {
pub profile_id: String,
pub handoff_id: String,
pub url: String,
pub expires_at: SystemTime,
pub start_version: u64,
pub poll_interval: Duration,
/* private fields */
}Expand description
A handle on an open profile editor. Send the person to url; it works until
expires_at. There is no save without closing: save_and_close
stores the profile and ends the editor, exit ends it without saving.
An expired or used link fails every call with an API error of status 404; an editor that is not running
with 409; a failed save with 502 (the editor goes to error: exit and start a new edit; a second save gets 409). Save and exit are never retried automatically.
Fields§
§profile_id: String§handoff_id: String§url: StringThe editor link to open in a browser.
expires_at: SystemTime§start_version: u64The profile’s version when the editor was opened.
poll_interval: DurationHow often wait_for_save polls. Default 2 s.
Implementations§
Source§impl ProfileEditor
impl ProfileEditor
Sourcepub async fn status(&self) -> Result<EditorState, SolariError>
pub async fn status(&self) -> Result<EditorState, SolariError>
GET /profiles/:id/editor.
Sourcepub async fn save_and_close(&self) -> Result<u64, SolariError>
pub async fn save_and_close(&self) -> Result<u64, SolariError>
POST /profiles/:id/editor/save — store the editor’s browser state in the profile and close the
editor. Returns the new version.
Sourcepub async fn exit(&self) -> Result<(), SolariError>
pub async fn exit(&self) -> Result<(), SolariError>
DELETE /profiles/:id/editor — close the editor without saving.
Sourcepub async fn wait_for_save(
&self,
timeout: Option<Duration>,
) -> Result<u64, SolariError>
pub async fn wait_for_save( &self, timeout: Option<Duration>, ) -> Result<u64, SolariError>
Poll the profile list until this profile’s version exceeds start_version
(someone saved from the editor page) and return it. Fails with an API error of status 408 when
timeout passes or the link expires first. None waits until the link expires.