// SPDX-FileCopyrightText: Politik im Blick developers
// SPDX-FileCopyrightText: Wolfgang Silbermayr <wolfgang@silbermayr.at>
//
// SPDX-License-Identifier: AGPL-3.0-or-later OR EUPL-1.2

use http_request_derive_client_reqwest::ReqwestClientError;
use pib_client_requests::body::by_id::organization::post::Request;
use pib_service_api_types::body::by_id::organization::{
    by_id::get::ResponseBody, post::RequestBody,
};
use pib_service_core_types::BodyId;

use crate::{Authorization, Client};

impl Client {
    pub async fn body_by_id_organization_post<A: Authorization + Sync>(
        &self,
        authorization: A,
        body_id: BodyId,
        payload: RequestBody,
    ) -> Result<ResponseBody, ReqwestClientError> {
        Ok(self
            .execute_authorized(Request { body_id, payload }, authorization)
            .await?
            .0)
    }
}
