feature/ci-ruby-gems
claude/smbcloud-github-app-k9641p
development
feature/apps
feature/build-release
feature/ci-docs
feature/ci-ruby-gems
feature/cicd
feature/completion
feature/dist-nuget
feature/fix-ci-sdk-pypi-rubygem
feature/fix-clippy-on-stable-channel
feature/fix-deployment-script
feature/github-email
feature/gresiq-v1
feature/project-new-structure
feature/rsync-deploy
feature/ruby-runner
feature/sdk-npm
feature/sdk-workflows
feature/smbcloud-cli-release-npm
feature/smbcloud-deploy
feature/wasm
main
release/v0.7.4
| 1 | use crate::url_builder::{build_mail_message_url, build_mail_messages_url}; |
| 2 | use reqwest::Client; |
| 3 | use smbcloud_model::{error_codes::ErrorResponse, mail::MailMessage}; |
| 4 | use smbcloud_network::{environment::Environment, network::request}; |
| 5 | use smbcloud_networking::{constants::SMB_USER_AGENT, smb_client::SmbClient}; |
| 6 | |
| 7 | pub async fn get_mail_messages( |
| 8 | env: Environment, |
| 9 | client: (&SmbClient, &str), |
| 10 | access_token: String, |
| 11 | mail_app_id: String, |
| 12 | inbox_id: String, |
| 13 | limit: Option<u32>, |
| 14 | ) -> Result<Vec<MailMessage>, ErrorResponse> { |
| 15 | let builder = Client::new() |
| 16 | .get(build_mail_messages_url( |
| 17 | env, |
| 18 | client, |
| 19 | &mail_app_id, |
| 20 | &inbox_id, |
| 21 | limit, |
| 22 | )) |
| 23 | .header("Authorization", access_token) |
| 24 | .header("User-agent", SMB_USER_AGENT); |
| 25 | request(builder).await |
| 26 | } |
| 27 | |
| 28 | pub async fn get_mail_message( |
| 29 | env: Environment, |
| 30 | client: (&SmbClient, &str), |
| 31 | access_token: String, |
| 32 | mail_app_id: String, |
| 33 | inbox_id: String, |
| 34 | message_id: String, |
| 35 | ) -> Result<MailMessage, ErrorResponse> { |
| 36 | let builder = Client::new() |
| 37 | .get(build_mail_message_url( |
| 38 | env, |
| 39 | client, |
| 40 | &mail_app_id, |
| 41 | &inbox_id, |
| 42 | &message_id, |
| 43 | )) |
| 44 | .header("Authorization", access_token) |
| 45 | .header("User-agent", SMB_USER_AGENT); |
| 46 | request(builder).await |
| 47 | } |