use std::fmt::Display;
use crate::core::{IntoBody, Json, Result};
platform_service! {
AccountService
}
impl AccountService {
pub async fn mark_notification_read(&self, id: impl Display) -> Result<Json> {
self.base
.patch(&format!("notifications/{id}/read"), None)
.await
}
pub async fn update_ticket(&self, id: impl Display, body: impl IntoBody) -> Result<Json> {
self.base.put(&format!("ticket/{id}"), body).await
}
pub async fn ticket_messages(&self, id: impl Display) -> Result<Json> {
self.base.get(&format!("ticket/{id}/messages")).await
}
pub async fn add_ticket_message(&self, id: impl Display, body: impl IntoBody) -> Result<Json> {
self.base.post(&format!("ticket/{id}/messages"), body).await
}
}
json_get! {
AccountService {
balance => "balance",
plan => "plan",
invoices => "invoices",
invoice_notes => "invoices/notes",
jobs => "jobs",
credentials => "credentials",
indications => "indications",
notifications => "notifications",
tickets => "tickets",
}
}
json_body! {
AccountService {
pay_invoice => post "invoices/pay",
requests => post "requests",
api_requests => post "api/requests",
create_ticket => post "ticket",
}
}
json_empty! {
AccountService {
mark_all_notifications_read => post "notifications/mark-all-read",
}
}