declare class Api { private apiKey; private timeout; private retries; baseUrl: string; constructor(apiKey: string); /** * Set the request timeout * @param ms - The number of milliseconds before the request times out */ setRequestTimeout(ms: number): void; /** * Set the number of retries for the requests * @param retriesCount - The number of retries to make before giving up */ setRetries(retriesCount: number): void; /** * Make a request to the Infusionsoft API * @param method - The request method * @param url - The URL path of the API endpoint * @param data - Data to be sent with the request * @returns The response data * @throws Error if no API key has been set */ makeApiCall(method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH", url: string, data?: object): Promise | undefined>; get(url: string): Promise | undefined>; post(url: string, data: object): Promise | undefined>; put(url: string, data: object): Promise | undefined>; delete(url: string, data?: object): Promise | undefined>; patch(url: string, data?: object): Promise | undefined>; } declare class Paginator { private api; private nextUrl; private previousUrl; private count; private items; constructor(api: Api, items: T[], nextUrl: string | null, previousUrl: string | null, count: number); /** * Fetches the next page of results. * @returns A new Paginator instance with the next page of results. */ next(): Promise | null>; /** * Fetches the previous page of results. * @returns A new Paginator instance with the previous page of results. */ previous(): Promise | null>; /** * Creates a new Paginator instance from the API response. * @param api - The API instance. * @param response - The API response. * @param itemKey - The key of the items in the response. * @returns A new Paginator instance. * @example * function handleResponse(response: any): Paginator { * return Paginator.wrap(api, response, 'items'); * } */ static wrap(api: Api, response: any, itemKey: string): Paginator; /** * Gets the key of the items in the response. * @param response - The API response. * @returns The key of the items in the response. */ private getItemKey; /** * Gets the items of the current page. * @returns The items of the current page. */ getItems(): T[]; /** * Gets the total count of items. * @returns The total count of items. */ getCount(): number; } declare class Contacts { private api; /** * Creates a new Contact model. * @param api - The API client to use for making requests. */ constructor(api: Api); /** * Fetches a list of contacts with optional filtering. * @param parameters - Options for fetching contacts. * @param parameters.email - Optional email address to query on. * @param parameters.family_name - Optional last name or surname to query on. * @param parameters.given_name - Optional first name or forename to query on. * @param parameters.limit - Sets a total of items to return. * @param parameters.offset - Sets a beginning range of items to return. * @param parameters.optional_properties - List of Contact properties to include in the response. * @param parameters.order - Attribute to order items by. * @param parameters.order_direction - How to order the data (ascending or descending). * @param parameters.since - Date to start searching from on LastUpdated (ex. 2017-01-01T22:17:59.039Z). * @param parameters.until - Date to search to on LastUpdated (ex. 2017-01-01T22:17:59.039Z). * @example * const contacts = await contactsInstance.getContacts({ * limit: 5, * offset: 10, * order: "date_created", * order_direction: "DESCENDING" * }); * @returns A paginator containing the list of contacts. */ getContacts(parameters?: { email?: string; family_name?: string; given_name?: string; limit?: number; offset?: number; optional_properties?: string[]; order?: "id" | "date_created" | "last_updated" | "name" | "firstName" | "email"; order_direction?: "ASCENDING" | "DESCENDING"; since?: string; until?: string; }): Promise>; /** * Creates a new contact in Keap. * Note: Contact must contain at least one item in email_addresses or phone_numbers, * and country_code is required if region is specified on the addresses. * @param contactData - The data to create a contact with. * @returns The newly created contact. * @example * const contact = await contactsInstance.createContact({ * given_name: 'John', * family_name: 'Doe', * email_addresses: [ * { * email: "john.doe@example.com", * field: "EMAIL1" * } * ] * }); */ createContact(contactData: IContact): Promise; /** * Updates an existing contact. * @param contactId - The ID of the contact to update. * @param contactData {IContact} - The data to update the contact with. * @returns The updated contact if the API call was successful. * @throws Will throw an error if the API call fails. * @example * const contact = await contacts * .updateContact(123, { * given_name: "Jane", * family_name: "Doe" * }); */ updateContact(contactId: number, contactData: IContact): Promise; /** * Deletes a contact by ID. * @param contactId - The ID of the contact to delete. * @returns True if the contact was successfully deleted. * @example * const result = await contactsInstance.deleteContact(123); * if (result) { * console.log("Contact deleted successfully"); * } */ deleteContact(contactId: number): Promise; /** * Fetches a single contact by ID. * @param contactId - The ID of the contact to fetch. * @returns The contact. * @example * const contact = await contactsInstance.getContact(123); * console.log(contact.given_name); // "Jane" * console.log(contact.family_name); // "Doe" */ getContact(contactId: number): Promise; /** * Fetches the contact model schema. * @returns The contact model. * @example * const contactModel = await contactsInstance.getContactModel(); * console.log(contactModel); */ getContactModel(): Promise; /** * Creates a new custom contact field. * @param customFieldData - The data to create a custom field with. * @returns The newly created custom field. * @example * const customField = await contactsInstance.createCustomField({ * field_type: "Text", * label: "Custom Field Name" * }); */ createCustomField(customFieldData: CustomField): Promise; /** * Creates a new contact if the contact does not exist, or updates the contact if it does. * @param contactData - The data to create or update a contact with. * @returns The newly created or updated contact. * @example * const contact = await contactsInstance.createOrUpdate({ * given_name: "Jane", * family_name: "Doe" * }); * console.log(contact); // {given_name: "Jane", family_name: "Doe", id: 123} */ createOrUpdate(contactData: IContact): Promise; /** * Fetches the credit cards associated with a contact. * @param contactId - The ID of the contact to fetch credit cards for. * @returns The credit cards associated with the contact if the API call was successful. */ getCreditCards(contactId: number): Promise; /** * Creates a new credit card for a contact. * @param contactId - The ID of the contact to add the credit card to. * @param creditCardData - The data to create the credit card with. * @returns The newly created credit card. */ createCreditCard(contactId: number, creditCardData: object): Promise; /** * Fetches the email addresses associated with a contact. * @param contactId - The ID of the contact to fetch email addresses for. * @returns The email addresses associated with the contact if the API call was successful. */ listEmails(contactId: number, options?: { email?: string; limit?: number; offset?: number; }): Promise>; /** * Creates a new email address for a contact. * @param contactId - The ID of the contact to add the email address to. * @param emailData {EmailRecord} - The data to create the email address with. * @returns The newly created email address if the API call was successful. */ createEmail(contactId: number, emailData: EmailRecord): Promise; /** * Fetches the tags applied to a contact. * @param contactId - The ID of the contact to fetch tags for. * @param options - The options to use when fetching tags. * @returns The tags applied to the contact if the API call was successful. */ listAppliedTags(contactId: number, options?: { limit?: number; offset?: number; }): Promise>; /** * Applies a tag to a contact. * @param contactId {number} - The ID of the contact to apply the tag to. * @param tagIds {number[]} - The ID of the tag to apply. * @returns The result of the API call if it was successful. */ applyTags(contactId: number, tagIds: number[]): Promise; /** * Removes a tag from a contact. * @param contactId - The ID of the contact to remove the tag from. * @param tagId - The ID of the tag to remove. * @returns The result of the API call if it was successful. */ removeTag(contactId: number, tagId: number): Promise; /** * Removes multiple tags from a contact. * @param contactId - The ID of the contact to remove the tags from. * @param tagIds - The IDs of the tags to remove. * @param data - Data to be sent with the request. * @returns The result of the API call if it was successful. */ removeTags(contactId: number, tagIds: number[], data: object): Promise; /** * Adds UTM tracking data to a contact. * @param contactId - The ID of the contact to add the UTM data to. * @param utmData - The UTM data to add. * @returns The result of the API call if it was successful. */ addUTM(contactId: number, utmData: UTM): Promise; } declare class Contact { ScoreValue: string | null; addresses: Array<{ country_code: string; field: string; line1: string; line2: string; locality: string; postal_code: string; region: string; zip_code: string; zip_four: string; }> | null; anniversary: Date | null; birthday: Date | null; company: { company_name: string; id: number; } | null; company_name: string | null; contact_type: string | null; custom_fields: Array<{ content: object; id: number; }> | null; date_created: Date | null; email_addresses: Array<{ email: string; field: string; }> | null; email_opted_in: boolean | null; email_status: string | null; family_name: string | null; fax_numbers: Array<{ field: string; number: string; type: string; }> | null; given_name: string | null; id: number; job_title: string | null; last_updated: Date | null; lead_source_id: number | null; middle_name: string | null; opt_in_reason: string | null; origin: { date: Date; ip_address: string; } | null; owner_id: number | null; phone_numbers: Array<{ extension: string; field: string; number: string; type: string; }> | null; preferred_locale: string | null; preferred_name: string | null; prefix: string | null; relationships: Array<{ id: number; linked_contact_id: number; relationship_type_id: number; }> | null; social_accounts: Array<{ name: string; type: string; }> | null; source_type: string | null; spouse_name: string | null; suffix: string | null; tag_ids: Array | null; time_zone: string | null; website: string | null; private contacts; /** * Creates a new Contact instance from the given data and API client. * @param api - The API client to use for making requests. * @param data - The data to use to populate the Contact instance. */ constructor(contacts: Contacts, data: IContact); /** * Updates the contact with the given data. * @param data - The data to update the contact with. * @returns The updated contact if the API call was successful. */ update(data: IContact): Promise; /** * Deletes the contact. * @returns The result of the API call if it was successful. * @throws Will throw an error if the API call fails. */ delete(): Promise; /** * Refreshes the contact data from the API. * @returns The updated contact if the API call was successful. */ refresh(): Promise; /** * Fetches the credit cards associated with this contact. * @returns The credit cards associated with this contact if the API call was successful. */ getCreditCards(): Promise; /** * Creates a new credit card for this contact. * @param data - The data to create the credit card with. * @returns The newly created credit card if the API call was successful. */ addCreditCard(data: object): Promise; /** * Fetches the email addresses associated with this contact. * @param options - The options to use when fetching email addresses. * @returns The email addresses associated with this contact if the API call was successful. */ getEmails(options?: { email?: string; limit?: number; offset?: number; }): Promise>; /** * Adds a new email address to this contact. * @param data - The data to create the email address with. * @returns The newly created email address if the API call was successful. */ addEmail(data: EmailRecord): Promise; /** * Fetches the tags applied to this contact. * @param options - The options to use when fetching tags. * @returns The tags applied to this contact if the API call was successful. */ getAppliedTags(options?: { limit?: number; offset?: number; }): Promise>; /** * Applies the given tags to this contact. * @param tagIds - The IDs of the tags to apply. * @returns The result of the API call if it was successful. */ applyTags(tagIds: number[]): Promise; /** * Removes the given tag from this contact. * @param tagId - The ID of the tag to remove. * @returns The result of the API call if it was successful. */ removeTag(tagId: number): Promise; /** * Removes multiple tags from this contact. * @param tagIds - The IDs of the tags to remove. * @param data - Data to be sent with the request. * @returns The result of the API call if it was successful. */ removeTags(tagIds: number[], data: object): Promise; /** * Adds UTM tracking data to this contact. * @param utmData - The UTM data to add. * @returns The result of the API call if it was successful. */ addUTM(utmData: UTM): Promise; } declare class AccountInfo { private api; /** * Creates a new AccountInfo model. * @param api - The API client to use for making requests. */ constructor(api: Api); /** * Fetches the current account information. * @returns The account information if the API call was successful. */ getAccountInfo(): Promise; /** * Updates the current account information. * @returns The account information if the API call was successful. */ updateAccountInfo(data: IAccountInfo): Promise; } declare class Opportunities { private api; /** * Creates a model. * @param api - The API client to use for making requests. */ constructor(api: Api); /** * Fetches a list of opportunities with optional filtering. * @param parameters - Options for fetching opportunities, like page size and page number. * @param parameters.limit - Sets a total of items to return * @param parameters.offset - Sets a beginning range of items to return * @param parameters.order - Attribute to order items by * @param parameters.search_term - Returns opportunities that match contact or opportunity fields * @param parameters.stage_id - Returns opportunities for the provided stage id * @param parameters.user_id - Returns opportunities for the provided user id * @example * const opportunities = await opportunitiesInstance.getOpportunities({ * limit: 5, * offset: 10, * order: "date_created" * }); * @returns A paginator containing the list of opportunities. */ getOpportunities(parameters?: { limit?: number; offset?: number; order?: "next_action" | "opportunity_name" | "contact_name" | "date_created"; search_term?: string; stage_id?: number; user_id?: number; }): Promise>; /** * Creates a new opportunity. * @param data - The data to create the opportunity with. * @returns The newly created opportunity. * @example * const opportunity = await opportunitiesInstance.createOpportunity({ * contact_id: 1, * opportunity_title: "New Opportunity", * stage_id: 1 * }); */ createOpportunity(data: IOpportunity): Promise; /** * Replaces an existing opportunity. * @param data - The data to replace the opportunity with. * @returns The replaced opportunity. * @example * const updatedOpportunity = await opportunitiesInstance.replaceOpportunity({ * id: 123, * opportunity_title: "Updated Title", * stage_id: 2 * }); */ replaceOpportunity(data: IOpportunity): Promise; /** * Retrieves an opportunity by ID. * @param id - The ID of the opportunity to fetch. * @returns The opportunity. * @example * const opportunity = await opportunitiesInstance.getOpportunity(123); */ getOpportunity(id: number): Promise; /** * Deletes an opportunity by ID. * @param id - The ID of the opportunity to delete. * @returns True if the opportunity was successfully deleted. * @example * const deleted = await opportunitiesInstance.deleteOpportunity(123); * if (deleted) console.log("Opportunity deleted successfully"); */ deleteOpportunity(id: number): Promise; /** * Updates an existing opportunity. * @param data - The data to update the opportunity with. * @returns The updated opportunity. * @example * const updatedOpportunity = await opportunitiesInstance.updateOpportunity({ * id: 123, * opportunity_title: "Updated Title" * }); */ updateOpportunity(data: IOpportunity): Promise; } declare class Opportunity { affiliate_id?: number; contact: ReferenceContact; custom_fields?: Array<{ content: object; id: number; }>; date_created?: string; estimated_close_date?: string; id?: number; include_in_forecast?: number; last_updated?: string; next_action_date?: string; next_action_notes?: string; opportunity_notes?: string; opportunity_title: string; projected_revenue_high?: number; projected_revenue_low?: number; stage: OpportunityStage; user?: { first_name: string; id: number; last_name: string; }; private opportunities; /** * Creates a new Opportunity instance from the given data and Opportunities model. * @param opps - The Opportunities model to use for making requests. * @param data - The data to use to populate the Opportunity instance. * @throws Will throw an error if any of the required fields are missing. */ constructor(opps: Opportunities, data: IOpportunity); /** * Deletes this opportunity. * @returns The result of the API call if it was successful, undefined otherwise. * @throws Will throw an error if the API call fails or if this opportunity does not have an ID. */ delete(): Promise; /** * Updates this opportunity. * @param data - The data to update this opportunity with. * @returns The updated opportunity if the API call was successful, undefined otherwise. * @throws Will throw an error if the API call fails or if this opportunity does not have an ID. */ update(data: IOpportunity): Promise; /** * Refreshes the opportunity data from the API. * @returns The updated opportunity if the API call was successful, undefined otherwise. * @throws Will throw an error if the API call fails or if this opportunity does not have an ID. */ refresh(): Promise; /** * Replaces this opportunity. * @param data - The data to replace this opportunity with. * @returns The replaced opportunity if the API call was successful, undefined otherwise. * @throws Will throw an error if the API call fails or if this opportunity does not have an ID. */ replace(data: IOpportunity): Promise; } declare class Products { private api; /** * Creates a model. * @param api - The API client to use for making requests. */ constructor(api: Api); /** * Fetches a list of products with optional filtering. * @param options - Options for fetching products, like page size and page number. * @param options.active - Filter by active status. * @param options.limit - Maximum number of products to return. * @param options.offset - Number of products to skip. * @returns A paginator containing the list of products. * @example * const products = await productsInstance.getProducts({ * active: true, * limit: 10 * }); */ getProducts(options?: { active?: boolean; limit?: number; offset?: number; }): Promise>; /** * Creates a new product. * @param data - The data to create a product with. * @returns The newly created product. * @example * const product = await productsInstance.createProduct({ * product_name: "New Product", * product_short_description: "A great product", * product_price: 99.99 * }); */ createProduct(data: IProduct): Promise; /** * Fetches a single product by ID. * @param productId - The ID of the product to fetch. * @returns The product. * @example * const product = await productsInstance.getProduct(123); */ getProduct(productId: number): Promise; /** * Updates a product. * @param data - The data to update the product with. * @returns The updated product. * @example * const updatedProduct = await productsInstance.updateProduct({ * id: 123, * product_name: "Updated Product Name" * }); */ updateProduct(data: IProduct): Promise; /** * Deletes a product. * @param productId - The ID of the product to delete. * @returns The result of the API call if it was successful, undefined otherwise. * @throws Will throw an error if the API call fails. */ deleteProduct(productId: number): Promise; /** * Uploads a product image. * @param productId - The ID of the product to upload the image to. * @param fileData - The base64 encoded image data. * @param fileName - The name of the image. * @param checksum - The checksum of the image. * @returns The result of the API call if it was successful, undefined otherwise. * @throws Will throw an error if the API call fails. */ uploadProductImage(productId: number, fileData: Base64Image, fileName: ImageName, checksum?: string): Promise; /** * Deletes the product image associated with the given product id. * @param productId - The ID of the product to delete the image from. * @returns The result of the API call if it was successful, undefined otherwise. * @throws Will throw an error if the API call fails. */ deleteProductImage(productId: number): Promise; /** * Creates a new subscription plan associated with the given product id. * @param productId - The ID of the product to create the subscription plan for. * @param data - The data to create the subscription plan with. * @returns The newly created subscription plan if the API call was successful, undefined otherwise. * @throws Will throw an error if the API call fails. */ createASubscriptionPlan(productId: number, data: IProductSubscription): Promise; /** * Fetches a single subscription plan associated with the given product id. * @param productId - The ID of the product to fetch the subscription plan from. * @param subscriptionId - The ID of the subscription plan to fetch. * @returns The subscription plan if the API call was successful, undefined otherwise. * @throws Will throw an error if the API call fails. */ getASubscriptionPlan(productId: number, subscriptionId: number): Promise; /** * Deletes a subscription plan associated with the given product id. * @param productId - The ID of the product to delete the subscription plan from. * @param subscriptionId - The ID of the subscription plan to delete. * @returns The result of the API call if it was successful, undefined otherwise. * @throws Will throw an error if the API call fails. */ deleteASubscriptionPlan(productId: number, subscriptionId: number): Promise; } declare class Product { private products; active?: boolean; id: number; product_desc?: string; product_name: string; product_price?: number; product_short_desc?: string; sku?: string; subscription_only?: boolean; subscription_plans?: Array; url?: string; /** * Creates a new Product instance from the given data and Products model. * @param products - The Products model to use for making requests. * @param data - The data to use to populate the Product instance. * @throws Will throw an error if any of the required fields are missing. */ constructor(products: Products, data: IProduct); /** * Updates this product with the given data. * @param data - The data to update this product with. * @returns The updated product if the API call was successful, undefined otherwise. */ update(data: IProduct): Promise; /** * Deletes this product. * @returns The result of the API call if it was successful, undefined otherwise. * @throws Will throw an error if the API call fails. */ delete(): Promise; /** * Refreshes this product from the API. * @returns The updated product if the API call was successful, undefined otherwise. * @throws Will throw an error if the API call fails. */ refresh(): Promise; /** * Creates a new subscription plan for this product. * @param data - The data to create the subscription plan with. * @returns The newly created subscription plan if the API call was successful, undefined otherwise. * @throws Will throw an error if the API call fails. */ createSubscriptionPlan(data: IProductSubscription): Promise; /** * Retrieves a subscription plan associated with this product. * @param subscriptionId - The ID of the subscription plan to retrieve. * @returns The subscription plan if the API call was successful, undefined otherwise. * @throws Will throw an error if the API call fails. */ getSubscriptionPlan(subscriptionId: number): Promise; /** * Deletes a subscription plan associated with this product. * @param subscriptionId - The ID of the subscription plan to delete. * @returns The result of the API call if it was successful, undefined otherwise. * @throws Will throw an error if the API call fails. */ deleteSubscriptionPlan(subscriptionId: number): Promise; /** * Uploads a product image associated with this product. * @param fileData - The base64 encoded image data. * @param fileName - The name of the image. * @param checksum - The checksum of the image. * @returns The result of the API call if it was successful, undefined otherwise. * @throws Will throw an error if the API call fails. */ uploadImage(fileData: Base64Image, fileName: ImageName, checksum: string): Promise; /** * Deletes the product image associated with this product. * @returns The result of the API call if it was successful, undefined otherwise. * @throws Will throw an error if the API call fails. */ deleteImage(): Promise; } declare class Ecommerce { private api; /** * Creates a new ecommerce model. * @param api - The API client to use for making requests. */ constructor(api: Api); get Orders(): Order; get Subscriptions(): Subscription; get Transactions(): Transaction; } declare class Order { private api; constructor(api: Api); /** * Fetches a list of orders with optional filtering. * @param params - Optional parameters for filtering orders. * @returns A paginator containing the list of orders. * @example * const orders = await ecommerce.Orders.getOrders({ * limit: 10, * paid: true * }); */ getOrders(params?: { limit?: number; offset?: number; since?: string; until?: string; paid?: boolean; order?: "order_date" | "update_date"; contact_id?: number; }): Promise>; /** * Creates a new order. * @param options - Required order configuration. * @param data - Additional order data. * @returns The newly created order. * @example * const order = await ecommerce.Orders.createOrder( * { * contact_id: 123, * order_date: "2023-01-01T00:00:00Z", * order_title: "New Order", * order_type: "Online" * }, * orderData * ); */ createOrder(options: { contact_id: number; lead_affiliate_id?: number; order_date: string; order_title: string; order_type: string; promo_codes?: string[]; sales_affiliate_id?: number; shipping_address?: ShippingInformation; }, data: IOrder): Promise; /** * Retrieves a specific order by ID. * @param id - The ID of the order to retrieve. * @returns The order. * @example * const order = await ecommerce.Orders.getOrder(123); */ getOrder(id: number): Promise; /** * Deletes an order by ID. * @param id - The ID of the order to delete. * @returns True if the order was successfully deleted. * @example * const deleted = await ecommerce.Orders.deleteOrder(123); * if (deleted) console.log("Order deleted successfully"); */ deleteOrder(id: number): Promise; createItem(orderId: number, data: { description?: string; price?: number; product_id: number; quantity?: number; }): Promise; deleteItem(orderId: number, itemId: number): Promise; getOrderPayments(orderId: number): Promise; createOrderPayment(orderId: number, data: createOrderPayment): Promise; getOrderTransactions(orderId: number, options?: { contact_id?: number; limit?: number; offset?: number; since?: string; until?: string; }): Promise | undefined>; } declare class Subscription { private api; constructor(api: Api); getSubscriptions(): Promise>; createSubscription(data: createSubscription): Promise; } declare class Transaction { private api; constructor(api: Api); getTransactions(options?: { contact_id?: number; limit?: number; offset?: number; since?: string; until?: string; }): Promise | undefined>; getTransaction(id: number): Promise; } declare class Files { private api; /** * Creates a new Files model. * @param api - The API client to use for making requests. */ constructor(api: Api); /** * Lists files with optional filtering options. * @param options - The filtering options. * @returns A paginator containing the list of files. * @example * const files = await filesInstance.listFiles({ * contact_id: 123, * viewable: "PUBLIC" * }); */ listFiles(options?: { contact_id?: number; name?: string; permission?: FileAssociation; type?: FileBoxType | FileCategory; viewable?: "PUBLIC" | "PRIVATE" | "BOTH"; limit?: number; offset?: number; }): Promise>; /** * Uploads a new file. * @param file - The file upload request data. * @returns The uploaded file response. * @example * const uploadedFile = await filesInstance.uploadFile({ * file_data: base64Data, * file_name: "document.pdf", * contact_id: 123 * }); */ uploadFile(file: FileUploadRequest): Promise; /** * Retrieves a file by ID. * @param id - The ID of the file to retrieve. * @returns The file response. * @example * const file = await filesInstance.getFile(123); */ getFile(id: number): Promise; /** * Replaces an existing file by ID. * @param id - The ID of the file to replace. * @param file - The file upload request data. * @returns The replaced file response. * @example * const replacedFile = await filesInstance.replaceFile(123, { * file_data: newBase64Data, * file_name: "updated_document.pdf" * }); */ replaceFile(id: number, file: FileUploadRequest): Promise; /** * Deletes a file by ID. * @param id - The ID of the file to delete. * @returns True if the file was successfully deleted. * @example * const deleted = await filesInstance.deleteFile(123); * if (deleted) console.log("File deleted successfully"); */ deleteFile(id: number): Promise; } declare class Emails { private api; /** * Creates a new Email model. * @param api - The API client to use for making requests. */ constructor(api: Api); /** * Lists emails with optional filtering options. * @param options - The filtering options. * @returns A paginator containing the list of emails. * @example * const emails = await emailsInstance.listEmails({ * contact_id: 123, * limit: 10, * since_sent_date: "2023-01-01T00:00:00Z" * }); */ listEmails(options?: { email?: string; contact_id?: number; ordered?: boolean; since_sent_date?: string; until_sent_date?: string; limit?: number; offset?: number; }): Promise>; /** * Creates a new email record. * @param emailData - The email data to create. * @returns The created email record. * @example * const email = await emailsInstance.createEmail({ * contact_id: 123, * subject: "Welcome!", * html_content: "

Hello World

" * }); */ createEmail(emailData: EmailRecord): Promise; /** * Sends an email. * @param request - The email send request data. * @returns The send email request response. * @example * const result = await emailsInstance.sendEmail({ * email_id: 123, * contact_id: 456 * }); */ sendEmail(request: SendEmailRequest): Promise; /** * Creates a set of email records in batch. * @param emails - The email records to create. * @returns The batch creation response containing the created emails. * @example * const result = await emailsInstance.createASet([email1, email2, email3]); */ createASet(emails: EmailRecord[]): Promise<{ emails: EmailRecord[]; }>; /** * Retrieves an email record by ID. * @param id - The ID of the email record to retrieve. * @returns The email record. * @example * const email = await emailsInstance.get(123); */ get(id: number): Promise; /** * Deletes an email record by ID. * @param id - The ID of the email record to delete. * @returns True if the email was successfully deleted. * @example * const deleted = await emailsInstance.delete(123); * if (deleted) console.log("Email deleted successfully"); */ delete(id: number): Promise; } declare class Users { private api; /** * Creates a new Users model. * @param api - The API client to use for making requests. */ constructor(api: Api); /** * Lists users with optional filtering. * @param options - Optional parameters for filtering users. * @returns A paginator containing the list of users. * @example * const users = await usersInstance.listUsers({ include_inactive: true, limit: 20 }); */ listUsers(options?: { include_inactive?: boolean; include_partners?: boolean; limit?: number; offset?: number; }): Promise>; /** * Creates a new user. * @param data - The user data to create. * @returns The newly created user. * @example * const newUser = await usersInstance.createUser({ * given_name: "John", * family_name: "Doe", * email_address: "john.doe@example.com" * }); */ createUser(data: UserCreateRequest): Promise; } declare class Tags { private api; /** * Creates a new Tags model. * @param api - The API client to use for making requests. */ constructor(api: Api); /** * Fetches all tags with optional filtering. * @param options - Optional parameters for filtering tags. * @returns A paginator containing the list of tags. * @example * const tags = await tagsInstance.listTags({ limit: 10, name: "important" }); */ listTags(options?: { limit?: number; offset?: number; name?: string; category?: string; }): Promise>; /** * Creates a new tag. * @param tag - The tag data to create. * @returns The newly created tag. * @example * const newTag = await tagsInstance.createTag({ name: "VIP Customer" }); */ createTag(tag: ITag): Promise; /** * Creates a new tag category. * @param category - The tag category data to create. * @returns The newly created tag category. */ createTagCategory(category: TagCategory): Promise; /** * Retrieves a specific tag by ID. * @param id - The ID of the tag to retrieve. * @returns The tag information. * @example * const tag = await tagsInstance.getTag(123); */ getTag(id: number): Promise; /** * Lists companies that have been tagged with a specific tag. * @param tagId - The ID of the tag. * @param options - Optional pagination parameters. * @returns A paginator containing the list of tagged companies. */ listTaggedCompanies(tagId: number, options?: { limit?: number; offset?: number; }): Promise>; /** * Lists contacts that have been tagged with a specific tag. * @param tagId - The ID of the tag. * @param options - Optional pagination parameters. * @returns A paginator containing the list of tagged contacts. */ listTaggedContacts(tagId: number, options?: { limit?: number; offset?: number; }): Promise>; /** * Applies a tag to multiple contacts. * @param tagId - The ID of the tag to apply. * @param contactIds - Array of contact IDs to tag. * @returns The response containing information about the applied tag. * @example * const result = await tagsInstance.applyToContact(123, [456, 789]); */ applyToContact(tagId: number, contactIds: number[]): Promise; /** * Removes a tag from multiple contacts. * @param tagId - The ID of the tag to remove. * @param contactIds - Array of contact IDs to remove the tag from. */ removeTagFromContacts(tagId: number, contactIds: number[]): Promise; /** * Removes a tag from a single contact. * @param tagId - The ID of the tag to remove. * @param contactId - The ID of the contact to remove the tag from. */ removeTagFromContact(tagId: number, contactId: number): Promise; } declare class KeapClient { private api; private _accountInfo?; private _contacts?; private _opportunities?; private _products?; private _ecommerce?; private _files?; private _emails?; private _users?; private _tags?; /** * Creates a new instance of KeapClient. * @param parameters - Options to create the client with. * @param parameters.apiKey - The API key to use for authentication. * @param [parameters.requestTimeout] - The number of milliseconds before the request times out. * @param [parameters.retries] - The number of retries to make before giving up. */ constructor(parameters: { apiKey: string; requestTimeout?: number; retries?: number; }); /** * Gets an instance of AccountInfo that can be used to fetch the current account information. * @returns An instance of AccountInfo. */ get AccountInfo(): AccountInfo; /** * Gets an instance of Contact that can be used to create, update, delete, * and fetch contacts. * @returns An instance of Contact. */ get Contacts(): Contacts; get Opportunities(): Opportunities; get Products(): Products; get Ecommerce(): Ecommerce; get Emails(): Emails; get Files(): Files; get Users(): Users; get Tags(): Tags; } export { KeapClient };