feat: add API example (#317)

This commit is contained in:
Lucas Fernandes Nogueira
2023-05-05 05:41:17 -07:00
committed by GitHub
parent be1c775b8d
commit 5015132ece
98 changed files with 10334 additions and 156 deletions
+24
View File
@@ -0,0 +1,24 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use serde::Deserialize;
use tauri::command;
#[derive(Debug, Deserialize)]
#[allow(unused)]
pub struct RequestBody {
id: i32,
name: String,
}
#[command]
pub fn log_operation(event: String, payload: Option<String>) {
log::info!("{} {:?}", event, payload);
}
#[command]
pub fn perform_request(endpoint: String, body: RequestBody) -> String {
println!("{} {:?}", endpoint, body);
"message response".into()
}