1use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum MemoServiceCreateMemoError {
22 DefaultResponse(models::GooglerpcStatus),
23 UnknownValue(serde_json::Value),
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum MemoServiceCreateMemoCommentError {
30 DefaultResponse(models::GooglerpcStatus),
31 UnknownValue(serde_json::Value),
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum MemoServiceDeleteMemoError {
38 DefaultResponse(models::GooglerpcStatus),
39 UnknownValue(serde_json::Value),
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize)]
44#[serde(untagged)]
45pub enum MemoServiceDeleteMemoReactionError {
46 DefaultResponse(models::GooglerpcStatus),
47 UnknownValue(serde_json::Value),
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum MemoServiceDeleteMemoTagError {
54 DefaultResponse(models::GooglerpcStatus),
55 UnknownValue(serde_json::Value),
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum MemoServiceGetMemoError {
62 DefaultResponse(models::GooglerpcStatus),
63 UnknownValue(serde_json::Value),
64}
65
66#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum MemoServiceGetMemoByUidError {
70 DefaultResponse(models::GooglerpcStatus),
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum MemoServiceListMemoCommentsError {
78 DefaultResponse(models::GooglerpcStatus),
79 UnknownValue(serde_json::Value),
80}
81
82#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum MemoServiceListMemoPropertiesError {
86 DefaultResponse(models::GooglerpcStatus),
87 UnknownValue(serde_json::Value),
88}
89
90#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum MemoServiceListMemoReactionsError {
94 DefaultResponse(models::GooglerpcStatus),
95 UnknownValue(serde_json::Value),
96}
97
98#[derive(Debug, Clone, Serialize, Deserialize)]
100#[serde(untagged)]
101pub enum MemoServiceListMemoRelationsError {
102 DefaultResponse(models::GooglerpcStatus),
103 UnknownValue(serde_json::Value),
104}
105
106#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum MemoServiceListMemoResourcesError {
110 DefaultResponse(models::GooglerpcStatus),
111 UnknownValue(serde_json::Value),
112}
113
114#[derive(Debug, Clone, Serialize, Deserialize)]
116#[serde(untagged)]
117pub enum MemoServiceListMemoTagsError {
118 DefaultResponse(models::GooglerpcStatus),
119 UnknownValue(serde_json::Value),
120}
121
122#[derive(Debug, Clone, Serialize, Deserialize)]
124#[serde(untagged)]
125pub enum MemoServiceListMemosError {
126 DefaultResponse(models::GooglerpcStatus),
127 UnknownValue(serde_json::Value),
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum MemoServiceRebuildMemoPropertyError {
134 DefaultResponse(models::GooglerpcStatus),
135 UnknownValue(serde_json::Value),
136}
137
138#[derive(Debug, Clone, Serialize, Deserialize)]
140#[serde(untagged)]
141pub enum MemoServiceRenameMemoTagError {
142 DefaultResponse(models::GooglerpcStatus),
143 UnknownValue(serde_json::Value),
144}
145
146#[derive(Debug, Clone, Serialize, Deserialize)]
148#[serde(untagged)]
149pub enum MemoServiceSetMemoRelationsError {
150 DefaultResponse(models::GooglerpcStatus),
151 UnknownValue(serde_json::Value),
152}
153
154#[derive(Debug, Clone, Serialize, Deserialize)]
156#[serde(untagged)]
157pub enum MemoServiceSetMemoResourcesError {
158 DefaultResponse(models::GooglerpcStatus),
159 UnknownValue(serde_json::Value),
160}
161
162#[derive(Debug, Clone, Serialize, Deserialize)]
164#[serde(untagged)]
165pub enum MemoServiceUpdateMemoError {
166 DefaultResponse(models::GooglerpcStatus),
167 UnknownValue(serde_json::Value),
168}
169
170#[derive(Debug, Clone, Serialize, Deserialize)]
172#[serde(untagged)]
173pub enum MemoServiceUpsertMemoReactionError {
174 DefaultResponse(models::GooglerpcStatus),
175 UnknownValue(serde_json::Value),
176}
177
178
179pub fn memo_service_create_memo(configuration: &configuration::Configuration, body: models::V1CreateMemoRequest) -> Result<models::V1Memo, Error<MemoServiceCreateMemoError>> {
180 let local_var_configuration = configuration;
181
182 let local_var_client = &local_var_configuration.client;
183
184 let local_var_uri_str = format!("{}/api/v1/memos", local_var_configuration.base_path);
185 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
186
187 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
188 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
189 }
190 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
191 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
192 };
193 local_var_req_builder = local_var_req_builder.json(&body);
194
195 let local_var_req = local_var_req_builder.build()?;
196 let local_var_resp = local_var_client.execute(local_var_req)?;
197
198 let local_var_status = local_var_resp.status();
199 let local_var_content = local_var_resp.text()?;
200
201 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
202 serde_json::from_str(&local_var_content).map_err(Error::from)
203 } else {
204 let local_var_entity: Option<MemoServiceCreateMemoError> = serde_json::from_str(&local_var_content).ok();
205 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
206 Err(Error::ResponseError(local_var_error))
207 }
208}
209
210pub fn memo_service_create_memo_comment(configuration: &configuration::Configuration, name: &str, comment: models::V1CreateMemoRequest) -> Result<models::V1Memo, Error<MemoServiceCreateMemoCommentError>> {
211 let local_var_configuration = configuration;
212
213 let local_var_client = &local_var_configuration.client;
214
215 let local_var_uri_str = format!("{}/api/v1/{name}/comments", local_var_configuration.base_path, name=crate::apis::urlencode(name));
216 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
217
218 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
219 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
220 }
221 local_var_req_builder = local_var_req_builder.json(&comment);
222
223 let local_var_req = local_var_req_builder.build()?;
224 let local_var_resp = local_var_client.execute(local_var_req)?;
225
226 let local_var_status = local_var_resp.status();
227 let local_var_content = local_var_resp.text()?;
228
229 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
230 serde_json::from_str(&local_var_content).map_err(Error::from)
231 } else {
232 let local_var_entity: Option<MemoServiceCreateMemoCommentError> = serde_json::from_str(&local_var_content).ok();
233 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
234 Err(Error::ResponseError(local_var_error))
235 }
236}
237
238pub fn memo_service_delete_memo(configuration: &configuration::Configuration, name_4: &str) -> Result<serde_json::Value, Error<MemoServiceDeleteMemoError>> {
239 let local_var_configuration = configuration;
240
241 let local_var_client = &local_var_configuration.client;
242
243 let local_var_uri_str = format!("{}/api/v1/{name_4}", local_var_configuration.base_path, name_4=crate::apis::urlencode(name_4));
244 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
245
246 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
247 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
248 }
249
250 let local_var_req = local_var_req_builder.build()?;
251 let local_var_resp = local_var_client.execute(local_var_req)?;
252
253 let local_var_status = local_var_resp.status();
254 let local_var_content = local_var_resp.text()?;
255
256 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
257 serde_json::from_str(&local_var_content).map_err(Error::from)
258 } else {
259 let local_var_entity: Option<MemoServiceDeleteMemoError> = serde_json::from_str(&local_var_content).ok();
260 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
261 Err(Error::ResponseError(local_var_error))
262 }
263}
264
265pub fn memo_service_delete_memo_reaction(configuration: &configuration::Configuration, reaction_id: i32) -> Result<serde_json::Value, Error<MemoServiceDeleteMemoReactionError>> {
266 let local_var_configuration = configuration;
267
268 let local_var_client = &local_var_configuration.client;
269
270 let local_var_uri_str = format!("{}/api/v1/reactions/{reactionId}", local_var_configuration.base_path, reactionId=reaction_id);
271 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
272
273 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
274 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
275 }
276
277 let local_var_req = local_var_req_builder.build()?;
278 let local_var_resp = local_var_client.execute(local_var_req)?;
279
280 let local_var_status = local_var_resp.status();
281 let local_var_content = local_var_resp.text()?;
282
283 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
284 serde_json::from_str(&local_var_content).map_err(Error::from)
285 } else {
286 let local_var_entity: Option<MemoServiceDeleteMemoReactionError> = serde_json::from_str(&local_var_content).ok();
287 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
288 Err(Error::ResponseError(local_var_error))
289 }
290}
291
292pub fn memo_service_delete_memo_tag(configuration: &configuration::Configuration, parent: &str, tag: &str, delete_related_memos: Option<bool>) -> Result<serde_json::Value, Error<MemoServiceDeleteMemoTagError>> {
293 let local_var_configuration = configuration;
294
295 let local_var_client = &local_var_configuration.client;
296
297 let local_var_uri_str = format!("{}/api/v1/{parent}/tags/{tag}", local_var_configuration.base_path, parent=crate::apis::urlencode(parent), tag=crate::apis::urlencode(tag));
298 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
299
300 if let Some(ref local_var_str) = delete_related_memos {
301 local_var_req_builder = local_var_req_builder.query(&[("deleteRelatedMemos", &local_var_str.to_string())]);
302 }
303 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
304 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
305 }
306
307 let local_var_req = local_var_req_builder.build()?;
308 let local_var_resp = local_var_client.execute(local_var_req)?;
309
310 let local_var_status = local_var_resp.status();
311 let local_var_content = local_var_resp.text()?;
312
313 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
314 serde_json::from_str(&local_var_content).map_err(Error::from)
315 } else {
316 let local_var_entity: Option<MemoServiceDeleteMemoTagError> = serde_json::from_str(&local_var_content).ok();
317 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
318 Err(Error::ResponseError(local_var_error))
319 }
320}
321
322pub fn memo_service_get_memo(configuration: &configuration::Configuration, name_4: &str) -> Result<models::V1Memo, Error<MemoServiceGetMemoError>> {
323 let local_var_configuration = configuration;
324
325 let local_var_client = &local_var_configuration.client;
326
327 let local_var_uri_str = format!("{}/api/v1/{name_4}", local_var_configuration.base_path, name_4=crate::apis::urlencode(name_4));
328 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
329
330 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
331 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
332 }
333
334 let local_var_req = local_var_req_builder.build()?;
335 let local_var_resp = local_var_client.execute(local_var_req)?;
336
337 let local_var_status = local_var_resp.status();
338 let local_var_content = local_var_resp.text()?;
339
340 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
341 serde_json::from_str(&local_var_content).map_err(Error::from)
342 } else {
343 let local_var_entity: Option<MemoServiceGetMemoError> = serde_json::from_str(&local_var_content).ok();
344 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
345 Err(Error::ResponseError(local_var_error))
346 }
347}
348
349pub fn memo_service_get_memo_by_uid(configuration: &configuration::Configuration, uid: &str) -> Result<models::V1Memo, Error<MemoServiceGetMemoByUidError>> {
350 let local_var_configuration = configuration;
351
352 let local_var_client = &local_var_configuration.client;
353
354 let local_var_uri_str = format!("{}/api/v1/memos:by-uid/{uid}", local_var_configuration.base_path, uid=crate::apis::urlencode(uid));
355 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
356
357 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
358 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
359 }
360
361 let local_var_req = local_var_req_builder.build()?;
362 let local_var_resp = local_var_client.execute(local_var_req)?;
363
364 let local_var_status = local_var_resp.status();
365 let local_var_content = local_var_resp.text()?;
366
367 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
368 serde_json::from_str(&local_var_content).map_err(Error::from)
369 } else {
370 let local_var_entity: Option<MemoServiceGetMemoByUidError> = serde_json::from_str(&local_var_content).ok();
371 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
372 Err(Error::ResponseError(local_var_error))
373 }
374}
375
376pub fn memo_service_list_memo_comments(configuration: &configuration::Configuration, name: &str) -> Result<models::V1ListMemoCommentsResponse, Error<MemoServiceListMemoCommentsError>> {
377 let local_var_configuration = configuration;
378
379 let local_var_client = &local_var_configuration.client;
380
381 let local_var_uri_str = format!("{}/api/v1/{name}/comments", local_var_configuration.base_path, name=crate::apis::urlencode(name));
382 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
383
384 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
385 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
386 }
387
388 let local_var_req = local_var_req_builder.build()?;
389 let local_var_resp = local_var_client.execute(local_var_req)?;
390
391 let local_var_status = local_var_resp.status();
392 let local_var_content = local_var_resp.text()?;
393
394 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
395 serde_json::from_str(&local_var_content).map_err(Error::from)
396 } else {
397 let local_var_entity: Option<MemoServiceListMemoCommentsError> = serde_json::from_str(&local_var_content).ok();
398 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
399 Err(Error::ResponseError(local_var_error))
400 }
401}
402
403pub fn memo_service_list_memo_properties(configuration: &configuration::Configuration, name: &str) -> Result<models::V1ListMemoPropertiesResponse, Error<MemoServiceListMemoPropertiesError>> {
404 let local_var_configuration = configuration;
405
406 let local_var_client = &local_var_configuration.client;
407
408 let local_var_uri_str = format!("{}/api/v1/{name}/properties", local_var_configuration.base_path, name=crate::apis::urlencode(name));
409 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
410
411 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
412 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
413 }
414
415 let local_var_req = local_var_req_builder.build()?;
416 let local_var_resp = local_var_client.execute(local_var_req)?;
417
418 let local_var_status = local_var_resp.status();
419 let local_var_content = local_var_resp.text()?;
420
421 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
422 serde_json::from_str(&local_var_content).map_err(Error::from)
423 } else {
424 let local_var_entity: Option<MemoServiceListMemoPropertiesError> = serde_json::from_str(&local_var_content).ok();
425 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
426 Err(Error::ResponseError(local_var_error))
427 }
428}
429
430pub fn memo_service_list_memo_reactions(configuration: &configuration::Configuration, name: &str) -> Result<models::V1ListMemoReactionsResponse, Error<MemoServiceListMemoReactionsError>> {
431 let local_var_configuration = configuration;
432
433 let local_var_client = &local_var_configuration.client;
434
435 let local_var_uri_str = format!("{}/api/v1/{name}/reactions", local_var_configuration.base_path, name=crate::apis::urlencode(name));
436 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
437
438 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
439 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
440 }
441
442 let local_var_req = local_var_req_builder.build()?;
443 let local_var_resp = local_var_client.execute(local_var_req)?;
444
445 let local_var_status = local_var_resp.status();
446 let local_var_content = local_var_resp.text()?;
447
448 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
449 serde_json::from_str(&local_var_content).map_err(Error::from)
450 } else {
451 let local_var_entity: Option<MemoServiceListMemoReactionsError> = serde_json::from_str(&local_var_content).ok();
452 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
453 Err(Error::ResponseError(local_var_error))
454 }
455}
456
457pub fn memo_service_list_memo_relations(configuration: &configuration::Configuration, name: &str) -> Result<models::V1ListMemoRelationsResponse, Error<MemoServiceListMemoRelationsError>> {
458 let local_var_configuration = configuration;
459
460 let local_var_client = &local_var_configuration.client;
461
462 let local_var_uri_str = format!("{}/api/v1/{name}/relations", local_var_configuration.base_path, name=crate::apis::urlencode(name));
463 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
464
465 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
466 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
467 }
468
469 let local_var_req = local_var_req_builder.build()?;
470 let local_var_resp = local_var_client.execute(local_var_req)?;
471
472 let local_var_status = local_var_resp.status();
473 let local_var_content = local_var_resp.text()?;
474
475 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
476 serde_json::from_str(&local_var_content).map_err(Error::from)
477 } else {
478 let local_var_entity: Option<MemoServiceListMemoRelationsError> = serde_json::from_str(&local_var_content).ok();
479 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
480 Err(Error::ResponseError(local_var_error))
481 }
482}
483
484pub fn memo_service_list_memo_resources(configuration: &configuration::Configuration, name: &str) -> Result<models::V1ListMemoResourcesResponse, Error<MemoServiceListMemoResourcesError>> {
485 let local_var_configuration = configuration;
486
487 let local_var_client = &local_var_configuration.client;
488
489 let local_var_uri_str = format!("{}/api/v1/{name}/resources", local_var_configuration.base_path, name=crate::apis::urlencode(name));
490 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
491
492 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
493 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
494 }
495
496 let local_var_req = local_var_req_builder.build()?;
497 let local_var_resp = local_var_client.execute(local_var_req)?;
498
499 let local_var_status = local_var_resp.status();
500 let local_var_content = local_var_resp.text()?;
501
502 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
503 serde_json::from_str(&local_var_content).map_err(Error::from)
504 } else {
505 let local_var_entity: Option<MemoServiceListMemoResourcesError> = serde_json::from_str(&local_var_content).ok();
506 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
507 Err(Error::ResponseError(local_var_error))
508 }
509}
510
511pub fn memo_service_list_memo_tags(configuration: &configuration::Configuration, parent: &str, filter: Option<&str>) -> Result<models::V1ListMemoTagsResponse, Error<MemoServiceListMemoTagsError>> {
512 let local_var_configuration = configuration;
513
514 let local_var_client = &local_var_configuration.client;
515
516 let local_var_uri_str = format!("{}/api/v1/{parent}/tags", local_var_configuration.base_path, parent=crate::apis::urlencode(parent));
517 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
518
519 if let Some(ref local_var_str) = filter {
520 local_var_req_builder = local_var_req_builder.query(&[("filter", &local_var_str.to_string())]);
521 }
522 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
523 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
524 }
525
526 let local_var_req = local_var_req_builder.build()?;
527 let local_var_resp = local_var_client.execute(local_var_req)?;
528
529 let local_var_status = local_var_resp.status();
530 let local_var_content = local_var_resp.text()?;
531
532 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
533 serde_json::from_str(&local_var_content).map_err(Error::from)
534 } else {
535 let local_var_entity: Option<MemoServiceListMemoTagsError> = serde_json::from_str(&local_var_content).ok();
536 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
537 Err(Error::ResponseError(local_var_error))
538 }
539}
540
541pub fn memo_service_list_memos(configuration: &configuration::Configuration, page_size: Option<i32>, page_token: Option<&str>, filter: Option<&str>) -> Result<models::V1ListMemosResponse, Error<MemoServiceListMemosError>> {
542 let local_var_configuration = configuration;
543
544 let local_var_client = &local_var_configuration.client;
545
546 let local_var_uri_str = format!("{}/api/v1/memos", local_var_configuration.base_path);
547 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
548
549 if let Some(ref local_var_str) = page_size {
550 local_var_req_builder = local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
551 }
552 if let Some(ref local_var_str) = page_token {
553 local_var_req_builder = local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
554 }
555 if let Some(ref local_var_str) = filter {
556 local_var_req_builder = local_var_req_builder.query(&[("filter", &local_var_str.to_string())]);
557 }
558 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
559 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
560 }
561 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
562 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
563 };
564
565 let local_var_req = local_var_req_builder.build()?;
566 let local_var_resp = local_var_client.execute(local_var_req)?;
567
568 let local_var_status = local_var_resp.status();
569 let local_var_content = local_var_resp.text()?;
570
571 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
572 serde_json::from_str(&local_var_content).map_err(Error::from)
573 } else {
574 let local_var_entity: Option<MemoServiceListMemosError> = serde_json::from_str(&local_var_content).ok();
575 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
576 Err(Error::ResponseError(local_var_error))
577 }
578}
579
580pub fn memo_service_rebuild_memo_property(configuration: &configuration::Configuration, name: &str, body: serde_json::Value) -> Result<serde_json::Value, Error<MemoServiceRebuildMemoPropertyError>> {
581 let local_var_configuration = configuration;
582
583 let local_var_client = &local_var_configuration.client;
584
585 let local_var_uri_str = format!("{}/api/v1/{name}/properties:rebuild", local_var_configuration.base_path, name=crate::apis::urlencode(name));
586 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
587
588 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
589 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
590 }
591 local_var_req_builder = local_var_req_builder.json(&body);
592
593 let local_var_req = local_var_req_builder.build()?;
594 let local_var_resp = local_var_client.execute(local_var_req)?;
595
596 let local_var_status = local_var_resp.status();
597 let local_var_content = local_var_resp.text()?;
598
599 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
600 serde_json::from_str(&local_var_content).map_err(Error::from)
601 } else {
602 let local_var_entity: Option<MemoServiceRebuildMemoPropertyError> = serde_json::from_str(&local_var_content).ok();
603 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
604 Err(Error::ResponseError(local_var_error))
605 }
606}
607
608pub fn memo_service_rename_memo_tag(configuration: &configuration::Configuration, parent: &str, body: models::MemoServiceRenameMemoTagBody) -> Result<serde_json::Value, Error<MemoServiceRenameMemoTagError>> {
609 let local_var_configuration = configuration;
610
611 let local_var_client = &local_var_configuration.client;
612
613 let local_var_uri_str = format!("{}/api/v1/{parent}/tags:rename", local_var_configuration.base_path, parent=crate::apis::urlencode(parent));
614 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
615
616 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
617 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
618 }
619 local_var_req_builder = local_var_req_builder.json(&body);
620
621 let local_var_req = local_var_req_builder.build()?;
622 let local_var_resp = local_var_client.execute(local_var_req)?;
623
624 let local_var_status = local_var_resp.status();
625 let local_var_content = local_var_resp.text()?;
626
627 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
628 serde_json::from_str(&local_var_content).map_err(Error::from)
629 } else {
630 let local_var_entity: Option<MemoServiceRenameMemoTagError> = serde_json::from_str(&local_var_content).ok();
631 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
632 Err(Error::ResponseError(local_var_error))
633 }
634}
635
636pub fn memo_service_set_memo_relations(configuration: &configuration::Configuration, name: &str, body: models::MemoServiceSetMemoRelationsBody) -> Result<serde_json::Value, Error<MemoServiceSetMemoRelationsError>> {
637 let local_var_configuration = configuration;
638
639 let local_var_client = &local_var_configuration.client;
640
641 let local_var_uri_str = format!("{}/api/v1/{name}/relations", local_var_configuration.base_path, name=crate::apis::urlencode(name));
642 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
643
644 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
645 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
646 }
647 local_var_req_builder = local_var_req_builder.json(&body);
648
649 let local_var_req = local_var_req_builder.build()?;
650 let local_var_resp = local_var_client.execute(local_var_req)?;
651
652 let local_var_status = local_var_resp.status();
653 let local_var_content = local_var_resp.text()?;
654
655 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
656 serde_json::from_str(&local_var_content).map_err(Error::from)
657 } else {
658 let local_var_entity: Option<MemoServiceSetMemoRelationsError> = serde_json::from_str(&local_var_content).ok();
659 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
660 Err(Error::ResponseError(local_var_error))
661 }
662}
663
664pub fn memo_service_set_memo_resources(configuration: &configuration::Configuration, name: &str, body: models::MemoServiceSetMemoResourcesBody) -> Result<serde_json::Value, Error<MemoServiceSetMemoResourcesError>> {
665 let local_var_configuration = configuration;
666
667 let local_var_client = &local_var_configuration.client;
668
669 let local_var_uri_str = format!("{}/api/v1/{name}/resources", local_var_configuration.base_path, name=crate::apis::urlencode(name));
670 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
671
672 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
673 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
674 }
675 local_var_req_builder = local_var_req_builder.json(&body);
676
677 let local_var_req = local_var_req_builder.build()?;
678 let local_var_resp = local_var_client.execute(local_var_req)?;
679
680 let local_var_status = local_var_resp.status();
681 let local_var_content = local_var_resp.text()?;
682
683 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
684 serde_json::from_str(&local_var_content).map_err(Error::from)
685 } else {
686 let local_var_entity: Option<MemoServiceSetMemoResourcesError> = serde_json::from_str(&local_var_content).ok();
687 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
688 Err(Error::ResponseError(local_var_error))
689 }
690}
691
692pub fn memo_service_update_memo(configuration: &configuration::Configuration, memo_name: &str, memo: models::MemoServiceUpdateMemoRequest) -> Result<models::V1Memo, Error<MemoServiceUpdateMemoError>> {
693 let local_var_configuration = configuration;
694
695 let local_var_client = &local_var_configuration.client;
696
697 let local_var_uri_str = format!("{}/api/v1/{memo_name}", local_var_configuration.base_path, memo_name=crate::apis::urlencode(memo_name));
698 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
699
700 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
701 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
702 }
703 local_var_req_builder = local_var_req_builder.json(&memo);
704
705 let local_var_req = local_var_req_builder.build()?;
706 let local_var_resp = local_var_client.execute(local_var_req)?;
707
708 let local_var_status = local_var_resp.status();
709 let local_var_content = local_var_resp.text()?;
710
711 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
712 serde_json::from_str(&local_var_content).map_err(Error::from)
713 } else {
714 let local_var_entity: Option<MemoServiceUpdateMemoError> = serde_json::from_str(&local_var_content).ok();
715 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
716 Err(Error::ResponseError(local_var_error))
717 }
718}
719
720pub fn memo_service_upsert_memo_reaction(configuration: &configuration::Configuration, name: &str, body: models::MemoServiceUpsertMemoReactionBody) -> Result<models::V1Reaction, Error<MemoServiceUpsertMemoReactionError>> {
721 let local_var_configuration = configuration;
722
723 let local_var_client = &local_var_configuration.client;
724
725 let local_var_uri_str = format!("{}/api/v1/{name}/reactions", local_var_configuration.base_path, name=crate::apis::urlencode(name));
726 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
727
728 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
729 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
730 }
731 local_var_req_builder = local_var_req_builder.json(&body);
732
733 let local_var_req = local_var_req_builder.build()?;
734 let local_var_resp = local_var_client.execute(local_var_req)?;
735
736 let local_var_status = local_var_resp.status();
737 let local_var_content = local_var_resp.text()?;
738
739 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
740 serde_json::from_str(&local_var_content).map_err(Error::from)
741 } else {
742 let local_var_entity: Option<MemoServiceUpsertMemoReactionError> = serde_json::from_str(&local_var_content).ok();
743 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
744 Err(Error::ResponseError(local_var_error))
745 }
746}
747