cmd.rs 677 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2019-2023 Tauri Programme within The Commons Conservancy
  2. // SPDX-License-Identifier: Apache-2.0
  3. // SPDX-License-Identifier: MIT
  4. use serde::{Deserialize, Serialize};
  5. use tauri::command;
  6. #[derive(Debug, Deserialize)]
  7. #[allow(unused)]
  8. pub struct RequestBody {
  9. id: i32,
  10. name: String,
  11. }
  12. #[command]
  13. pub fn log_operation(event: String, payload: Option<String>) {
  14. log::info!("{} {:?}", event, payload);
  15. }
  16. #[derive(Serialize)]
  17. pub struct ApiResponse {
  18. message: String,
  19. }
  20. #[command]
  21. pub fn perform_request(endpoint: String, body: RequestBody) -> ApiResponse {
  22. println!("{} {:?}", endpoint, body);
  23. ApiResponse {
  24. message: "message response".into(),
  25. }
  26. }