export type CloseComLead = {
    companyName?: string | null | undefined;
    contactName?: string;
    contactEmail?: string;
    description?: string;
    id?: string | PromiseLike<string>;
};
export type CloseComFieldOptions = [string, string, boolean, boolean][];
type CloseComContactEmail = {
    email: string;
    type: string;
};
export type CloseComLeadCreateResult = {
    status_id: string;
    status_label: string;
    display_name: string;
    addresses: {
        [key: string]: string;
    }[];
    name: string;
    contacts: {
        id: string;
        emails: CloseComContactEmail[];
    }[];
    [key: CloseComCustomActivityCustomField<string>]: string;
    id: string;
};
export type CloseComStatus = {
    id: string;
    organization_id: string;
    label: string;
};
export type CloseComCustomActivityTypeCreate = {
    name: string;
    description: string;
};
export type CloseComContactSearch = {
    data: {
        __object_type: "contact";
        emails: CloseComContactEmail[];
        id: string;
        lead_id: string;
        name: string;
    }[];
    cursor: null;
};
export type CloseComCustomActivityTypeGet = {
    data: {
        api_create_only: boolean;
        created_by: string;
        date_created: string;
        date_updated: string;
        description: string;
        editable_with_roles: string[];
        fields: CloseComCustomActivityFieldGet["data"][number][];
        id: string;
        name: string;
        organization_id: string;
        updated_by: string;
    }[];
    cursor: null;
};
export type CloseComCustomActivityFieldCreate = CloseComCustomContactFieldCreate & {
    custom_activity_type_id: string;
};
export type CloseComCustomContactFieldGet = {
    data: {
        id: string;
        name: string;
        description: string;
        type: string;
        choices?: string[];
        accepts_multiple_values: boolean;
        editable_with_roles: string[];
        date_created: string;
        date_updated: string;
        created_by: string;
        updated_by: string;
        organization_id: string;
    }[];
};
export type CloseComCustomContactFieldCreate = {
    name: string;
    description?: string;
    type: string;
    required: boolean;
    accepts_multiple_values: boolean;
    editable_with_roles: string[];
    choices?: string[];
};
export type CloseComCustomActivityFieldGet = {
    data: {
        id: string;
        name: string;
        description: string;
        type: string;
        choices?: string[];
        accepts_multiple_values: boolean;
        editable_with_roles: string[];
        date_created: string;
        date_updated: string;
        created_by: string;
        updated_by: string;
        organization_id: string;
        custom_activity_type_id: string;
    }[];
};
export type CloseComCustomActivityCreate = {
    custom_activity_type_id: string;
    lead_id: string;
    [key: CloseComCustomActivityCustomField<string>]: string;
};
export type typeCloseComCustomActivityGet = {
    organization_id: string;
    contact_id: string;
    date_updated: string;
    user_name: string;
    created_by_name: "Bruce Wayne";
    id: string;
    created_by: string;
    status: string;
    user_id: string;
    users: string[];
    lead_id: string;
    _type: string;
    updated_by: string;
    custom_activity_type_id: string;
    date_created: string;
    updated_by_name: string;
    [key: CloseComCustomActivityCustomField<string>]: string;
};
type CloseComCustomActivityCustomField<T extends string> = `custom.${T}`;
type CloseComQuery = {
    negate?: boolean;
    queries?: CloseComQuery[] | CloseComCondition[];
    object_type?: string;
    related_object_type?: string;
    related_query?: CloseComQuery;
    this_object_type?: string;
    type?: "object_type" | "has_related" | "and" | "or";
    _fields?: string[];
};
type CloseComCondition = {
    condition: {
        mode: "full_words";
        type: "text";
        value: string;
    };
    field: {
        field_name: string;
        object_type: string;
        type: "regular_field";
    };
    negate: boolean;
    type: "field_condition";
};
export type CloseComCustomFieldCreateResponse = {
    data: {
        id: string;
        name?: string;
        type?: string;
        required?: boolean;
        accepts_multiple_values: boolean;
        editable_with_roles: string[];
        custom_activity_type_id?: string;
    };
};
/**
 * This class to instance communicating to Close.com APIs requires an API Key (legacy) or OAuth.
 *
 * You can either pass to the constructor an API Key or have one defined as an
 * environment variable in case the communication to Close.com is just for
 * one account only, not configurable by any user at any moment.
 */
