Skip to main content

Ghl

Struct Ghl 

Source
pub struct Ghl { /* private fields */ }
Expand description

Async client for the GoHighLevel API 2.0.

Cloning is cheap (Arc internally); share one client across tasks.

// From the environment (GHL_PIT_TOKEN or GHL_ACCESS_TOKEN, optional GHL_BASE_URL):
let ghl = ghl_sdk::Ghl::from_env()?;
// Or explicitly:
let ghl = ghl_sdk::Ghl::builder()
    .private_integration_token("pit-…")
    .build()?;

Implementations§

Source§

impl Ghl

Source

pub fn builder() -> GhlBuilder

Start configuring a client.

Source

pub fn from_env() -> Result<Self>

Build a client from environment variables.

  • GHL_PIT_TOKEN — Private Integration Token, or
  • GHL_ACCESS_TOKEN — OAuth access token
  • GHL_BASE_URL — optional base-URL override
Source

pub fn contacts(&self) -> ContactsService

Contacts API.

Source

pub fn locations(&self) -> LocationsService

Locations (sub-accounts) API.

Source

pub fn opportunities(&self) -> OpportunitiesService

Opportunities (pipeline deals) API.

Source

pub fn conversations(&self) -> ConversationsService

Conversations (threads, messages, sending) API.

Source

pub fn calendars(&self) -> CalendarsService

Calendars (calendars, free slots, appointments) API.

Source

pub fn ad_manager(&self) -> AdManagerService

Available on crate feature ad-manager only.

Typed access to the ad-manager API v2 surface.

Requires the ad-manager cargo feature.

Source

pub fn affiliate_manager(&self) -> AffiliateManagerService

Available on crate feature affiliate-manager only.

Typed access to the affiliate-manager API v2 surface.

Requires the affiliate-manager cargo feature.

Source

pub fn agent_studio(&self) -> AgentStudioService

Available on crate feature agent-studio only.

Typed access to the agent-studio API v2 surface.

Requires the agent-studio cargo feature.

Source

pub fn associations(&self) -> AssociationsService

Available on crate feature associations only.

Typed access to the associations API v2 surface.

Requires the associations cargo feature.

Source

pub fn blogs(&self) -> BlogsService

Available on crate feature blogs only.

Typed access to the blogs API v2 surface.

Requires the blogs cargo feature.

Source

pub fn brand_boards(&self) -> BrandBoardsService

Available on crate feature brand-boards only.

Typed access to the brand-boards API v2 surface.

Requires the brand-boards cargo feature.

Source

pub fn businesses(&self) -> BusinessesService

Available on crate feature businesses only.

Typed access to the businesses API v2 surface.

Requires the businesses cargo feature.

Source

pub fn campaigns(&self) -> CampaignsService

Available on crate feature campaigns only.

Typed access to the campaigns API v2 surface.

Requires the campaigns cargo feature.

Source

pub fn companies(&self) -> CompaniesService

Available on crate feature companies only.

Typed access to the companies API v2 surface.

Requires the companies cargo feature.

Source

pub fn conversation_ai(&self) -> ConversationAiService

Available on crate feature conversation-ai only.

Typed access to the conversation-ai API v2 surface.

Requires the conversation-ai cargo feature.

Source

pub fn courses(&self) -> CoursesService

Available on crate feature courses only.

Typed access to the courses API v2 surface.

Requires the courses cargo feature.

Source

pub fn custom_fields(&self) -> CustomFieldsService

Available on crate feature custom-fields only.

Typed access to the custom-fields API v2 surface.

Requires the custom-fields cargo feature.

Source

pub fn custom_menus(&self) -> CustomMenusService

Available on crate feature custom-menus only.

Typed access to the custom-menus API v2 surface.

Requires the custom-menus cargo feature.

Source

pub fn email_isv(&self) -> EmailIsvService

Available on crate feature email-isv only.

Typed access to the email-isv API v2 surface.

Requires the email-isv cargo feature.

Source

pub fn emails(&self) -> EmailsService

Available on crate feature emails only.

Typed access to the emails API v2 surface.

Requires the emails cargo feature.

Source

pub fn forms(&self) -> FormsService

Available on crate feature forms only.

Typed access to the forms API v2 surface.

Requires the forms cargo feature.

Source

pub fn funnels(&self) -> FunnelsService

Available on crate feature funnels only.

Typed access to the funnels API v2 surface.

Requires the funnels cargo feature.

Source

pub fn invoices(&self) -> InvoicesService

Available on crate feature invoices only.

Typed access to the invoices API v2 surface.

Requires the invoices cargo feature.

Source

pub fn knowledge_base(&self) -> KnowledgeBaseService

