Skip to main content

uarp_sdk/generated/api/
companies.rs

1// Code generated by @uarp/codegen from spec/openapi.json. DO NOT EDIT.
2//!
3//! Company management
4
5#![allow(unused_imports, clippy::too_many_arguments)]
6
7use reqwest::Method;
8use serde::{Deserialize, Serialize};
9
10use crate::client::{Client, Request, NO_BODY, NO_QUERY};
11use crate::error::Result;
12use crate::generated::models;
13use crate::multipart::{field_text, FilePart};
14use crate::util::encode_path;
15
16/// Company management
17#[derive(Debug, Clone)]
18pub struct CompaniesApi {
19    pub(crate) client: Client,
20}
21
22impl Client {
23    /// Company management
24    pub fn companies(&self) -> CompaniesApi {
25        CompaniesApi { client: self.clone() }
26    }
27}
28
29impl CompaniesApi {
30    /// Create a company
31    ///
32    /// `POST /api/v1/companies`
33    ///
34    /// Required scopes: `agents:write`.
35    pub async fn create(&self, body: &models::CompanyCreate) -> Result<models::Company> {
36        self.client
37            .request_json(Request {
38                method: Method::POST,
39                path: "/api/v1/companies".to_string(),
40                query: NO_QUERY,
41                body: Some(body),
42                headers: Vec::new(),
43                idempotent: true,
44            })
45            .await
46    }
47
48    /// Delete company
49    ///
50    /// `DELETE /api/v1/companies/{id}`
51    ///
52    /// Required scopes: `agents:write`.
53    pub async fn delete(&self, id: &str) -> Result<models::DeleteCompanyResponse> {
54        self.client
55            .request_json(Request {
56                method: Method::DELETE,
57                path: format!("/api/v1/companies/{}", encode_path(id)),
58                query: NO_QUERY,
59                body: NO_BODY,
60                headers: Vec::new(),
61                idempotent: true,
62            })
63            .await
64    }
65
66    /// Get company
67    ///
68    /// `GET /api/v1/companies/{id}`
69    ///
70    /// Required scopes: `agents:read`.
71    pub async fn get(&self, id: &str) -> Result<models::Company> {
72        self.client
73            .request_json(Request {
74                method: Method::GET,
75                path: format!("/api/v1/companies/{}", encode_path(id)),
76                query: NO_QUERY,
77                body: NO_BODY,
78                headers: Vec::new(),
79                idempotent: false,
80            })
81            .await
82    }
83
84    /// Get company activity log
85    ///
86    /// `GET /api/v1/companies/{companyId}/activity`
87    ///
88    /// Required scopes: `agents:read`.
89    pub async fn get_company_activity(&self, company_id: &str) -> Result<models::GetCompanyActivityResponse> {
90        self.client
91            .request_json(Request {
92                method: Method::GET,
93                path: format!("/api/v1/companies/{}/activity", encode_path(company_id)),
94                query: NO_QUERY,
95                body: NO_BODY,
96                headers: Vec::new(),
97                idempotent: false,
98            })
99            .await
100    }
101
102    /// Get company budget allocation
103    ///
104    /// `GET /api/v1/companies/{companyId}/budget`
105    ///
106    /// Required scopes: `agents:read`.
107    pub async fn get_company_budget(&self, company_id: &str) -> Result<models::GetCompanyBudgetResponse> {
108        self.client
109            .request_json(Request {
110                method: Method::GET,
111                path: format!("/api/v1/companies/{}/budget", encode_path(company_id)),
112                query: NO_QUERY,
113                body: NO_BODY,
114                headers: Vec::new(),
115                idempotent: false,
116            })
117            .await
118    }
119
120    /// Get company strategic objectives
121    ///
122    /// `GET /api/v1/companies/{companyId}/objectives`
123    ///
124    /// Required scopes: `agents:read`.
125    pub async fn get_company_objectives(&self, company_id: &str) -> Result<models::GetCompanyObjectivesResponse> {
126        self.client
127            .request_json(Request {
128                method: Method::GET,
129                path: format!("/api/v1/companies/{}/objectives", encode_path(company_id)),
130                query: NO_QUERY,
131                body: NO_BODY,
132                headers: Vec::new(),
133                idempotent: false,
134            })
135            .await
136    }
137
138    /// List companies
139    ///
140    /// `GET /api/v1/companies`
141    ///
142    /// Required scopes: `agents:read`.
143    pub async fn list(&self) -> Result<models::ListCompaniesResponse> {
144        self.client
145            .request_json(Request {
146                method: Method::GET,
147                path: "/api/v1/companies".to_string(),
148                query: NO_QUERY,
149                body: NO_BODY,
150                headers: Vec::new(),
151                idempotent: false,
152            })
153            .await
154    }
155
156    /// Pause company operations
157    ///
158    /// `POST /api/v1/companies/{companyId}/pause`
159    ///
160    /// Required scopes: `agents:write`.
161    pub async fn pause_company(&self, company_id: &str) -> Result<models::PauseCompanyResponse> {
162        self.client
163            .request_json(Request {
164                method: Method::POST,
165                path: format!("/api/v1/companies/{}/pause", encode_path(company_id)),
166                query: NO_QUERY,
167                body: NO_BODY,
168                headers: Vec::new(),
169                idempotent: true,
170            })
171            .await
172    }
173
174    /// Resume company operations
175    ///
176    /// `POST /api/v1/companies/{companyId}/resume`
177    ///
178    /// Required scopes: `agents:write`.
179    pub async fn resume(&self, company_id: &str) -> Result<models::ResumeCompanyResponse> {
180        self.client
181            .request_json(Request {
182                method: Method::POST,
183                path: format!("/api/v1/companies/{}/resume", encode_path(company_id)),
184                query: NO_QUERY,
185                body: NO_BODY,
186                headers: Vec::new(),
187                idempotent: true,
188            })
189            .await
190    }
191
192    /// Update company
193    ///
194    /// `PUT /api/v1/companies/{id}`
195    ///
196    /// Required scopes: `agents:write`.
197    pub async fn update(&self, id: &str, body: &models::CompanyUpdate) -> Result<models::Company> {
198        self.client
199            .request_json(Request {
200                method: Method::PUT,
201                path: format!("/api/v1/companies/{}", encode_path(id)),
202                query: NO_QUERY,
203                body: Some(body),
204                headers: Vec::new(),
205                idempotent: true,
206            })
207            .await
208    }
209}