1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
use std::rc::Rc;
use std::borrow::Borrow;
#[allow(unused_imports)]
use std::option::Option;
use reqwest;
use super::{Error, configuration};
pub struct TaskCommentApiClient {
configuration: Rc<configuration::Configuration>,
}
impl TaskCommentApiClient {
pub fn new(configuration: Rc<configuration::Configuration>) -> TaskCommentApiClient {
TaskCommentApiClient {
configuration,
}
}
}
pub trait TaskCommentApi {
fn create_comment(&self, id: &str, comment_dto: Option<crate::models::CommentDto>) -> Result<crate::models::CommentDto, Error>;
fn get_comment(&self, id: &str, comment_id: &str) -> Result<crate::models::CommentDto, Error>;
fn get_comments(&self, id: &str) -> Result<Vec<crate::models::CommentDto>, Error>;
}
impl TaskCommentApi for TaskCommentApiClient {
fn create_comment(&self, id: &str, comment_dto: Option<crate::models::CommentDto>) -> Result<crate::models::CommentDto, Error> {
let configuration: &configuration::Configuration = self.configuration.borrow();
let client = &configuration.client;
let uri_str = format!("{}/task/{id}/comment/create", configuration.base_path, id=crate::apis::urlencode(id));
let mut req_builder = client.post(uri_str.as_str());
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&comment_dto);
let req = req_builder.build()?;
Ok(client.execute(req)?.error_for_status()?.json()?)
}
fn get_comment(&self, id: &str, comment_id: &str) -> Result<crate::models::CommentDto, Error> {
let configuration: &configuration::Configuration = self.configuration.borrow();
let client = &configuration.client;
let uri_str = format!("{}/task/{id}/comment/{commentId}", configuration.base_path, id=crate::apis::urlencode(id), commentId=crate::apis::urlencode(comment_id));
let mut req_builder = client.get(uri_str.as_str());
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
Ok(client.execute(req)?.error_for_status()?.json()?)
}
fn get_comments(&self, id: &str) -> Result<Vec<crate::models::CommentDto>, Error> {
let configuration: &configuration::Configuration = self.configuration.borrow();
let client = &configuration.client;
let uri_str = format!("{}/task/{id}/comment", configuration.base_path, id=crate::apis::urlencode(id));
let mut req_builder = client.get(uri_str.as_str());
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
Ok(client.execute(req)?.error_for_status()?.json()?)
}
}