openapp_sdk_core/resources/
eula.rs1use std::sync::Arc;
4
5use reqwest::Method;
6
7use super::JsonValue;
8use crate::{
9 error::SdkError,
10 transport::{RequestSpec, Transport},
11};
12
13#[derive(Debug, Clone)]
14pub struct EulaClient {
15 transport: Arc<Transport>,
16}
17
18impl EulaClient {
19 pub(crate) fn new(transport: Arc<Transport>) -> Self {
20 Self { transport }
21 }
22
23 pub async fn get(&self) -> Result<JsonValue, SdkError> {
24 self.transport
25 .request_json::<(), JsonValue>(RequestSpec {
26 method: Method::GET,
27 path: "/eula",
28 ..Default::default()
29 })
30 .await
31 }
32
33 pub async fn accept(&self, body: &JsonValue) -> Result<JsonValue, SdkError> {
34 self.transport
35 .request_json::<JsonValue, JsonValue>(RequestSpec {
36 method: Method::POST,
37 path: "/eula/accept",
38 body: Some(body),
39 ..Default::default()
40 })
41 .await
42 }
43}