context69_sdk/client/settings/
runtime.rs1use context69_contracts::{RuntimeSettingsResponse, UpdateRuntimeSettingsRequest};
2use reqwest::Method;
3
4use super::Context69Client;
5use crate::Error;
6
7pub struct RuntimeSettingsApi<'a> {
8 client: &'a Context69Client,
9}
10
11impl<'a> RuntimeSettingsApi<'a> {
12 pub(super) fn new(client: &'a Context69Client) -> Self {
13 Self { client }
14 }
15
16 pub async fn get(&self) -> Result<RuntimeSettingsResponse, Error> {
17 self.client
18 .execute_json(
19 self.client
20 .authorized_request(Method::GET, "/v1/settings/runtime")
21 .await?,
22 )
23 .await
24 }
25
26 pub async fn update(
27 &self,
28 request: &UpdateRuntimeSettingsRequest,
29 ) -> Result<RuntimeSettingsResponse, Error> {
30 self.client
31 .execute_json(
32 self.client
33 .authorized_request(Method::PUT, "/v1/settings/runtime")
34 .await?
35 .json(request),
36 )
37 .await
38 }
39}