持久化认证状态到 SpacetimeDB 正式表
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
use super::*;
|
||||
use crate::mapper::*;
|
||||
|
||||
impl SpacetimeClient {
|
||||
pub async fn create_ai_task(
|
||||
&self,
|
||||
input: DomainAiTaskCreateInput,
|
||||
) -> Result<AiTaskMutationRecord, SpacetimeClientError> {
|
||||
let procedure_input = map_ai_task_create_input(input);
|
||||
let procedure_input = input.into();
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection.procedures().create_ai_task_and_return_then(
|
||||
@@ -21,12 +22,11 @@ impl SpacetimeClient {
|
||||
.await
|
||||
}
|
||||
|
||||
|
||||
pub async fn start_ai_task(
|
||||
&self,
|
||||
input: DomainAiTaskStartInput,
|
||||
) -> Result<(), SpacetimeClientError> {
|
||||
let reducer_input = map_ai_task_start_input(input);
|
||||
let reducer_input = input.into();
|
||||
|
||||
self.call_reducer_after_connect(move |connection, sender| {
|
||||
let callback_sender = sender.clone();
|
||||
@@ -49,12 +49,11 @@ impl SpacetimeClient {
|
||||
.await
|
||||
}
|
||||
|
||||
|
||||
pub async fn start_ai_task_stage(
|
||||
&self,
|
||||
input: DomainAiTaskStageStartInput,
|
||||
) -> Result<(), SpacetimeClientError> {
|
||||
let reducer_input = map_ai_task_stage_start_input(input);
|
||||
let reducer_input = input.into();
|
||||
|
||||
self.call_reducer_after_connect(move |connection, sender| {
|
||||
let callback_sender = sender.clone();
|
||||
@@ -77,12 +76,11 @@ impl SpacetimeClient {
|
||||
.await
|
||||
}
|
||||
|
||||
|
||||
pub async fn append_ai_text_chunk(
|
||||
&self,
|
||||
input: DomainAiTextChunkAppendInput,
|
||||
) -> Result<AiTaskMutationRecord, SpacetimeClientError> {
|
||||
let procedure_input = map_ai_text_chunk_append_input(input);
|
||||
let procedure_input = input.into();
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection
|
||||
@@ -97,12 +95,11 @@ impl SpacetimeClient {
|
||||
.await
|
||||
}
|
||||
|
||||
|
||||
pub async fn complete_ai_stage(
|
||||
&self,
|
||||
input: DomainAiStageCompletionInput,
|
||||
) -> Result<AiTaskMutationRecord, SpacetimeClientError> {
|
||||
let procedure_input = map_ai_stage_completion_input(input);
|
||||
let procedure_input = input.into();
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection.procedures().complete_ai_stage_and_return_then(
|
||||
@@ -118,12 +115,11 @@ impl SpacetimeClient {
|
||||
.await
|
||||
}
|
||||
|
||||
|
||||
pub async fn attach_ai_result_reference(
|
||||
&self,
|
||||
input: DomainAiResultReferenceInput,
|
||||
) -> Result<AiTaskMutationRecord, SpacetimeClientError> {
|
||||
let procedure_input = map_ai_result_reference_input(input);
|
||||
let procedure_input = input.into();
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection
|
||||
@@ -138,12 +134,11 @@ impl SpacetimeClient {
|
||||
.await
|
||||
}
|
||||
|
||||
|
||||
pub async fn complete_ai_task(
|
||||
&self,
|
||||
input: DomainAiTaskFinishInput,
|
||||
) -> Result<AiTaskMutationRecord, SpacetimeClientError> {
|
||||
let procedure_input = map_ai_task_finish_input(input);
|
||||
let procedure_input = input.into();
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection.procedures().complete_ai_task_and_return_then(
|
||||
@@ -159,12 +154,11 @@ impl SpacetimeClient {
|
||||
.await
|
||||
}
|
||||
|
||||
|
||||
pub async fn fail_ai_task(
|
||||
&self,
|
||||
input: DomainAiTaskFailureInput,
|
||||
) -> Result<AiTaskMutationRecord, SpacetimeClientError> {
|
||||
let procedure_input = map_ai_task_failure_input(input);
|
||||
let procedure_input = input.into();
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection.procedures().fail_ai_task_and_return_then(
|
||||
@@ -180,12 +174,11 @@ impl SpacetimeClient {
|
||||
.await
|
||||
}
|
||||
|
||||
|
||||
pub async fn cancel_ai_task(
|
||||
&self,
|
||||
input: DomainAiTaskCancelInput,
|
||||
) -> Result<AiTaskMutationRecord, SpacetimeClientError> {
|
||||
let procedure_input = map_ai_task_cancel_input(input);
|
||||
let procedure_input = input.into();
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection.procedures().cancel_ai_task_and_return_then(
|
||||
@@ -200,6 +193,4 @@ impl SpacetimeClient {
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user