///
///
///
///
import { IExecuteFunctions, IHookFunctions, ILoadOptionsFunctions, IDataObject, IHttpRequestMethods, GenericValue, IN8nHttpResponse } from 'n8n-workflow';
import { ICompany, ICustomField, IOpportunity } from '../resources';
import { IContact } from '../resources/contact/contact.types';
import { THttpFullResponse } from '../types/httpRequest';
interface ContactSearchParams {
locationId: string;
page: number;
pageLimit: number;
searchAfter?: Array;
filters?: Array<{
group?: 'AND' | 'OR';
filters?: Array<{
field: string;
operator: string;
value: any;
}>;
field?: string;
operator?: string;
value?: any;
}>;
sort?: Array<{
field: string;
direction: 'asc' | 'desc';
}>;
}
declare type TBody = FormData | GenericValue | GenericValue[] | Buffer | URLSearchParams;
declare type TQueryString = IDataObject;
interface OpportunitySearchParams {
assigned_to?: string;
campaignId?: string;
contact_id?: string;
country?: string;
date?: string;
endDate?: string;
getCalendarEvents?: boolean;
getNotes?: boolean;
getTasks?: boolean;
id?: string;
limit?: number;
order?: string;
page?: number;
pipeline_id?: string;
pipeline_stage_id?: string;
q?: string;
startAfter?: string;
startAfterId?: string;
status?: 'open' | 'won' | 'lost' | 'abandoned' | 'all';
location_id?: string;
}
export declare class GoHighLevelManager {
#private;
static instance: GoHighLevelManager;
private baseURL;
private n8n;
private locationId;
constructor(n8n: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions, locationId: string);
static getInstance(n8n: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions): Promise;
request({ method, path, body, params }: {
method: IHttpRequestMethods;
path: string;
body?: TBody;
params?: TQueryString;
}): Promise;
httpRequestWithAuthentication({ method, path, body, params, verbose }: {
method: IHttpRequestMethods;
path: string;
body?: TBody;
params?: TQueryString;
verbose?: boolean;
}): Promise>;
get(path: string, options?: {
params?: TQueryString;
verbose?: boolean;
}): Promise;
post(path: string, options?: {
body: TBody;
verbose?: boolean;
}): Promise;
put(path: string, options?: {
body: TBody;
verbose?: boolean;
}): Promise;
delete(path: string, options?: {
body: TBody;
verbose?: boolean;
}): Promise;
findContact(params: ContactSearchParams): Promise;
findContactByEmail(email: string): Promise;
createContact(contact: IContact): Promise<{
customFields: {
id: string;
field_value: string;
name: string | undefined;
}[] | undefined;
id?: string | undefined;
email?: string | undefined;
firstName?: string | undefined;
lastName?: string | undefined;
phone?: string | undefined;
tags?: string[] | undefined;
}>;
getContacts(options?: {
params?: TQueryString;
}): Promise<{
customFields: {
id: string;
field_value: string;
name: string | undefined;
}[] | undefined;
id?: string | undefined;
email?: string | undefined;
firstName?: string | undefined;
lastName?: string | undefined;
phone?: string | undefined;
tags?: string[] | undefined;
}[]>;
getContact(contactId: string): Promise<{
customFields: {
id: string;
field_value: string;
name: string | undefined;
}[] | undefined;
id?: string | undefined;
email?: string | undefined;
firstName?: string | undefined;
lastName?: string | undefined;
phone?: string | undefined;
tags?: string[] | undefined;
}>;
updateContact(contactId: string, contact: IContact): Promise<{
customFields: {
id: string;
field_value: string;
name: string | undefined;
}[] | undefined;
id?: string | undefined;
email?: string | undefined;
firstName?: string | undefined;
lastName?: string | undefined;
phone?: string | undefined;
tags?: string[] | undefined;
}>;
upsertContact(contact: IContact): Promise<{
customFields: {
id: string;
field_value: string;
name: string | undefined;
}[] | undefined;
id?: string | undefined;
email?: string | undefined;
firstName?: string | undefined;
lastName?: string | undefined;
phone?: string | undefined;
tags?: string[] | undefined;
}>;
deleteContact(contactId: string): Promise;
addTagToContact(contactId: string, tags: string[]): Promise;
removeTagFromContact(contactId: string, tags: string[]): Promise;
findDuplicateContacts(contact: IContact): Promise;
createCompany(company: ICompany): Promise;
getCompany(companyId: string): Promise;
getCompanies(options?: {
params?: TQueryString;
}): Promise;
updateCompany(companyId: string, company: ICompany): Promise;
deleteCompany(companyId: string): Promise;
addTagsToCompany(companyId: string, tags: string[]): Promise;
removeTagsFromCompany(companyId: string, tags: string[]): Promise;
findOpportunity(params: OpportunitySearchParams): Promise<{
customFields: {
id: string;
fieldValue: string | object | string[] | object[];
name: string | undefined;
}[] | undefined;
id?: string | undefined;
name: string;
value?: number | undefined;
pipelineId?: string | undefined;
pipelineStageId?: string | undefined;
contactId?: string | undefined;
companyId?: string | undefined;
status?: string | undefined;
}>;
createOpportunity(opportunity: IOpportunity): Promise<{
customFields: {
id: string;
fieldValue: string | object | string[] | object[];
name: string | undefined;
}[] | undefined;
id?: string | undefined;
name: string;
value?: number | undefined;
pipelineId?: string | undefined;
pipelineStageId?: string | undefined;
contactId?: string | undefined;
companyId?: string | undefined;
status?: string | undefined;
}>;
getOpportunity(opportunityId: string): Promise<{
customFields: {
id: string;
fieldValue: string | object | string[] | object[];
name: string | undefined;
}[] | undefined;
id?: string | undefined;
name: string;
value?: number | undefined;
pipelineId?: string | undefined;
pipelineStageId?: string | undefined;
contactId?: string | undefined;
companyId?: string | undefined;
status?: string | undefined;
}>;
getOpportunities(options?: {
params?: TQueryString;
}): Promise<{
customFields: {
id: string;
fieldValue: string | object | string[] | object[];
name: string | undefined;
}[] | undefined;
id?: string | undefined;
name: string;
value?: number | undefined;
pipelineId?: string | undefined;
pipelineStageId?: string | undefined;
contactId?: string | undefined;
companyId?: string | undefined;
status?: string | undefined;
}[]>;
updateOpportunity(opportunityId: string, opportunity: Partial): Promise<{
customFields: {
id: string;
fieldValue: string | object | string[] | object[];
name: string | undefined;
}[] | undefined;
id?: string | undefined;
name: string;
value?: number | undefined;
pipelineId?: string | undefined;
pipelineStageId?: string | undefined;
contactId?: string | undefined;
companyId?: string | undefined;
status?: string | undefined;
}>;
deleteOpportunity(opportunityId: string): Promise;
updateOpportunityStage(opportunityId: string, stageId: string): Promise;
updateOpportunityStatus(opportunityId: string, status: string): Promise;
getCustomFields(model?: 'contact' | 'opportunity' | 'all'): Promise;
createCustomField(model: 'contact' | 'opportunity' | 'company', customField: ICustomField): Promise;
getCustomField(customFieldId: string): Promise;
updateCustomField(customFieldId: string, customField: Partial): Promise;
deleteCustomField(customFieldId: string): Promise;
}
export {};