From 696880d39e47987d5c412d042c5fbb7bdf3a2b3b Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Mon, 24 Feb 2025 00:41:07 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../packages/clearbit/src/clearbit-client.ts | 5 +- .../packages/zoominfo/src/zoominfo-client.ts | 47 +++++++++++++++++-- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/legacy/packages/clearbit/src/clearbit-client.ts b/legacy/packages/clearbit/src/clearbit-client.ts index 3f5cbe5a..4ac6eb1e 100644 --- a/legacy/packages/clearbit/src/clearbit-client.ts +++ b/legacy/packages/clearbit/src/clearbit-client.ts @@ -11,9 +11,10 @@ import pThrottle from 'p-throttle' export namespace clearbit { // Allow up to 600 requests per minute by default. + // (10 requests per second) export const throttle = pThrottle({ - limit: 600, - interval: 60 * 1000 + limit: 10, + interval: 1000 }) export const MAX_PAGE_SIZE = 100 diff --git a/legacy/packages/zoominfo/src/zoominfo-client.ts b/legacy/packages/zoominfo/src/zoominfo-client.ts index 551f7808..e4e23fba 100644 --- a/legacy/packages/zoominfo/src/zoominfo-client.ts +++ b/legacy/packages/zoominfo/src/zoominfo-client.ts @@ -73,7 +73,11 @@ export namespace zoominfo { export interface EnrichContactResult { input: Partial> data: EnrichedContact[] - matchStatus?: 'FULL_MATCH' | 'PARTIAL_MATCH' | 'NO_MATCH' + matchStatus?: + | 'FULL_MATCH' + | 'PARTIAL_MATCH' + | 'NO_MATCH' + | 'COMPANY_ONLY_MATCH' } export interface EnrichedContact { @@ -368,7 +372,7 @@ export namespace zoominfo { address?: string // Company address street?: string // Company street state?: string // Company state (U.S.) or province (Canada). You can use free text state or province names (e.g., "new hampshire"), the two-letter common abbreviation for a U.S. state (e.g., "nh"), or values provided in the State lookup endpoint. - zipCode?: string // Zip Code of the company's primary address + zipCode?: string // Zip Code of the company's primary address. country?: string // Country for the company's primary address. You can use free text or see the Country lookup endpoint for values. continent?: string // Continent for the company's primary address. See the Continent lookup endpoint for values. zipCodeRadiusMiles?: string // Used in conjunction with zipCode, designates a geographical radius (in miles) from the zipCode provided. @@ -429,7 +433,7 @@ export namespace zoominfo { address?: string // Company address street?: string // Company street state?: string // Company state (U.S.) or province (Canada). You can use free text state or province names (e.g., "new hampshire"), the two-letter common abbreviation for a U.S. state (e.g., "nh"), or values provided in the State lookup endpoint. Do not use state in conjunction with country in a search request, as the system uses OR logic between these two fields. If both are included in the request, the returned results will reflect all states. - zipCode?: string // Zip Code of the company's primary address + zipCode?: string // Zip Code of the company's primary address. country?: string // Country for the company's primary address. You can use free text or see the Country lookup endpoint for values. Do not use country in conjunction with state in a search request, as the system uses OR logic between these two fields. If both are included in the request, the returned results will reflect all states. continent?: string // Continent for the company's primary address. See the Continent lookup endpoint for values. zipCodeRadiusMiles?: string // Used in conjunction with zipCode, designates a geographical radius (in miles) from the zipCode provided. @@ -625,6 +629,18 @@ export namespace zoominfo { 'totalFundingAmount', 'employeeGrowth' ] as const + + export interface UsageResponse { + usage: Usage[] + } + + export interface Usage { + limitType: string + description: string + limit: number + currentUsage: number + usageRemaining: number + } } /** @@ -693,6 +709,9 @@ export class ZoomInfoClient extends AIFunctionsProvider { * Attempts to authenticate with ZoomInfo using the provided credentials * (either basic auth or PKI auth). If there's already a valid access token, * then it will be reused unless `force` is set to `true`. + * + * NOTE: All API methods call this internally, so there is no reason to call + * this yourself unless you need to force a re-authentication. */ async authenticate({ force = false @@ -1107,6 +1126,28 @@ fullName AND companyId/companyName. Combining these values effectively results i }) .json() } + + /** + * Retrieve current usage stats and available data depending on your + * ZoomInfo plan. + */ + @aiFunction({ + name: 'zoominfo_get_usage', + description: + 'Retrieves current usage stats for available data depending on your ZoomInfo plan.', + inputSchema: z.object({}) + }) + async getUsage() { + await this.authenticate() + + return this.ky + .get('lookup/usage', { + headers: { + Authorization: `Bearer ${this.accessToken}` + } + }) + .json() + } } function getIAT(dtNow: number) {