Skip to main content

spatio_sdk/apis/
repo_api.rs

1/*
2 * SpatioAPI
3 *
4 * The REST API that owns every resource in your Spatio workspace: notes, sheets, slides, tasks, calendar events, mail, chat, files, and contacts. SpatioMCP wraps this API; Spatio Desktop reads from it. You can call it directly from your own code.  All requests must be authenticated with a Personal Access Token (`Authorization: Bearer pat_...`) or an OAuth 2.1 access token, and use HTTPS.  Official SDKs (MIT, generated from this spec on every release):  - TypeScript: https://github.com/spatio-labs/spatio-ts (`npm install @spatio-labs/spatio-ts`) - Python: https://github.com/spatio-labs/spatio-py (`pip install spatio-sdk`) - Go: https://github.com/spatio-labs/spatio-go (`go get github.com/spatio-labs/spatio-go`)  This specification is generated from the platform-service Go source on every push to `main`. The spec, not hand-written documentation, is the source of truth: server stubs and SDKs are generated from it, and any drift between the spec and the running service fails CI. 
5 *
6 * The version of the OpenAPI document: v1
7 * Contact: hello@spatio.app
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18/// struct for typed errors of method [`create_repo_branch`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CreateRepoBranchError {
22    Status401(models::ApiError),
23    UnknownValue(serde_json::Value),
24}
25
26/// struct for typed errors of method [`create_repo_pull_request`]
27#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum CreateRepoPullRequestError {
30    Status401(models::ApiError),
31    UnknownValue(serde_json::Value),
32}
33
34/// struct for typed errors of method [`create_repo_repository`]
35#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum CreateRepoRepositoryError {
38    Status401(models::ApiError),
39    UnknownValue(serde_json::Value),
40}
41
42/// struct for typed errors of method [`get_repo_commit`]
43#[derive(Debug, Clone, Serialize, Deserialize)]
44#[serde(untagged)]
45pub enum GetRepoCommitError {
46    Status401(models::ApiError),
47    Status404(models::ApiError),
48    UnknownValue(serde_json::Value),
49}
50
51/// struct for typed errors of method [`get_repo_repository`]
52#[derive(Debug, Clone, Serialize, Deserialize)]
53#[serde(untagged)]
54pub enum GetRepoRepositoryError {
55    Status401(models::ApiError),
56    Status404(models::ApiError),
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`link_repo_task`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum LinkRepoTaskError {
64    Status401(models::ApiError),
65    UnknownValue(serde_json::Value),
66}
67
68/// struct for typed errors of method [`list_repo_branches`]
69#[derive(Debug, Clone, Serialize, Deserialize)]
70#[serde(untagged)]
71pub enum ListRepoBranchesError {
72    Status401(models::ApiError),
73    UnknownValue(serde_json::Value),
74}
75
76/// struct for typed errors of method [`list_repo_commits`]
77#[derive(Debug, Clone, Serialize, Deserialize)]
78#[serde(untagged)]
79pub enum ListRepoCommitsError {
80    Status401(models::ApiError),
81    UnknownValue(serde_json::Value),
82}
83
84/// struct for typed errors of method [`list_repo_pull_requests`]
85#[derive(Debug, Clone, Serialize, Deserialize)]
86#[serde(untagged)]
87pub enum ListRepoPullRequestsError {
88    Status401(models::ApiError),
89    UnknownValue(serde_json::Value),
90}
91
92/// struct for typed errors of method [`list_repo_repositories`]
93#[derive(Debug, Clone, Serialize, Deserialize)]
94#[serde(untagged)]
95pub enum ListRepoRepositoriesError {
96    Status401(models::ApiError),
97    UnknownValue(serde_json::Value),
98}
99
100/// struct for typed errors of method [`list_repo_tasks`]
101#[derive(Debug, Clone, Serialize, Deserialize)]
102#[serde(untagged)]
103pub enum ListRepoTasksError {
104    Status401(models::ApiError),
105    UnknownValue(serde_json::Value),
106}
107
108/// struct for typed errors of method [`list_repo_workflows`]
109#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum ListRepoWorkflowsError {
112    Status401(models::ApiError),
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`merge_repo_pull_request`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum MergeRepoPullRequestError {
120    Status401(models::ApiError),
121    UnknownValue(serde_json::Value),
122}
123
124/// struct for typed errors of method [`trigger_repo_workflow`]
125#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum TriggerRepoWorkflowError {
128    Status401(models::ApiError),
129    UnknownValue(serde_json::Value),
130}
131
132/// struct for typed errors of method [`workspace_create_repo_branch`]
133#[derive(Debug, Clone, Serialize, Deserialize)]
134#[serde(untagged)]
135pub enum WorkspaceCreateRepoBranchError {
136    Status401(models::ApiError),
137    Status403(models::ApiError),
138    UnknownValue(serde_json::Value),
139}
140
141/// struct for typed errors of method [`workspace_create_repo_pull_request`]
142#[derive(Debug, Clone, Serialize, Deserialize)]
143#[serde(untagged)]
144pub enum WorkspaceCreateRepoPullRequestError {
145    Status401(models::ApiError),
146    Status403(models::ApiError),
147    UnknownValue(serde_json::Value),
148}
149
150/// struct for typed errors of method [`workspace_create_repo_repository`]
151#[derive(Debug, Clone, Serialize, Deserialize)]
152#[serde(untagged)]
153pub enum WorkspaceCreateRepoRepositoryError {
154    Status401(models::ApiError),
155    Status403(models::ApiError),
156    UnknownValue(serde_json::Value),
157}
158
159/// struct for typed errors of method [`workspace_get_repo_commit`]
160#[derive(Debug, Clone, Serialize, Deserialize)]
161#[serde(untagged)]
162pub enum WorkspaceGetRepoCommitError {
163    Status401(models::ApiError),
164    Status403(models::ApiError),
165    Status404(models::ApiError),
166    UnknownValue(serde_json::Value),
167}
168
169/// struct for typed errors of method [`workspace_get_repo_repository`]
170#[derive(Debug, Clone, Serialize, Deserialize)]
171#[serde(untagged)]
172pub enum WorkspaceGetRepoRepositoryError {
173    Status401(models::ApiError),
174    Status403(models::ApiError),
175    Status404(models::ApiError),
176    UnknownValue(serde_json::Value),
177}
178
179/// struct for typed errors of method [`workspace_link_repo_task`]
180#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum WorkspaceLinkRepoTaskError {
183    Status401(models::ApiError),
184    Status403(models::ApiError),
185    UnknownValue(serde_json::Value),
186}
187
188/// struct for typed errors of method [`workspace_list_repo_branches`]
189#[derive(Debug, Clone, Serialize, Deserialize)]
190#[serde(untagged)]
191pub enum WorkspaceListRepoBranchesError {
192    Status401(models::ApiError),
193    Status403(models::ApiError),
194    UnknownValue(serde_json::Value),
195}
196
197/// struct for typed errors of method [`workspace_list_repo_commits`]
198#[derive(Debug, Clone, Serialize, Deserialize)]
199#[serde(untagged)]
200pub enum WorkspaceListRepoCommitsError {
201    Status401(models::ApiError),
202    Status403(models::ApiError),
203    UnknownValue(serde_json::Value),
204}
205
206/// struct for typed errors of method [`workspace_list_repo_pull_requests`]
207#[derive(Debug, Clone, Serialize, Deserialize)]
208#[serde(untagged)]
209pub enum WorkspaceListRepoPullRequestsError {
210    Status401(models::ApiError),
211    Status403(models::ApiError),
212    UnknownValue(serde_json::Value),
213}
214
215/// struct for typed errors of method [`workspace_list_repo_repositories`]
216#[derive(Debug, Clone, Serialize, Deserialize)]
217#[serde(untagged)]
218pub enum WorkspaceListRepoRepositoriesError {
219    Status401(models::ApiError),
220    Status403(models::ApiError),
221    UnknownValue(serde_json::Value),
222}
223
224/// struct for typed errors of method [`workspace_list_repo_tasks`]
225#[derive(Debug, Clone, Serialize, Deserialize)]
226#[serde(untagged)]
227pub enum WorkspaceListRepoTasksError {
228    Status401(models::ApiError),
229    Status403(models::ApiError),
230    UnknownValue(serde_json::Value),
231}
232
233/// struct for typed errors of method [`workspace_list_repo_workflows`]
234#[derive(Debug, Clone, Serialize, Deserialize)]
235#[serde(untagged)]
236pub enum WorkspaceListRepoWorkflowsError {
237    Status401(models::ApiError),
238    Status403(models::ApiError),
239    UnknownValue(serde_json::Value),
240}
241
242/// struct for typed errors of method [`workspace_merge_repo_pull_request`]
243#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum WorkspaceMergeRepoPullRequestError {
246    Status401(models::ApiError),
247    Status403(models::ApiError),
248    UnknownValue(serde_json::Value),
249}
250
251/// struct for typed errors of method [`workspace_trigger_repo_workflow`]
252#[derive(Debug, Clone, Serialize, Deserialize)]
253#[serde(untagged)]
254pub enum WorkspaceTriggerRepoWorkflowError {
255    Status401(models::ApiError),
256    Status403(models::ApiError),
257    UnknownValue(serde_json::Value),
258}
259
260
261pub async fn create_repo_branch(configuration: &configuration::Configuration, owner: &str, repo: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<CreateRepoBranchError>> {
262    // add a prefix to parameters to efficiently prevent name collisions
263    let p_path_owner = owner;
264    let p_path_repo = repo;
265    let p_body_request_body = request_body;
266
267    let uri_str = format!("{}/v1/repos/repositories/{owner}/{repo}/branches", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
268    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
269
270    if let Some(ref user_agent) = configuration.user_agent {
271        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
272    }
273    if let Some(ref token) = configuration.bearer_access_token {
274        req_builder = req_builder.bearer_auth(token.to_owned());
275    };
276    req_builder = req_builder.json(&p_body_request_body);
277
278    let req = req_builder.build()?;
279    let resp = configuration.client.execute(req).await?;
280
281    let status = resp.status();
282    let content_type = resp
283        .headers()
284        .get("content-type")
285        .and_then(|v| v.to_str().ok())
286        .unwrap_or("application/octet-stream");
287    let content_type = super::ContentType::from(content_type);
288
289    if !status.is_client_error() && !status.is_server_error() {
290        let content = resp.text().await?;
291        match content_type {
292            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
293            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
294            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
295        }
296    } else {
297        let content = resp.text().await?;
298        let entity: Option<CreateRepoBranchError> = serde_json::from_str(&content).ok();
299        Err(Error::ResponseError(ResponseContent { status, content, entity }))
300    }
301}
302
303pub async fn create_repo_pull_request(configuration: &configuration::Configuration, owner: &str, repo: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<CreateRepoPullRequestError>> {
304    // add a prefix to parameters to efficiently prevent name collisions
305    let p_path_owner = owner;
306    let p_path_repo = repo;
307    let p_body_request_body = request_body;
308
309    let uri_str = format!("{}/v1/repos/repositories/{owner}/{repo}/pulls", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
310    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
311
312    if let Some(ref user_agent) = configuration.user_agent {
313        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
314    }
315    if let Some(ref token) = configuration.bearer_access_token {
316        req_builder = req_builder.bearer_auth(token.to_owned());
317    };
318    req_builder = req_builder.json(&p_body_request_body);
319
320    let req = req_builder.build()?;
321    let resp = configuration.client.execute(req).await?;
322
323    let status = resp.status();
324    let content_type = resp
325        .headers()
326        .get("content-type")
327        .and_then(|v| v.to_str().ok())
328        .unwrap_or("application/octet-stream");
329    let content_type = super::ContentType::from(content_type);
330
331    if !status.is_client_error() && !status.is_server_error() {
332        let content = resp.text().await?;
333        match content_type {
334            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
335            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
336            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
337        }
338    } else {
339        let content = resp.text().await?;
340        let entity: Option<CreateRepoPullRequestError> = serde_json::from_str(&content).ok();
341        Err(Error::ResponseError(ResponseContent { status, content, entity }))
342    }
343}
344
345pub async fn create_repo_repository(configuration: &configuration::Configuration, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<CreateRepoRepositoryError>> {
346    // add a prefix to parameters to efficiently prevent name collisions
347    let p_body_request_body = request_body;
348
349    let uri_str = format!("{}/v1/repos/repositories", configuration.base_path);
350    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
351
352    if let Some(ref user_agent) = configuration.user_agent {
353        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
354    }
355    if let Some(ref token) = configuration.bearer_access_token {
356        req_builder = req_builder.bearer_auth(token.to_owned());
357    };
358    req_builder = req_builder.json(&p_body_request_body);
359
360    let req = req_builder.build()?;
361    let resp = configuration.client.execute(req).await?;
362
363    let status = resp.status();
364    let content_type = resp
365        .headers()
366        .get("content-type")
367        .and_then(|v| v.to_str().ok())
368        .unwrap_or("application/octet-stream");
369    let content_type = super::ContentType::from(content_type);
370
371    if !status.is_client_error() && !status.is_server_error() {
372        let content = resp.text().await?;
373        match content_type {
374            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
375            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
376            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
377        }
378    } else {
379        let content = resp.text().await?;
380        let entity: Option<CreateRepoRepositoryError> = serde_json::from_str(&content).ok();
381        Err(Error::ResponseError(ResponseContent { status, content, entity }))
382    }
383}
384
385pub async fn get_repo_commit(configuration: &configuration::Configuration, owner: &str, repo: &str, sha: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetRepoCommitError>> {
386    // add a prefix to parameters to efficiently prevent name collisions
387    let p_path_owner = owner;
388    let p_path_repo = repo;
389    let p_path_sha = sha;
390
391    let uri_str = format!("{}/v1/repos/repositories/{owner}/{repo}/commits/{sha}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha));
392    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
393
394    if let Some(ref user_agent) = configuration.user_agent {
395        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
396    }
397    if let Some(ref token) = configuration.bearer_access_token {
398        req_builder = req_builder.bearer_auth(token.to_owned());
399    };
400
401    let req = req_builder.build()?;
402    let resp = configuration.client.execute(req).await?;
403
404    let status = resp.status();
405    let content_type = resp
406        .headers()
407        .get("content-type")
408        .and_then(|v| v.to_str().ok())
409        .unwrap_or("application/octet-stream");
410    let content_type = super::ContentType::from(content_type);
411
412    if !status.is_client_error() && !status.is_server_error() {
413        let content = resp.text().await?;
414        match content_type {
415            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
416            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
417            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
418        }
419    } else {
420        let content = resp.text().await?;
421        let entity: Option<GetRepoCommitError> = serde_json::from_str(&content).ok();
422        Err(Error::ResponseError(ResponseContent { status, content, entity }))
423    }
424}
425
426pub async fn get_repo_repository(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<GetRepoRepositoryError>> {
427    // add a prefix to parameters to efficiently prevent name collisions
428    let p_path_owner = owner;
429    let p_path_repo = repo;
430
431    let uri_str = format!("{}/v1/repos/repositories/{owner}/{repo}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
432    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
433
434    if let Some(ref user_agent) = configuration.user_agent {
435        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
436    }
437    if let Some(ref token) = configuration.bearer_access_token {
438        req_builder = req_builder.bearer_auth(token.to_owned());
439    };
440
441    let req = req_builder.build()?;
442    let resp = configuration.client.execute(req).await?;
443
444    let status = resp.status();
445    let content_type = resp
446        .headers()
447        .get("content-type")
448        .and_then(|v| v.to_str().ok())
449        .unwrap_or("application/octet-stream");
450    let content_type = super::ContentType::from(content_type);
451
452    if !status.is_client_error() && !status.is_server_error() {
453        let content = resp.text().await?;
454        match content_type {
455            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
456            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
457            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
458        }
459    } else {
460        let content = resp.text().await?;
461        let entity: Option<GetRepoRepositoryError> = serde_json::from_str(&content).ok();
462        Err(Error::ResponseError(ResponseContent { status, content, entity }))
463    }
464}
465
466pub async fn link_repo_task(configuration: &configuration::Configuration, owner: &str, repo: &str, link_repo_task_request: models::LinkRepoTaskRequest) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<LinkRepoTaskError>> {
467    // add a prefix to parameters to efficiently prevent name collisions
468    let p_path_owner = owner;
469    let p_path_repo = repo;
470    let p_body_link_repo_task_request = link_repo_task_request;
471
472    let uri_str = format!("{}/v1/repos/repositories/{owner}/{repo}/tasks/link", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
473    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
474
475    if let Some(ref user_agent) = configuration.user_agent {
476        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
477    }
478    if let Some(ref token) = configuration.bearer_access_token {
479        req_builder = req_builder.bearer_auth(token.to_owned());
480    };
481    req_builder = req_builder.json(&p_body_link_repo_task_request);
482
483    let req = req_builder.build()?;
484    let resp = configuration.client.execute(req).await?;
485
486    let status = resp.status();
487    let content_type = resp
488        .headers()
489        .get("content-type")
490        .and_then(|v| v.to_str().ok())
491        .unwrap_or("application/octet-stream");
492    let content_type = super::ContentType::from(content_type);
493
494    if !status.is_client_error() && !status.is_server_error() {
495        let content = resp.text().await?;
496        match content_type {
497            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
498            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
499            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
500        }
501    } else {
502        let content = resp.text().await?;
503        let entity: Option<LinkRepoTaskError> = serde_json::from_str(&content).ok();
504        Err(Error::ResponseError(ResponseContent { status, content, entity }))
505    }
506}
507
508pub async fn list_repo_branches(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ListRepoBranchesError>> {
509    // add a prefix to parameters to efficiently prevent name collisions
510    let p_path_owner = owner;
511    let p_path_repo = repo;
512
513    let uri_str = format!("{}/v1/repos/repositories/{owner}/{repo}/branches", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
514    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
515
516    if let Some(ref user_agent) = configuration.user_agent {
517        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
518    }
519    if let Some(ref token) = configuration.bearer_access_token {
520        req_builder = req_builder.bearer_auth(token.to_owned());
521    };
522
523    let req = req_builder.build()?;
524    let resp = configuration.client.execute(req).await?;
525
526    let status = resp.status();
527    let content_type = resp
528        .headers()
529        .get("content-type")
530        .and_then(|v| v.to_str().ok())
531        .unwrap_or("application/octet-stream");
532    let content_type = super::ContentType::from(content_type);
533
534    if !status.is_client_error() && !status.is_server_error() {
535        let content = resp.text().await?;
536        match content_type {
537            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
538            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
539            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
540        }
541    } else {
542        let content = resp.text().await?;
543        let entity: Option<ListRepoBranchesError> = serde_json::from_str(&content).ok();
544        Err(Error::ResponseError(ResponseContent { status, content, entity }))
545    }
546}
547
548pub async fn list_repo_commits(configuration: &configuration::Configuration, owner: &str, repo: &str, branch: Option<&str>, limit: Option<i32>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ListRepoCommitsError>> {
549    // add a prefix to parameters to efficiently prevent name collisions
550    let p_path_owner = owner;
551    let p_path_repo = repo;
552    let p_query_branch = branch;
553    let p_query_limit = limit;
554
555    let uri_str = format!("{}/v1/repos/repositories/{owner}/{repo}/commits", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
556    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
557
558    if let Some(ref param_value) = p_query_branch {
559        req_builder = req_builder.query(&[("branch", &param_value.to_string())]);
560    }
561    if let Some(ref param_value) = p_query_limit {
562        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
563    }
564    if let Some(ref user_agent) = configuration.user_agent {
565        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
566    }
567    if let Some(ref token) = configuration.bearer_access_token {
568        req_builder = req_builder.bearer_auth(token.to_owned());
569    };
570
571    let req = req_builder.build()?;
572    let resp = configuration.client.execute(req).await?;
573
574    let status = resp.status();
575    let content_type = resp
576        .headers()
577        .get("content-type")
578        .and_then(|v| v.to_str().ok())
579        .unwrap_or("application/octet-stream");
580    let content_type = super::ContentType::from(content_type);
581
582    if !status.is_client_error() && !status.is_server_error() {
583        let content = resp.text().await?;
584        match content_type {
585            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
586            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
587            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
588        }
589    } else {
590        let content = resp.text().await?;
591        let entity: Option<ListRepoCommitsError> = serde_json::from_str(&content).ok();
592        Err(Error::ResponseError(ResponseContent { status, content, entity }))
593    }
594}
595
596pub async fn list_repo_pull_requests(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ListRepoPullRequestsError>> {
597    // add a prefix to parameters to efficiently prevent name collisions
598    let p_path_owner = owner;
599    let p_path_repo = repo;
600
601    let uri_str = format!("{}/v1/repos/repositories/{owner}/{repo}/pulls", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
602    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
603
604    if let Some(ref user_agent) = configuration.user_agent {
605        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
606    }
607    if let Some(ref token) = configuration.bearer_access_token {
608        req_builder = req_builder.bearer_auth(token.to_owned());
609    };
610
611    let req = req_builder.build()?;
612    let resp = configuration.client.execute(req).await?;
613
614    let status = resp.status();
615    let content_type = resp
616        .headers()
617        .get("content-type")
618        .and_then(|v| v.to_str().ok())
619        .unwrap_or("application/octet-stream");
620    let content_type = super::ContentType::from(content_type);
621
622    if !status.is_client_error() && !status.is_server_error() {
623        let content = resp.text().await?;
624        match content_type {
625            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
626            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
627            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
628        }
629    } else {
630        let content = resp.text().await?;
631        let entity: Option<ListRepoPullRequestsError> = serde_json::from_str(&content).ok();
632        Err(Error::ResponseError(ResponseContent { status, content, entity }))
633    }
634}
635
636pub async fn list_repo_repositories(configuration: &configuration::Configuration, visibility: Option<&str>, limit: Option<i32>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ListRepoRepositoriesError>> {
637    // add a prefix to parameters to efficiently prevent name collisions
638    let p_query_visibility = visibility;
639    let p_query_limit = limit;
640
641    let uri_str = format!("{}/v1/repos/repositories", configuration.base_path);
642    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
643
644    if let Some(ref param_value) = p_query_visibility {
645        req_builder = req_builder.query(&[("visibility", &param_value.to_string())]);
646    }
647    if let Some(ref param_value) = p_query_limit {
648        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
649    }
650    if let Some(ref user_agent) = configuration.user_agent {
651        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
652    }
653    if let Some(ref token) = configuration.bearer_access_token {
654        req_builder = req_builder.bearer_auth(token.to_owned());
655    };
656
657    let req = req_builder.build()?;
658    let resp = configuration.client.execute(req).await?;
659
660    let status = resp.status();
661    let content_type = resp
662        .headers()
663        .get("content-type")
664        .and_then(|v| v.to_str().ok())
665        .unwrap_or("application/octet-stream");
666    let content_type = super::ContentType::from(content_type);
667
668    if !status.is_client_error() && !status.is_server_error() {
669        let content = resp.text().await?;
670        match content_type {
671            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
672            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
673            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
674        }
675    } else {
676        let content = resp.text().await?;
677        let entity: Option<ListRepoRepositoriesError> = serde_json::from_str(&content).ok();
678        Err(Error::ResponseError(ResponseContent { status, content, entity }))
679    }
680}
681
682pub async fn list_repo_tasks(configuration: &configuration::Configuration, owner: &str, repo: &str, state: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ListRepoTasksError>> {
683    // add a prefix to parameters to efficiently prevent name collisions
684    let p_path_owner = owner;
685    let p_path_repo = repo;
686    let p_query_state = state;
687    let p_query_per_page = per_page;
688    let p_query_page = page;
689
690    let uri_str = format!("{}/v1/repos/repositories/{owner}/{repo}/tasks", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
691    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
692
693    if let Some(ref param_value) = p_query_state {
694        req_builder = req_builder.query(&[("state", &param_value.to_string())]);
695    }
696    if let Some(ref param_value) = p_query_per_page {
697        req_builder = req_builder.query(&[("per_page", &param_value.to_string())]);
698    }
699    if let Some(ref param_value) = p_query_page {
700        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
701    }
702    if let Some(ref user_agent) = configuration.user_agent {
703        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
704    }
705    if let Some(ref token) = configuration.bearer_access_token {
706        req_builder = req_builder.bearer_auth(token.to_owned());
707    };
708
709    let req = req_builder.build()?;
710    let resp = configuration.client.execute(req).await?;
711
712    let status = resp.status();
713    let content_type = resp
714        .headers()
715        .get("content-type")
716        .and_then(|v| v.to_str().ok())
717        .unwrap_or("application/octet-stream");
718    let content_type = super::ContentType::from(content_type);
719
720    if !status.is_client_error() && !status.is_server_error() {
721        let content = resp.text().await?;
722        match content_type {
723            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
724            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
725            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
726        }
727    } else {
728        let content = resp.text().await?;
729        let entity: Option<ListRepoTasksError> = serde_json::from_str(&content).ok();
730        Err(Error::ResponseError(ResponseContent { status, content, entity }))
731    }
732}
733
734pub async fn list_repo_workflows(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<ListRepoWorkflowsError>> {
735    // add a prefix to parameters to efficiently prevent name collisions
736    let p_path_owner = owner;
737    let p_path_repo = repo;
738
739    let uri_str = format!("{}/v1/repos/repositories/{owner}/{repo}/workflows", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
740    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
741
742    if let Some(ref user_agent) = configuration.user_agent {
743        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
744    }
745    if let Some(ref token) = configuration.bearer_access_token {
746        req_builder = req_builder.bearer_auth(token.to_owned());
747    };
748
749    let req = req_builder.build()?;
750    let resp = configuration.client.execute(req).await?;
751
752    let status = resp.status();
753    let content_type = resp
754        .headers()
755        .get("content-type")
756        .and_then(|v| v.to_str().ok())
757        .unwrap_or("application/octet-stream");
758    let content_type = super::ContentType::from(content_type);
759
760    if !status.is_client_error() && !status.is_server_error() {
761        let content = resp.text().await?;
762        match content_type {
763            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
764            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
765            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
766        }
767    } else {
768        let content = resp.text().await?;
769        let entity: Option<ListRepoWorkflowsError> = serde_json::from_str(&content).ok();
770        Err(Error::ResponseError(ResponseContent { status, content, entity }))
771    }
772}
773
774pub async fn merge_repo_pull_request(configuration: &configuration::Configuration, owner: &str, repo: &str, number: i32, request_body: Option<std::collections::HashMap<String, serde_json::Value>>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<MergeRepoPullRequestError>> {
775    // add a prefix to parameters to efficiently prevent name collisions
776    let p_path_owner = owner;
777    let p_path_repo = repo;
778    let p_path_number = number;
779    let p_body_request_body = request_body;
780
781    let uri_str = format!("{}/v1/repos/repositories/{owner}/{repo}/pulls/{number}/merge", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), number=p_path_number);
782    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
783
784    if let Some(ref user_agent) = configuration.user_agent {
785        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
786    }
787    if let Some(ref token) = configuration.bearer_access_token {
788        req_builder = req_builder.bearer_auth(token.to_owned());
789    };
790    req_builder = req_builder.json(&p_body_request_body);
791
792    let req = req_builder.build()?;
793    let resp = configuration.client.execute(req).await?;
794
795    let status = resp.status();
796    let content_type = resp
797        .headers()
798        .get("content-type")
799        .and_then(|v| v.to_str().ok())
800        .unwrap_or("application/octet-stream");
801    let content_type = super::ContentType::from(content_type);
802
803    if !status.is_client_error() && !status.is_server_error() {
804        let content = resp.text().await?;
805        match content_type {
806            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
807            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
808            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
809        }
810    } else {
811        let content = resp.text().await?;
812        let entity: Option<MergeRepoPullRequestError> = serde_json::from_str(&content).ok();
813        Err(Error::ResponseError(ResponseContent { status, content, entity }))
814    }
815}
816
817pub async fn trigger_repo_workflow(configuration: &configuration::Configuration, owner: &str, repo: &str, id: &str, request_body: Option<std::collections::HashMap<String, serde_json::Value>>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<TriggerRepoWorkflowError>> {
818    // add a prefix to parameters to efficiently prevent name collisions
819    let p_path_owner = owner;
820    let p_path_repo = repo;
821    let p_path_id = id;
822    let p_body_request_body = request_body;
823
824    let uri_str = format!("{}/v1/repos/repositories/{owner}/{repo}/workflows/{id}/trigger", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=crate::apis::urlencode(p_path_id));
825    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
826
827    if let Some(ref user_agent) = configuration.user_agent {
828        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
829    }
830    if let Some(ref token) = configuration.bearer_access_token {
831        req_builder = req_builder.bearer_auth(token.to_owned());
832    };
833    req_builder = req_builder.json(&p_body_request_body);
834
835    let req = req_builder.build()?;
836    let resp = configuration.client.execute(req).await?;
837
838    let status = resp.status();
839    let content_type = resp
840        .headers()
841        .get("content-type")
842        .and_then(|v| v.to_str().ok())
843        .unwrap_or("application/octet-stream");
844    let content_type = super::ContentType::from(content_type);
845
846    if !status.is_client_error() && !status.is_server_error() {
847        let content = resp.text().await?;
848        match content_type {
849            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
850            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
851            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
852        }
853    } else {
854        let content = resp.text().await?;
855        let entity: Option<TriggerRepoWorkflowError> = serde_json::from_str(&content).ok();
856        Err(Error::ResponseError(ResponseContent { status, content, entity }))
857    }
858}
859
860pub async fn workspace_create_repo_branch(configuration: &configuration::Configuration, org: &str, workspace: &str, owner: &str, repo: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceCreateRepoBranchError>> {
861    // add a prefix to parameters to efficiently prevent name collisions
862    let p_path_org = org;
863    let p_path_workspace = workspace;
864    let p_path_owner = owner;
865    let p_path_repo = repo;
866    let p_body_request_body = request_body;
867
868    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/repos/repositories/{owner}/{repo}/branches", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
869    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
870
871    if let Some(ref user_agent) = configuration.user_agent {
872        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
873    }
874    if let Some(ref token) = configuration.bearer_access_token {
875        req_builder = req_builder.bearer_auth(token.to_owned());
876    };
877    req_builder = req_builder.json(&p_body_request_body);
878
879    let req = req_builder.build()?;
880    let resp = configuration.client.execute(req).await?;
881
882    let status = resp.status();
883    let content_type = resp
884        .headers()
885        .get("content-type")
886        .and_then(|v| v.to_str().ok())
887        .unwrap_or("application/octet-stream");
888    let content_type = super::ContentType::from(content_type);
889
890    if !status.is_client_error() && !status.is_server_error() {
891        let content = resp.text().await?;
892        match content_type {
893            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
894            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
895            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
896        }
897    } else {
898        let content = resp.text().await?;
899        let entity: Option<WorkspaceCreateRepoBranchError> = serde_json::from_str(&content).ok();
900        Err(Error::ResponseError(ResponseContent { status, content, entity }))
901    }
902}
903
904pub async fn workspace_create_repo_pull_request(configuration: &configuration::Configuration, org: &str, workspace: &str, owner: &str, repo: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceCreateRepoPullRequestError>> {
905    // add a prefix to parameters to efficiently prevent name collisions
906    let p_path_org = org;
907    let p_path_workspace = workspace;
908    let p_path_owner = owner;
909    let p_path_repo = repo;
910    let p_body_request_body = request_body;
911
912    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/repos/repositories/{owner}/{repo}/pulls", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
913    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
914
915    if let Some(ref user_agent) = configuration.user_agent {
916        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
917    }
918    if let Some(ref token) = configuration.bearer_access_token {
919        req_builder = req_builder.bearer_auth(token.to_owned());
920    };
921    req_builder = req_builder.json(&p_body_request_body);
922
923    let req = req_builder.build()?;
924    let resp = configuration.client.execute(req).await?;
925
926    let status = resp.status();
927    let content_type = resp
928        .headers()
929        .get("content-type")
930        .and_then(|v| v.to_str().ok())
931        .unwrap_or("application/octet-stream");
932    let content_type = super::ContentType::from(content_type);
933
934    if !status.is_client_error() && !status.is_server_error() {
935        let content = resp.text().await?;
936        match content_type {
937            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
938            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
939            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
940        }
941    } else {
942        let content = resp.text().await?;
943        let entity: Option<WorkspaceCreateRepoPullRequestError> = serde_json::from_str(&content).ok();
944        Err(Error::ResponseError(ResponseContent { status, content, entity }))
945    }
946}
947
948pub async fn workspace_create_repo_repository(configuration: &configuration::Configuration, org: &str, workspace: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceCreateRepoRepositoryError>> {
949    // add a prefix to parameters to efficiently prevent name collisions
950    let p_path_org = org;
951    let p_path_workspace = workspace;
952    let p_body_request_body = request_body;
953
954    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/repos/repositories", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace));
955    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
956
957    if let Some(ref user_agent) = configuration.user_agent {
958        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
959    }
960    if let Some(ref token) = configuration.bearer_access_token {
961        req_builder = req_builder.bearer_auth(token.to_owned());
962    };
963    req_builder = req_builder.json(&p_body_request_body);
964
965    let req = req_builder.build()?;
966    let resp = configuration.client.execute(req).await?;
967
968    let status = resp.status();
969    let content_type = resp
970        .headers()
971        .get("content-type")
972        .and_then(|v| v.to_str().ok())
973        .unwrap_or("application/octet-stream");
974    let content_type = super::ContentType::from(content_type);
975
976    if !status.is_client_error() && !status.is_server_error() {
977        let content = resp.text().await?;
978        match content_type {
979            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
980            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
981            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
982        }
983    } else {
984        let content = resp.text().await?;
985        let entity: Option<WorkspaceCreateRepoRepositoryError> = serde_json::from_str(&content).ok();
986        Err(Error::ResponseError(ResponseContent { status, content, entity }))
987    }
988}
989
990pub async fn workspace_get_repo_commit(configuration: &configuration::Configuration, org: &str, workspace: &str, owner: &str, repo: &str, sha: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceGetRepoCommitError>> {
991    // add a prefix to parameters to efficiently prevent name collisions
992    let p_path_org = org;
993    let p_path_workspace = workspace;
994    let p_path_owner = owner;
995    let p_path_repo = repo;
996    let p_path_sha = sha;
997
998    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/repos/repositories/{owner}/{repo}/commits/{sha}", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), sha=crate::apis::urlencode(p_path_sha));
999    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1000
1001    if let Some(ref user_agent) = configuration.user_agent {
1002        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1003    }
1004    if let Some(ref token) = configuration.bearer_access_token {
1005        req_builder = req_builder.bearer_auth(token.to_owned());
1006    };
1007
1008    let req = req_builder.build()?;
1009    let resp = configuration.client.execute(req).await?;
1010
1011    let status = resp.status();
1012    let content_type = resp
1013        .headers()
1014        .get("content-type")
1015        .and_then(|v| v.to_str().ok())
1016        .unwrap_or("application/octet-stream");
1017    let content_type = super::ContentType::from(content_type);
1018
1019    if !status.is_client_error() && !status.is_server_error() {
1020        let content = resp.text().await?;
1021        match content_type {
1022            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1023            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1024            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1025        }
1026    } else {
1027        let content = resp.text().await?;
1028        let entity: Option<WorkspaceGetRepoCommitError> = serde_json::from_str(&content).ok();
1029        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1030    }
1031}
1032
1033pub async fn workspace_get_repo_repository(configuration: &configuration::Configuration, org: &str, workspace: &str, owner: &str, repo: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceGetRepoRepositoryError>> {
1034    // add a prefix to parameters to efficiently prevent name collisions
1035    let p_path_org = org;
1036    let p_path_workspace = workspace;
1037    let p_path_owner = owner;
1038    let p_path_repo = repo;
1039
1040    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/repos/repositories/{owner}/{repo}", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
1041    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1042
1043    if let Some(ref user_agent) = configuration.user_agent {
1044        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1045    }
1046    if let Some(ref token) = configuration.bearer_access_token {
1047        req_builder = req_builder.bearer_auth(token.to_owned());
1048    };
1049
1050    let req = req_builder.build()?;
1051    let resp = configuration.client.execute(req).await?;
1052
1053    let status = resp.status();
1054    let content_type = resp
1055        .headers()
1056        .get("content-type")
1057        .and_then(|v| v.to_str().ok())
1058        .unwrap_or("application/octet-stream");
1059    let content_type = super::ContentType::from(content_type);
1060
1061    if !status.is_client_error() && !status.is_server_error() {
1062        let content = resp.text().await?;
1063        match content_type {
1064            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1065            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1066            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1067        }
1068    } else {
1069        let content = resp.text().await?;
1070        let entity: Option<WorkspaceGetRepoRepositoryError> = serde_json::from_str(&content).ok();
1071        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1072    }
1073}
1074
1075pub async fn workspace_link_repo_task(configuration: &configuration::Configuration, org: &str, workspace: &str, owner: &str, repo: &str, request_body: std::collections::HashMap<String, serde_json::Value>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceLinkRepoTaskError>> {
1076    // add a prefix to parameters to efficiently prevent name collisions
1077    let p_path_org = org;
1078    let p_path_workspace = workspace;
1079    let p_path_owner = owner;
1080    let p_path_repo = repo;
1081    let p_body_request_body = request_body;
1082
1083    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/repos/repositories/{owner}/{repo}/tasks/link", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
1084    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1085
1086    if let Some(ref user_agent) = configuration.user_agent {
1087        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1088    }
1089    if let Some(ref token) = configuration.bearer_access_token {
1090        req_builder = req_builder.bearer_auth(token.to_owned());
1091    };
1092    req_builder = req_builder.json(&p_body_request_body);
1093
1094    let req = req_builder.build()?;
1095    let resp = configuration.client.execute(req).await?;
1096
1097    let status = resp.status();
1098    let content_type = resp
1099        .headers()
1100        .get("content-type")
1101        .and_then(|v| v.to_str().ok())
1102        .unwrap_or("application/octet-stream");
1103    let content_type = super::ContentType::from(content_type);
1104
1105    if !status.is_client_error() && !status.is_server_error() {
1106        let content = resp.text().await?;
1107        match content_type {
1108            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1109            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1110            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1111        }
1112    } else {
1113        let content = resp.text().await?;
1114        let entity: Option<WorkspaceLinkRepoTaskError> = serde_json::from_str(&content).ok();
1115        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1116    }
1117}
1118
1119pub async fn workspace_list_repo_branches(configuration: &configuration::Configuration, org: &str, workspace: &str, owner: &str, repo: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceListRepoBranchesError>> {
1120    // add a prefix to parameters to efficiently prevent name collisions
1121    let p_path_org = org;
1122    let p_path_workspace = workspace;
1123    let p_path_owner = owner;
1124    let p_path_repo = repo;
1125
1126    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/repos/repositories/{owner}/{repo}/branches", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
1127    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1128
1129    if let Some(ref user_agent) = configuration.user_agent {
1130        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1131    }
1132    if let Some(ref token) = configuration.bearer_access_token {
1133        req_builder = req_builder.bearer_auth(token.to_owned());
1134    };
1135
1136    let req = req_builder.build()?;
1137    let resp = configuration.client.execute(req).await?;
1138
1139    let status = resp.status();
1140    let content_type = resp
1141        .headers()
1142        .get("content-type")
1143        .and_then(|v| v.to_str().ok())
1144        .unwrap_or("application/octet-stream");
1145    let content_type = super::ContentType::from(content_type);
1146
1147    if !status.is_client_error() && !status.is_server_error() {
1148        let content = resp.text().await?;
1149        match content_type {
1150            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1151            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1152            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1153        }
1154    } else {
1155        let content = resp.text().await?;
1156        let entity: Option<WorkspaceListRepoBranchesError> = serde_json::from_str(&content).ok();
1157        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1158    }
1159}
1160
1161pub async fn workspace_list_repo_commits(configuration: &configuration::Configuration, org: &str, workspace: &str, owner: &str, repo: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceListRepoCommitsError>> {
1162    // add a prefix to parameters to efficiently prevent name collisions
1163    let p_path_org = org;
1164    let p_path_workspace = workspace;
1165    let p_path_owner = owner;
1166    let p_path_repo = repo;
1167
1168    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/repos/repositories/{owner}/{repo}/commits", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
1169    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1170
1171    if let Some(ref user_agent) = configuration.user_agent {
1172        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1173    }
1174    if let Some(ref token) = configuration.bearer_access_token {
1175        req_builder = req_builder.bearer_auth(token.to_owned());
1176    };
1177
1178    let req = req_builder.build()?;
1179    let resp = configuration.client.execute(req).await?;
1180
1181    let status = resp.status();
1182    let content_type = resp
1183        .headers()
1184        .get("content-type")
1185        .and_then(|v| v.to_str().ok())
1186        .unwrap_or("application/octet-stream");
1187    let content_type = super::ContentType::from(content_type);
1188
1189    if !status.is_client_error() && !status.is_server_error() {
1190        let content = resp.text().await?;
1191        match content_type {
1192            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1193            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1194            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1195        }
1196    } else {
1197        let content = resp.text().await?;
1198        let entity: Option<WorkspaceListRepoCommitsError> = serde_json::from_str(&content).ok();
1199        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1200    }
1201}
1202
1203pub async fn workspace_list_repo_pull_requests(configuration: &configuration::Configuration, org: &str, workspace: &str, owner: &str, repo: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceListRepoPullRequestsError>> {
1204    // add a prefix to parameters to efficiently prevent name collisions
1205    let p_path_org = org;
1206    let p_path_workspace = workspace;
1207    let p_path_owner = owner;
1208    let p_path_repo = repo;
1209
1210    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/repos/repositories/{owner}/{repo}/pulls", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
1211    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1212
1213    if let Some(ref user_agent) = configuration.user_agent {
1214        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1215    }
1216    if let Some(ref token) = configuration.bearer_access_token {
1217        req_builder = req_builder.bearer_auth(token.to_owned());
1218    };
1219
1220    let req = req_builder.build()?;
1221    let resp = configuration.client.execute(req).await?;
1222
1223    let status = resp.status();
1224    let content_type = resp
1225        .headers()
1226        .get("content-type")
1227        .and_then(|v| v.to_str().ok())
1228        .unwrap_or("application/octet-stream");
1229    let content_type = super::ContentType::from(content_type);
1230
1231    if !status.is_client_error() && !status.is_server_error() {
1232        let content = resp.text().await?;
1233        match content_type {
1234            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1235            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1236            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1237        }
1238    } else {
1239        let content = resp.text().await?;
1240        let entity: Option<WorkspaceListRepoPullRequestsError> = serde_json::from_str(&content).ok();
1241        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1242    }
1243}
1244
1245pub async fn workspace_list_repo_repositories(configuration: &configuration::Configuration, org: &str, workspace: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceListRepoRepositoriesError>> {
1246    // add a prefix to parameters to efficiently prevent name collisions
1247    let p_path_org = org;
1248    let p_path_workspace = workspace;
1249
1250    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/repos/repositories", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace));
1251    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1252
1253    if let Some(ref user_agent) = configuration.user_agent {
1254        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1255    }
1256    if let Some(ref token) = configuration.bearer_access_token {
1257        req_builder = req_builder.bearer_auth(token.to_owned());
1258    };
1259
1260    let req = req_builder.build()?;
1261    let resp = configuration.client.execute(req).await?;
1262
1263    let status = resp.status();
1264    let content_type = resp
1265        .headers()
1266        .get("content-type")
1267        .and_then(|v| v.to_str().ok())
1268        .unwrap_or("application/octet-stream");
1269    let content_type = super::ContentType::from(content_type);
1270
1271    if !status.is_client_error() && !status.is_server_error() {
1272        let content = resp.text().await?;
1273        match content_type {
1274            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1275            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1276            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1277        }
1278    } else {
1279        let content = resp.text().await?;
1280        let entity: Option<WorkspaceListRepoRepositoriesError> = serde_json::from_str(&content).ok();
1281        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1282    }
1283}
1284
1285pub async fn workspace_list_repo_tasks(configuration: &configuration::Configuration, org: &str, workspace: &str, owner: &str, repo: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceListRepoTasksError>> {
1286    // add a prefix to parameters to efficiently prevent name collisions
1287    let p_path_org = org;
1288    let p_path_workspace = workspace;
1289    let p_path_owner = owner;
1290    let p_path_repo = repo;
1291
1292    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/repos/repositories/{owner}/{repo}/tasks", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
1293    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1294
1295    if let Some(ref user_agent) = configuration.user_agent {
1296        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1297    }
1298    if let Some(ref token) = configuration.bearer_access_token {
1299        req_builder = req_builder.bearer_auth(token.to_owned());
1300    };
1301
1302    let req = req_builder.build()?;
1303    let resp = configuration.client.execute(req).await?;
1304
1305    let status = resp.status();
1306    let content_type = resp
1307        .headers()
1308        .get("content-type")
1309        .and_then(|v| v.to_str().ok())
1310        .unwrap_or("application/octet-stream");
1311    let content_type = super::ContentType::from(content_type);
1312
1313    if !status.is_client_error() && !status.is_server_error() {
1314        let content = resp.text().await?;
1315        match content_type {
1316            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1317            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1318            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1319        }
1320    } else {
1321        let content = resp.text().await?;
1322        let entity: Option<WorkspaceListRepoTasksError> = serde_json::from_str(&content).ok();
1323        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1324    }
1325}
1326
1327pub async fn workspace_list_repo_workflows(configuration: &configuration::Configuration, org: &str, workspace: &str, owner: &str, repo: &str) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceListRepoWorkflowsError>> {
1328    // add a prefix to parameters to efficiently prevent name collisions
1329    let p_path_org = org;
1330    let p_path_workspace = workspace;
1331    let p_path_owner = owner;
1332    let p_path_repo = repo;
1333
1334    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/repos/repositories/{owner}/{repo}/workflows", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
1335    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1336
1337    if let Some(ref user_agent) = configuration.user_agent {
1338        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1339    }
1340    if let Some(ref token) = configuration.bearer_access_token {
1341        req_builder = req_builder.bearer_auth(token.to_owned());
1342    };
1343
1344    let req = req_builder.build()?;
1345    let resp = configuration.client.execute(req).await?;
1346
1347    let status = resp.status();
1348    let content_type = resp
1349        .headers()
1350        .get("content-type")
1351        .and_then(|v| v.to_str().ok())
1352        .unwrap_or("application/octet-stream");
1353    let content_type = super::ContentType::from(content_type);
1354
1355    if !status.is_client_error() && !status.is_server_error() {
1356        let content = resp.text().await?;
1357        match content_type {
1358            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1359            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1360            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1361        }
1362    } else {
1363        let content = resp.text().await?;
1364        let entity: Option<WorkspaceListRepoWorkflowsError> = serde_json::from_str(&content).ok();
1365        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1366    }
1367}
1368
1369pub async fn workspace_merge_repo_pull_request(configuration: &configuration::Configuration, org: &str, workspace: &str, owner: &str, repo: &str, number: i32, request_body: Option<std::collections::HashMap<String, serde_json::Value>>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceMergeRepoPullRequestError>> {
1370    // add a prefix to parameters to efficiently prevent name collisions
1371    let p_path_org = org;
1372    let p_path_workspace = workspace;
1373    let p_path_owner = owner;
1374    let p_path_repo = repo;
1375    let p_path_number = number;
1376    let p_body_request_body = request_body;
1377
1378    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/repos/repositories/{owner}/{repo}/pulls/{number}/merge", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), number=p_path_number);
1379    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1380
1381    if let Some(ref user_agent) = configuration.user_agent {
1382        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1383    }
1384    if let Some(ref token) = configuration.bearer_access_token {
1385        req_builder = req_builder.bearer_auth(token.to_owned());
1386    };
1387    req_builder = req_builder.json(&p_body_request_body);
1388
1389    let req = req_builder.build()?;
1390    let resp = configuration.client.execute(req).await?;
1391
1392    let status = resp.status();
1393    let content_type = resp
1394        .headers()
1395        .get("content-type")
1396        .and_then(|v| v.to_str().ok())
1397        .unwrap_or("application/octet-stream");
1398    let content_type = super::ContentType::from(content_type);
1399
1400    if !status.is_client_error() && !status.is_server_error() {
1401        let content = resp.text().await?;
1402        match content_type {
1403            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1404            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1405            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1406        }
1407    } else {
1408        let content = resp.text().await?;
1409        let entity: Option<WorkspaceMergeRepoPullRequestError> = serde_json::from_str(&content).ok();
1410        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1411    }
1412}
1413
1414pub async fn workspace_trigger_repo_workflow(configuration: &configuration::Configuration, org: &str, workspace: &str, owner: &str, repo: &str, id: &str, request_body: Option<std::collections::HashMap<String, serde_json::Value>>) -> Result<std::collections::HashMap<String, serde_json::Value>, Error<WorkspaceTriggerRepoWorkflowError>> {
1415    // add a prefix to parameters to efficiently prevent name collisions
1416    let p_path_org = org;
1417    let p_path_workspace = workspace;
1418    let p_path_owner = owner;
1419    let p_path_repo = repo;
1420    let p_path_id = id;
1421    let p_body_request_body = request_body;
1422
1423    let uri_str = format!("{}/v1/organizations/{org}/workspaces/{workspace}/repos/repositories/{owner}/{repo}/workflows/{id}/trigger", configuration.base_path, org=crate::apis::urlencode(p_path_org), workspace=crate::apis::urlencode(p_path_workspace), owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo), id=crate::apis::urlencode(p_path_id));
1424    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1425
1426    if let Some(ref user_agent) = configuration.user_agent {
1427        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1428    }
1429    if let Some(ref token) = configuration.bearer_access_token {
1430        req_builder = req_builder.bearer_auth(token.to_owned());
1431    };
1432    req_builder = req_builder.json(&p_body_request_body);
1433
1434    let req = req_builder.build()?;
1435    let resp = configuration.client.execute(req).await?;
1436
1437    let status = resp.status();
1438    let content_type = resp
1439        .headers()
1440        .get("content-type")
1441        .and_then(|v| v.to_str().ok())
1442        .unwrap_or("application/octet-stream");
1443    let content_type = super::ContentType::from(content_type);
1444
1445    if !status.is_client_error() && !status.is_server_error() {
1446        let content = resp.text().await?;
1447        match content_type {
1448            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1449            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`"))),
1450            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `std::collections::HashMap&lt;String, serde_json::Value&gt;`")))),
1451        }
1452    } else {
1453        let content = resp.text().await?;
1454        let entity: Option<WorkspaceTriggerRepoWorkflowError> = serde_json::from_str(&content).ok();
1455        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1456    }
1457}
1458