ghl-sdk 0.5.0

Unofficial async Rust SDK for the GoHighLevel (HighLevel) API 2.0 — OAuth 2.0, Private Integration Tokens, rate-limit-aware retries, paginated streams
Documentation
// @generated by xtask/generate_services.py — do not edit by hand.
//! `companies` — typed methods for all 1 API v3 operations
//! in this module.
//!
//! Access via [`Ghl::v3`](crate::Ghl::v3)`().companies()`. These endpoints send `Version: v3`.
//!
//! Request and response types come from [`ghl_models::v3::companies`](https://docs.rs/ghl-models/latest/ghl_models/v3/companies/); every endpoint is also documented in the
//! [`companies` API reference](https://github.com/Shahroz/ghl-rs/blob/main/docs/api/companies.md).
//!
//! Enable with `features = ["companies"]`.

#![allow(clippy::too_many_arguments)]

use crate::client::Ghl;
use crate::error::Result;
use ghl_models::v3::companies as models;

/// Typed access to the `companies` API v3 surface (1 operations). Obtained via
/// [`Ghl::v3`](crate::Ghl::v3)`().companies()`.
#[derive(Debug, Clone)]
pub struct CompaniesService {
    pub(crate) client: Ghl,
}

impl CompaniesService {
    pub(crate) fn new(client: Ghl) -> Self {
        Self { client }
    }
}

impl CompaniesService {
    /// Get Company
    ///
    /// Get Comapny
    ///
    /// `GET /companies/{companyId}`
    ///
    /// Requires scope: `companies.readonly`.
    pub async fn get_company(
        &self,
        company_id: &str,
    ) -> Result<models::GetCompanyByIdSuccessfulResponseDto> {
        let path = format!("/companies/{}", crate::services::encode(company_id));
        let query = Vec::new();
        self.client
            .send_versioned(reqwest::Method::GET, &path, &query, None::<&()>, Some("v3"))
            .await
    }
}