export default class CloseCom {
    private apiUrl;
    private api_key;
    private refresh_token?;
    private expires_at?;
    private isOAuth;
    private log;
    private userId?;
    constructor(apiKey: string, options?: {
        refresh_token?: string;
        expires_at?: number;
        isOAuth?: boolean;
        userId?: number;
    });
    private getHeaders;
    private shouldRefreshToken;
    private refreshAccessToken;
    me: () => Promise<any>;
    contact: {
        search: ({ emails }: {
            emails: string[];
        }) => Promise<CloseComContactSearch>;
        create: (data: {
            person: {
                name: string | null;
                email: string;
            };
            leadId: string;
        }) => Promise<CloseComContactSearch["data"][number]>;
        update: ({ contactId, ...data }: {
            person: {
                name: string;
                email: string;
            };
            contactId: string;
            leadId?: string;
        }) => Promise<CloseComContactSearch["data"][number]>;
        delete: (contactId: string) => Promise<any>;
    };
    lead: {
        list: ({ query, }: {
            query: CloseComQuery;
        }) => Promise<{
            data: {
                [key: string]: CloseComQuery;
            }[];
        }>;
        status: () => Promise<any>;
        update: (leadId: string, data: CloseComLead) => Promise<CloseComLeadCreateResult>;
        create: (data: CloseComLead) => Promise<CloseComLeadCreateResult>;
        delete: (leadId: string) => Promise<any>;
    };
    customActivity: {
        type: {
            create: (data: CloseComCustomActivityTypeCreate) => Promise<CloseComCustomActivityTypeGet["data"][number]>;
            get: () => Promise<CloseComCustomActivityTypeGet>;
        };
    };
    customField: {
        activity: {
            create: (data: CloseComCustomActivityFieldCreate) => Promise<CloseComCustomActivityFieldGet["data"][number]>;
            get: ({ query }: {
                query: CloseComQuery;
            }) => Promise<CloseComCustomActivityFieldGet>;
        };
        contact: {
            create: (data: CloseComCustomContactFieldCreate) => Promise<CloseComCustomContactFieldGet["data"][number]>;
            get: ({ query }: {
                query: CloseComQuery;
            }) => Promise<CloseComCustomContactFieldGet>;
        };
        shared: {
            get: ({ query }: {
                query: CloseComQuery;
            }) => Promise<CloseComCustomContactFieldGet>;
        };
    };
    activity: {
        custom: {
            create: (data: CloseComCustomActivityCreate) => Promise<CloseComCustomActivityTypeGet["data"][number]>;
            delete: (uuid: string) => Promise<any>;
            update: (uuid: string, data: Partial<CloseComCustomActivityCreate>) => Promise<CloseComCustomActivityTypeGet["data"][number]>;
        };
    };
    private _get;
    private _post;
    private _put;
    private _delete;
    private _request;
}
export declare const closeComQueries: {
    contact: {
        search(contactEmails: string[]): {
            limit: null;
            _fields: {
                contact: string[];
            };
            query: {
                negate: boolean;
                queries: ({
                    negate: boolean;
                    object_type: string;
                    type: string;
                    queries?: undefined;
                } | {
                    negate: boolean;
                    queries: {
                        negate: boolean;
                        related_object_type: string;
                        related_query: {
                            negate: boolean;
                            queries: {
                                condition: {
                                    mode: string;
                                    type: string;
                                    value: string;
                                };
                                field: {
                                    field_name: string;
                                    object_type: string;
                                    type: string;
                                };
                                negate: boolean;
                                type: string;
                            }[];
                            type: string;
                        };
                        this_object_type: string;
                        type: string;
                    }[];
                    type: string;
                    object_type?: undefined;
                })[];
                type: string;
            };
            results_limit: null;
            sort: never[];
        };
        create(data: {
            person: {
                name: string | null;
                email: string;
            };
            leadId: string;
        }): {
            lead_id: string;
            name: string;
            emails: {
                email: string;
                type: string;
            }[];
        };
        update({ person, leadId, ...rest }: {
            person: {
                name: string;
                email: string;
            };
            leadId?: string;
        }): {
            name: string;
            emails: {
                email: string;
                type: string;
            }[];
            lead_id?: string | undefined;
        };
    };
    lead: {
        create({ companyName, contactEmail, contactName, description }: CloseComLead): {
            contacts?: {
                name: string;
                email: string;
                emails: {
                    type: string;
                    email: string;
                }[];
            }[] | undefined;
            description?: string | undefined;
            name: string | null | undefined;
        };
    };
    customActivity: {
        type: {
            create({ name, description }: CloseComCustomActivityTypeCreate): {
                name: string;
                description: string;
                api_create_only: boolean;
                editable_with_roles: string[];
            };
        };
    };
    customField: {
        activity: {
            create({ custom_activity_type_id, name, type, required, accepts_multiple_values, }: CloseComCustomActivityFieldCreate): {
                custom_activity_type_id: string;
                name: string;
                type: string;
                required: boolean;
                accepts_multiple_values: boolean;
                editable_with_roles: never[];
            };
        };
    };
};
export {};
//# sourceMappingURL=CloseCom.d.ts.map