cmd.rs 560 B

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