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
impl Ghl
Sourcepub fn builder() -> GhlBuilder
pub fn builder() -> GhlBuilder
Start configuring a client.
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Build a client from environment variables.
GHL_PIT_TOKEN— Private Integration Token, orGHL_ACCESS_TOKEN— OAuth access tokenGHL_BASE_URL— optional base-URL override
Sourcepub fn contacts(&self) -> ContactsService
pub fn contacts(&self) -> ContactsService
Contacts API.
Sourcepub fn locations(&self) -> LocationsService
pub fn locations(&self) -> LocationsService
Locations (sub-accounts) API.
Sourcepub fn opportunities(&self) -> OpportunitiesService
pub fn opportunities(&self) -> OpportunitiesService
Opportunities (pipeline deals) API.
Sourcepub fn conversations(&self) -> ConversationsService
pub fn conversations(&self) -> ConversationsService
Conversations (threads, messages, sending) API.
Sourcepub fn calendars(&self) -> CalendarsService
pub fn calendars(&self) -> CalendarsService
Calendars (calendars, free slots, appointments) API.
Sourcepub fn ad_manager(&self) -> AdManagerService
Available on crate feature ad-manager only.
pub fn ad_manager(&self) -> AdManagerService
ad-manager only.Typed access to the ad-manager API v2 surface.
Requires the ad-manager cargo feature.
Sourcepub fn affiliate_manager(&self) -> AffiliateManagerService
Available on crate feature affiliate-manager only.
pub fn affiliate_manager(&self) -> AffiliateManagerService
affiliate-manager only.Typed access to the affiliate-manager API v2 surface.
Requires the affiliate-manager cargo feature.
Sourcepub fn agent_studio(&self) -> AgentStudioService
Available on crate feature agent-studio only.
pub fn agent_studio(&self) -> AgentStudioService
agent-studio only.Typed access to the agent-studio API v2 surface.
Requires the agent-studio cargo feature.
Sourcepub fn associations(&self) -> AssociationsService
Available on crate feature associations only.
pub fn associations(&self) -> AssociationsService
associations only.Typed access to the associations API v2 surface.
Requires the associations cargo feature.
Sourcepub fn blogs(&self) -> BlogsService
Available on crate feature blogs only.
pub fn blogs(&self) -> BlogsService
blogs only.Typed access to the blogs API v2 surface.
Requires the blogs cargo feature.
Sourcepub fn brand_boards(&self) -> BrandBoardsService
Available on crate feature brand-boards only.
pub fn brand_boards(&self) -> BrandBoardsService
brand-boards only.Typed access to the brand-boards API v2 surface.
Requires the brand-boards cargo feature.
Sourcepub fn businesses(&self) -> BusinessesService
Available on crate feature businesses only.
pub fn businesses(&self) -> BusinessesService
businesses only.Typed access to the businesses API v2 surface.
Requires the businesses cargo feature.
Sourcepub fn campaigns(&self) -> CampaignsService
Available on crate feature campaigns only.
pub fn campaigns(&self) -> CampaignsService
campaigns only.Typed access to the campaigns API v2 surface.
Requires the campaigns cargo feature.
Sourcepub fn companies(&self) -> CompaniesService
Available on crate feature companies only.
pub fn companies(&self) -> CompaniesService
companies only.Typed access to the companies API v2 surface.
Requires the companies cargo feature.
Sourcepub fn conversation_ai(&self) -> ConversationAiService
Available on crate feature conversation-ai only.
pub fn conversation_ai(&self) -> ConversationAiService
conversation-ai only.Typed access to the conversation-ai API v2 surface.
Requires the conversation-ai cargo feature.
Sourcepub fn courses(&self) -> CoursesService
Available on crate feature courses only.
pub fn courses(&self) -> CoursesService
courses only.Typed access to the courses API v2 surface.
Requires the courses cargo feature.
Sourcepub fn custom_fields(&self) -> CustomFieldsService
Available on crate feature custom-fields only.
pub fn custom_fields(&self) -> CustomFieldsService
custom-fields only.Typed access to the custom-fields API v2 surface.
Requires the custom-fields cargo feature.
Available on crate feature custom-menus only.
custom-menus only.Typed access to the custom-menus API v2 surface.
Requires the custom-menus cargo feature.
Sourcepub fn email_isv(&self) -> EmailIsvService
Available on crate feature email-isv only.
pub fn email_isv(&self) -> EmailIsvService
email-isv only.Typed access to the email-isv API v2 surface.
Requires the email-isv cargo feature.
Sourcepub fn emails(&self) -> EmailsService
Available on crate feature emails only.
pub fn emails(&self) -> EmailsService
emails only.Typed access to the emails API v2 surface.
Requires the emails cargo feature.
Sourcepub fn forms(&self) -> FormsService
Available on crate feature forms only.
pub fn forms(&self) -> FormsService
forms only.Typed access to the forms API v2 surface.
Requires the forms cargo feature.
Sourcepub fn funnels(&self) -> FunnelsService
Available on crate feature funnels only.
pub fn funnels(&self) -> FunnelsService
funnels only.Typed access to the funnels API v2 surface.
Requires the funnels cargo feature.
Sourcepub fn invoices(&self) -> InvoicesService
Available on crate feature invoices only.
pub fn invoices(&self) -> InvoicesService
invoices only.Typed access to the invoices API v2 surface.
Requires the invoices cargo feature.
Sourcepub fn knowledge_base(&self) -> KnowledgeBaseService
Available on crate feature knowledge-base only.
pub fn knowledge_base(&self) -> KnowledgeBaseService
knowledge-base only.Typed access to the knowledge-base API v2 surface.
Requires the knowledge-base cargo feature.
Sourcepub fn links(&self) -> LinksService
Available on crate feature links only.
pub fn links(&self) -> LinksService
links only.Typed access to the links API v2 surface.
Requires the links cargo feature.
Sourcepub fn marketplace(&self) -> MarketplaceService
Available on crate feature marketplace only.
pub fn marketplace(&self) -> MarketplaceService
marketplace only.Typed access to the marketplace API v2 surface.
Requires the marketplace cargo feature.
Sourcepub fn medias(&self) -> MediasService
Available on crate feature medias only.
pub fn medias(&self) -> MediasService
medias only.Typed access to the medias API v2 surface.
Requires the medias cargo feature.
Sourcepub fn oauth(&self) -> OauthService
Available on crate feature oauth only.
pub fn oauth(&self) -> OauthService
oauth only.Typed access to the oauth API v2 surface.
Requires the oauth cargo feature.
Sourcepub fn objects(&self) -> ObjectsService
Available on crate feature objects only.
pub fn objects(&self) -> ObjectsService
objects only.Typed access to the objects API v2 surface.
Requires the objects cargo feature.
Sourcepub fn payments(&self) -> PaymentsService
Available on crate feature payments only.
pub fn payments(&self) -> PaymentsService
payments only.Typed access to the payments API v2 surface.
Requires the payments cargo feature.
Sourcepub fn phone_system(&self) -> PhoneSystemService
Available on crate feature phone-system only.
pub fn phone_system(&self) -> PhoneSystemService
phone-system only.Typed access to the phone-system API v2 surface.
Requires the phone-system cargo feature.
Sourcepub fn products(&self) -> ProductsService
Available on crate feature products only.
pub fn products(&self) -> ProductsService
products only.Typed access to the products API v2 surface.
Requires the products cargo feature.
Sourcepub fn proposals(&self) -> ProposalsService
Available on crate feature proposals only.
pub fn proposals(&self) -> ProposalsService
proposals only.Typed access to the proposals API v2 surface.
Requires the proposals cargo feature.
Sourcepub fn saas_api(&self) -> SaasApiService
Available on crate feature saas-api only.
pub fn saas_api(&self) -> SaasApiService
saas-api only.Typed access to the saas-api API v2 surface.
Requires the saas-api cargo feature.
Sourcepub fn snapshots(&self) -> SnapshotsService
Available on crate feature snapshots only.
pub fn snapshots(&self) -> SnapshotsService
snapshots only.Typed access to the snapshots API v2 surface.
Requires the snapshots cargo feature.
Available on crate feature social-media-posting only.
social-media-posting only.Typed access to the social-media-posting API v2 surface.
Requires the social-media-posting cargo feature.
Sourcepub fn store(&self) -> StoreService
Available on crate feature store only.
pub fn store(&self) -> StoreService
store only.Typed access to the store API v2 surface.
Requires the store cargo feature.
Sourcepub fn surveys(&self) -> SurveysService
Available on crate feature surveys only.
pub fn surveys(&self) -> SurveysService
surveys only.Typed access to the surveys API v2 surface.
Requires the surveys cargo feature.
Sourcepub fn users(&self) -> UsersService
Available on crate feature users only.
pub fn users(&self) -> UsersService
users only.Typed access to the users API v2 surface.
Requires the users cargo feature.
Sourcepub fn voice_ai(&self) -> VoiceAiService
Available on crate feature voice-ai only.
pub fn voice_ai(&self) -> VoiceAiService
voice-ai only.Typed access to the voice-ai API v2 surface.
Requires the voice-ai cargo feature.
Sourcepub fn workflows(&self) -> WorkflowsService
Available on crate feature workflows only.
pub fn workflows(&self) -> WorkflowsService
workflows only.Typed access to the workflows API v2 surface.
Requires the workflows cargo feature.
Sourcepub fn v3(&self) -> V3
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(¶ms).await?;Sourcepub fn rate_status(&self) -> RateStatus
pub fn rate_status(&self) -> RateStatus
The most recently observed rate-limit headroom.
Sourcepub async fn as_location(
&self,
company_id: &str,
location_id: &str,
) -> Result<Ghl>
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.
Sourcepub async fn get_raw(&self, path: &str, query: &[(&str, &str)]) -> Result<Value>
pub async fn get_raw(&self, path: &str, query: &[(&str, &str)]) -> Result<Value>
GET any API path and return the raw JSON.
Sourcepub async fn post_raw(&self, path: &str, body: &impl Serialize) -> Result<Value>
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.
Sourcepub async fn request_raw(
&self,
method: &str,
path: &str,
query: &[(String, String)],
body: Option<&Value>,
version: Option<&str>,
) -> Result<Value>
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.