1
This commit is contained in:
@@ -1682,14 +1682,10 @@ pub(crate) fn map_visual_novel_agent_session_procedure_result(
|
||||
let session_json = result
|
||||
.session_json
|
||||
.ok_or_else(|| SpacetimeClientError::missing_snapshot("visual novel agent session 快照"))?;
|
||||
let session =
|
||||
serde_json::from_str::<VisualNovelAgentSessionJsonRecord>(&session_json).map_err(
|
||||
|error| {
|
||||
SpacetimeClientError::Runtime(format!(
|
||||
"visual novel session_json 非法: {error}"
|
||||
))
|
||||
},
|
||||
)?;
|
||||
let session = serde_json::from_str::<VisualNovelAgentSessionJsonRecord>(&session_json)
|
||||
.map_err(|error| {
|
||||
SpacetimeClientError::Runtime(format!("visual novel session_json 非法: {error}"))
|
||||
})?;
|
||||
|
||||
Ok(map_visual_novel_agent_session_snapshot(session))
|
||||
}
|
||||
@@ -1721,13 +1717,15 @@ pub(crate) fn map_visual_novel_works_procedure_result(
|
||||
let items_json = result
|
||||
.items_json
|
||||
.ok_or_else(|| SpacetimeClientError::missing_snapshot("visual novel works 快照"))?;
|
||||
let items = serde_json::from_str::<Vec<VisualNovelWorkJsonRecord>>(&items_json).map_err(
|
||||
|error| {
|
||||
let items =
|
||||
serde_json::from_str::<Vec<VisualNovelWorkJsonRecord>>(&items_json).map_err(|error| {
|
||||
SpacetimeClientError::Runtime(format!("visual novel works items_json 非法: {error}"))
|
||||
},
|
||||
)?;
|
||||
})?;
|
||||
|
||||
Ok(items.into_iter().map(map_visual_novel_work_snapshot).collect())
|
||||
Ok(items
|
||||
.into_iter()
|
||||
.map(map_visual_novel_work_snapshot)
|
||||
.collect())
|
||||
}
|
||||
|
||||
pub(crate) fn map_visual_novel_run_procedure_result(
|
||||
@@ -1762,7 +1760,10 @@ pub(crate) fn map_visual_novel_history_procedure_result(
|
||||
SpacetimeClientError::Runtime(format!("visual novel history items_json 非法: {error}"))
|
||||
})?;
|
||||
|
||||
Ok(items.into_iter().map(map_visual_novel_history_entry).collect())
|
||||
Ok(items
|
||||
.into_iter()
|
||||
.map(map_visual_novel_history_entry)
|
||||
.collect())
|
||||
}
|
||||
|
||||
pub(crate) fn map_visual_novel_runtime_event_procedure_result(
|
||||
@@ -1776,9 +1777,7 @@ pub(crate) fn map_visual_novel_runtime_event_procedure_result(
|
||||
.event_json
|
||||
.ok_or_else(|| SpacetimeClientError::missing_snapshot("visual novel runtime event 快照"))?;
|
||||
let event = serde_json::from_str::<VisualNovelRuntimeEventJsonRecord>(&event_json).map_err(
|
||||
|error| {
|
||||
SpacetimeClientError::Runtime(format!("visual novel event_json 非法: {error}"))
|
||||
},
|
||||
|error| SpacetimeClientError::Runtime(format!("visual novel event_json 非法: {error}")),
|
||||
)?;
|
||||
|
||||
Ok(map_visual_novel_runtime_event(event))
|
||||
|
||||
@@ -29,15 +29,14 @@ impl SpacetimeClient {
|
||||
};
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection.procedures().create_visual_novel_agent_session_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
connection
|
||||
.procedures()
|
||||
.create_visual_novel_agent_session_then(procedure_input, move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
|
||||
.and_then(map_visual_novel_agent_session_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
});
|
||||
})
|
||||
.await
|
||||
}
|
||||
@@ -79,15 +78,14 @@ impl SpacetimeClient {
|
||||
};
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection.procedures().submit_visual_novel_agent_message_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
connection
|
||||
.procedures()
|
||||
.submit_visual_novel_agent_message_then(procedure_input, move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
|
||||
.and_then(map_visual_novel_agent_session_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
});
|
||||
})
|
||||
.await
|
||||
}
|
||||
@@ -112,12 +110,15 @@ impl SpacetimeClient {
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.finalize_visual_novel_agent_message_turn_then(procedure_input, move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
|
||||
.and_then(map_visual_novel_agent_session_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
});
|
||||
.finalize_visual_novel_agent_message_turn_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
|
||||
.and_then(map_visual_novel_agent_session_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
})
|
||||
.await
|
||||
}
|
||||
@@ -140,15 +141,14 @@ impl SpacetimeClient {
|
||||
};
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection.procedures().compile_visual_novel_work_profile_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
connection
|
||||
.procedures()
|
||||
.compile_visual_novel_work_profile_then(procedure_input, move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
|
||||
.and_then(map_visual_novel_agent_session_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
});
|
||||
})
|
||||
.await
|
||||
}
|
||||
@@ -312,14 +312,15 @@ impl SpacetimeClient {
|
||||
};
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.start_visual_novel_run_then(procedure_input, move |_, result| {
|
||||
connection.procedures().start_visual_novel_run_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
|
||||
.and_then(map_visual_novel_run_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
});
|
||||
},
|
||||
);
|
||||
})
|
||||
.await
|
||||
}
|
||||
@@ -367,15 +368,14 @@ impl SpacetimeClient {
|
||||
};
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection.procedures().upsert_visual_novel_run_snapshot_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
connection
|
||||
.procedures()
|
||||
.upsert_visual_novel_run_snapshot_then(procedure_input, move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
|
||||
.and_then(map_visual_novel_run_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
});
|
||||
})
|
||||
.await
|
||||
}
|
||||
@@ -400,12 +400,15 @@ impl SpacetimeClient {
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.append_visual_novel_runtime_history_entry_then(procedure_input, move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
|
||||
.and_then(map_visual_novel_history_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
});
|
||||
.append_visual_novel_runtime_history_entry_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
|
||||
.and_then(map_visual_novel_history_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
})
|
||||
.await
|
||||
}
|
||||
@@ -421,15 +424,14 @@ impl SpacetimeClient {
|
||||
};
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection.procedures().list_visual_novel_runtime_history_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
connection
|
||||
.procedures()
|
||||
.list_visual_novel_runtime_history_then(procedure_input, move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
|
||||
.and_then(map_visual_novel_history_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
});
|
||||
})
|
||||
.await
|
||||
}
|
||||
@@ -451,15 +453,14 @@ impl SpacetimeClient {
|
||||
};
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection.procedures().record_visual_novel_runtime_event_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
connection
|
||||
.procedures()
|
||||
.record_visual_novel_runtime_event_then(procedure_input, move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
|
||||
.and_then(map_visual_novel_runtime_event_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
});
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user