use reqwest;
use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceCreateMemoError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceCreateMemoCommentError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceDeleteMemoError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceDeleteMemoReactionError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceDeleteMemoTagError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceGetMemoError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceGetMemoByUidError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceListMemoCommentsError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceListMemoPropertiesError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceListMemoReactionsError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceListMemoRelationsError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceListMemoResourcesError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceListMemoTagsError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceListMemosError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceRebuildMemoPropertyError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceRenameMemoTagError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceSetMemoRelationsError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceSetMemoResourcesError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceUpdateMemoError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MemoServiceUpsertMemoReactionError {
DefaultResponse(models::GooglerpcStatus),
UnknownValue(serde_json::Value),
}
pub fn memo_service_create_memo(configuration: &configuration::Configuration, body: models::V1CreateMemoRequest) -> Result<models::V1Memo, Error<MemoServiceCreateMemoError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/memos", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&body);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceCreateMemoError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_create_memo_comment(configuration: &configuration::Configuration, name: &str, comment: models::V1CreateMemoRequest) -> Result<models::V1Memo, Error<MemoServiceCreateMemoCommentError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/{name}/comments", local_var_configuration.base_path, name=crate::apis::urlencode(name));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&comment);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceCreateMemoCommentError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_delete_memo(configuration: &configuration::Configuration, name_4: &str) -> Result<serde_json::Value, Error<MemoServiceDeleteMemoError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/{name_4}", local_var_configuration.base_path, name_4=crate::apis::urlencode(name_4));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceDeleteMemoError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_delete_memo_reaction(configuration: &configuration::Configuration, reaction_id: i32) -> Result<serde_json::Value, Error<MemoServiceDeleteMemoReactionError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/reactions/{reactionId}", local_var_configuration.base_path, reactionId=reaction_id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceDeleteMemoReactionError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_delete_memo_tag(configuration: &configuration::Configuration, parent: &str, tag: &str, delete_related_memos: Option<bool>) -> Result<serde_json::Value, Error<MemoServiceDeleteMemoTagError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
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));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_str) = delete_related_memos {
local_var_req_builder = local_var_req_builder.query(&[("deleteRelatedMemos", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceDeleteMemoTagError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_get_memo(configuration: &configuration::Configuration, name_4: &str) -> Result<models::V1Memo, Error<MemoServiceGetMemoError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/{name_4}", local_var_configuration.base_path, name_4=crate::apis::urlencode(name_4));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceGetMemoError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_get_memo_by_uid(configuration: &configuration::Configuration, uid: &str) -> Result<models::V1Memo, Error<MemoServiceGetMemoByUidError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/memos:by-uid/{uid}", local_var_configuration.base_path, uid=crate::apis::urlencode(uid));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceGetMemoByUidError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_list_memo_comments(configuration: &configuration::Configuration, name: &str) -> Result<models::V1ListMemoCommentsResponse, Error<MemoServiceListMemoCommentsError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/{name}/comments", local_var_configuration.base_path, name=crate::apis::urlencode(name));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceListMemoCommentsError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_list_memo_properties(configuration: &configuration::Configuration, name: &str) -> Result<models::V1ListMemoPropertiesResponse, Error<MemoServiceListMemoPropertiesError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/{name}/properties", local_var_configuration.base_path, name=crate::apis::urlencode(name));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceListMemoPropertiesError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_list_memo_reactions(configuration: &configuration::Configuration, name: &str) -> Result<models::V1ListMemoReactionsResponse, Error<MemoServiceListMemoReactionsError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/{name}/reactions", local_var_configuration.base_path, name=crate::apis::urlencode(name));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceListMemoReactionsError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_list_memo_relations(configuration: &configuration::Configuration, name: &str) -> Result<models::V1ListMemoRelationsResponse, Error<MemoServiceListMemoRelationsError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/{name}/relations", local_var_configuration.base_path, name=crate::apis::urlencode(name));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceListMemoRelationsError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_list_memo_resources(configuration: &configuration::Configuration, name: &str) -> Result<models::V1ListMemoResourcesResponse, Error<MemoServiceListMemoResourcesError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/{name}/resources", local_var_configuration.base_path, name=crate::apis::urlencode(name));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceListMemoResourcesError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_list_memo_tags(configuration: &configuration::Configuration, parent: &str, filter: Option<&str>) -> Result<models::V1ListMemoTagsResponse, Error<MemoServiceListMemoTagsError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/{parent}/tags", local_var_configuration.base_path, parent=crate::apis::urlencode(parent));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = filter {
local_var_req_builder = local_var_req_builder.query(&[("filter", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceListMemoTagsError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_list_memos(configuration: &configuration::Configuration, page_size: Option<i32>, page_token: Option<&str>, filter: Option<&str>) -> Result<models::V1ListMemosResponse, Error<MemoServiceListMemosError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/memos", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = page_size {
local_var_req_builder = local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = page_token {
local_var_req_builder = local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = filter {
local_var_req_builder = local_var_req_builder.query(&[("filter", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceListMemosError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_rebuild_memo_property(configuration: &configuration::Configuration, name: &str, body: serde_json::Value) -> Result<serde_json::Value, Error<MemoServiceRebuildMemoPropertyError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/{name}/properties:rebuild", local_var_configuration.base_path, name=crate::apis::urlencode(name));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&body);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceRebuildMemoPropertyError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_rename_memo_tag(configuration: &configuration::Configuration, parent: &str, body: models::MemoServiceRenameMemoTagBody) -> Result<serde_json::Value, Error<MemoServiceRenameMemoTagError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/{parent}/tags:rename", local_var_configuration.base_path, parent=crate::apis::urlencode(parent));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&body);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceRenameMemoTagError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_set_memo_relations(configuration: &configuration::Configuration, name: &str, body: models::MemoServiceSetMemoRelationsBody) -> Result<serde_json::Value, Error<MemoServiceSetMemoRelationsError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/{name}/relations", local_var_configuration.base_path, name=crate::apis::urlencode(name));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&body);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceSetMemoRelationsError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_set_memo_resources(configuration: &configuration::Configuration, name: &str, body: models::MemoServiceSetMemoResourcesBody) -> Result<serde_json::Value, Error<MemoServiceSetMemoResourcesError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/{name}/resources", local_var_configuration.base_path, name=crate::apis::urlencode(name));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&body);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceSetMemoResourcesError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_update_memo(configuration: &configuration::Configuration, memo_name: &str, memo: models::MemoServiceUpdateMemoRequest) -> Result<models::V1Memo, Error<MemoServiceUpdateMemoError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/{memo_name}", local_var_configuration.base_path, memo_name=crate::apis::urlencode(memo_name));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&memo);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceUpdateMemoError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub fn memo_service_upsert_memo_reaction(configuration: &configuration::Configuration, name: &str, body: models::MemoServiceUpsertMemoReactionBody) -> Result<models::V1Reaction, Error<MemoServiceUpsertMemoReactionError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/api/v1/{name}/reactions", local_var_configuration.base_path, name=crate::apis::urlencode(name));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&body);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req)?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text()?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MemoServiceUpsertMemoReactionError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}