// 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::by_id::get::Request;
use pib_service_api_types::body::by_id::organization::by_id::get::ResponseBody;
use pib_service_core_types::{BodyId, OrganizationId};

use crate::{Authorization, Client};

impl Client {
    pub async fn body_by_id_organization_by_id_get<A: Authorization + Sync>(
        &self,
        authorization: A,
        body_id: BodyId,
        organization_id: OrganizationId,
    ) -> Result<ResponseBody, ReqwestClientError> {
        let response = self
            .execute_authorized(
                Request {
                    body_id,
                    organization_id,
                },
                authorization,
            )
            .await?;
        Ok(response.0)
    }
}
