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.
//! `courses` — typed methods for all 1 API v3 operations
//! in this module.
//!
//! Access via [`Ghl::v3`](crate::Ghl::v3)`().courses()`. These endpoints send `Version: v3`.
//!
//! Request and response types come from [`ghl_models::v3::courses`](https://docs.rs/ghl-models/latest/ghl_models/v3/courses/); every endpoint is also documented in the
//! [`courses` API reference](https://github.com/Shahroz/ghl-rs/blob/main/docs/api/courses.md).
//!
//! Enable with `features = ["courses"]`.

#![allow(clippy::too_many_arguments)]

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

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

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

impl CoursesService {
    /// Import Courses
    ///
    /// Import Courses through public channels
    ///
    /// `POST /courses/courses-exporter/public/import`
    pub async fn import_courses(
        &self,
        body: &models::PublicExporterPayload,
    ) -> Result<serde_json::Value> {
        let query = Vec::new();
        self.client
            .send_versioned(
                reqwest::Method::POST,
                "/courses/courses-exporter/public/import",
                &query,
                Some(body),
                Some("v3"),
            )
            .await
    }
}