Available on crate feature knowledge-base only.

Typed access to the knowledge-base API v2 surface.

Requires the knowledge-base cargo feature.

Available on crate feature links only.

Typed access to the links API v2 surface.

Requires the links cargo feature.

Source

pub fn marketplace(&self) -> MarketplaceService

Available on crate feature marketplace only.

Typed access to the marketplace API v2 surface.

Requires the marketplace cargo feature.

Source

pub fn medias(&self) -> MediasService

Available on crate feature medias only.

Typed access to the medias API v2 surface.

Requires the medias cargo feature.

Source

pub fn oauth(&self) -> OauthService

Available on crate feature oauth only.

Typed access to the oauth API v2 surface.

Requires the oauth cargo feature.

Source

pub fn objects(&self) -> ObjectsService

Available on crate feature objects only.

Typed access to the objects API v2 surface.

Requires the objects cargo feature.

Source

pub fn payments(&self) -> PaymentsService

Available on crate feature payments only.

Typed access to the payments API v2 surface.

Requires the payments cargo feature.

Source

pub fn phone_system(&self) -> PhoneSystemService

Available on crate feature phone-system only.

Typed access to the phone-system API v2 surface.

Requires the phone-system cargo feature.

Source

pub fn products(&self) -> ProductsService

Available on crate feature products only.

Typed access to the products API v2 surface.

Requires the products cargo feature.

Source

pub fn proposals(&self) -> ProposalsService

Available on crate feature proposals only.

Typed access to the proposals API v2 surface.

Requires the proposals cargo feature.

Source

pub fn saas_api(&self) -> SaasApiService

Available on crate feature saas-api only.

Typed access to the saas-api API v2 surface.

Requires the saas-api cargo feature.

Source

pub fn snapshots(&self) -> SnapshotsService

Available on crate feature snapshots only.

Typed access to the snapshots API v2 surface.

Requires the snapshots cargo feature.

Source

pub fn social_media_posting(&self) -> SocialMediaPostingService

Available on crate feature social-media-posting only.

Typed access to the social-media-posting API v2 surface.

Requires the social-media-posting cargo feature.

Source

pub fn store(&self) -> StoreService

Available on crate feature store only.

Typed access to the store API v2 surface.

Requires the store cargo feature.

Source

pub fn surveys(&self) -> SurveysService

Available on crate feature surveys only.

Typed access to the surveys API v2 surface.

Requires the surveys cargo feature.

Source

pub fn users(&self) -> UsersService

Available on crate feature users only.

Typed access to the users API v2 surface.

Requires the users cargo feature.

Source

pub fn voice_ai(&self) -> VoiceAiService

Available on crate feature voice-ai only.

Typed access to the voice-ai API v2 surface.

Requires the voice-ai cargo feature.

Source

pub fn workflows(&self) -> WorkflowsService

Available on crate feature workflows only.

Typed access to the workflows API v2 surface.

Requires the workflows cargo feature.

Source

pub fn v3(&self) -> V3

The API v3 services.

v3 is a parallel, newer surface: 627 operations, including modules that only exist there (ad-publishing, social-planner, saas, chat-widget). Calls made through it send Version: v3.

let dup = ghl.v3().contacts().get_duplicate_contact(&params).await?;
Source

pub fn rate_status(&self) -> RateStatus

The most recently observed rate-limit headroom.

Source

pub async fn as_location( &self, company_id: &str, location_id: &str, ) -> Result<Ghl>

Exchange an agency (Company) token for a location token (POST /oauth/locationToken) and return a new client scoped to that location.

This is the multi-tenant primitive: one agency credential, many sub-accounts.

Source

pub async fn get_raw(&self, path: &str, query: &[(&str, &str)]) -> Result<Value>

GET any API path and return the raw JSON.

Source

pub async fn post_raw(&self, path: &str, body: &impl Serialize) -> Result<Value>

POST any API path with a JSON body and return the raw JSON.

Source

pub async fn request_raw( &self, method: &str, path: &str, query: &[(String, String)], body: Option<&Value>, version: Option<&str>, ) -> Result<Value>

Call any API endpoint with an arbitrary method, query, and body.

This is the fully generic escape hatch. Prefer the typed module services when they cover what you need — they validate inputs and return real types. version overrides the Version header for the endpoints that require a value other than API_VERSION.

Trait Implementations§

Source§

impl Clone for Ghl

Source§

fn clone(&self) -> Ghl

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Ghl

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Ghl

§

impl !UnwindSafe for Ghl

§

impl Freeze for Ghl

§

impl Send for Ghl

§

impl Sync for Ghl

§

impl Unpin for Ghl

§

impl UnsafeUnpin for Ghl

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more