d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
133 lines
4.0 KiB
TypeScript
133 lines
4.0 KiB
TypeScript
import type { GongGetFolderContentParams, GongGetFolderContentResponse } from '@/tools/gong/types'
|
|
import { getGongErrorMessage } from '@/tools/gong/utils'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export const getFolderContentTool: ToolConfig<
|
|
GongGetFolderContentParams,
|
|
GongGetFolderContentResponse
|
|
> = {
|
|
id: 'gong_get_folder_content',
|
|
name: 'Gong Get Folder Content',
|
|
description: 'Retrieve the list of calls in a specific library folder from Gong.',
|
|
version: '1.0.0',
|
|
|
|
params: {
|
|
accessKey: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'Gong API Access Key',
|
|
},
|
|
accessKeySecret: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'Gong API Access Key Secret',
|
|
},
|
|
folderId: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'The library folder ID to retrieve content for',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: (params) => {
|
|
const url = new URL('https://api.gong.io/v2/library/folder-content')
|
|
url.searchParams.set('folderId', params.folderId.trim())
|
|
return url.toString()
|
|
},
|
|
method: 'GET',
|
|
headers: (params) => ({
|
|
'Content-Type': 'application/json',
|
|
Authorization: `Basic ${btoa(`${params.accessKey}:${params.accessKeySecret}`)}`,
|
|
}),
|
|
},
|
|
|
|
transformResponse: async (response: Response) => {
|
|
const data = await response.json()
|
|
if (!response.ok) {
|
|
throw new Error(getGongErrorMessage(data, 'Failed to get folder content'))
|
|
}
|
|
const calls = (data.calls ?? []).map((c: Record<string, unknown>) => ({
|
|
id: (c.id as string) ?? '',
|
|
title: c.title ?? null,
|
|
note: c.note ?? null,
|
|
addedBy: c.addedBy ?? null,
|
|
created: c.created ?? null,
|
|
url: c.url ?? null,
|
|
snippet: c.snippet
|
|
? {
|
|
fromSec: (c.snippet as Record<string, unknown>).fromSec ?? null,
|
|
toSec: (c.snippet as Record<string, unknown>).toSec ?? null,
|
|
}
|
|
: null,
|
|
}))
|
|
return {
|
|
success: true,
|
|
output: {
|
|
folderId: data.id ?? null,
|
|
folderName: data.name ?? null,
|
|
createdBy: data.createdBy ?? null,
|
|
updated: data.updated ?? null,
|
|
calls,
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
folderId: {
|
|
type: 'string',
|
|
description: "Gong's unique numeric identifier for the folder",
|
|
},
|
|
folderName: {
|
|
type: 'string',
|
|
description: 'Display name of the folder',
|
|
},
|
|
createdBy: {
|
|
type: 'string',
|
|
description: "Gong's unique numeric identifier for the user who added the folder",
|
|
},
|
|
updated: {
|
|
type: 'string',
|
|
description: "Folder's last update time in ISO-8601 format",
|
|
},
|
|
calls: {
|
|
type: 'array',
|
|
description: 'List of calls in the library folder',
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
id: { type: 'string', description: 'Gong unique numeric identifier of the call' },
|
|
title: { type: 'string', description: 'The title of the call' },
|
|
note: { type: 'string', description: 'A note attached to the call in the folder' },
|
|
addedBy: {
|
|
type: 'string',
|
|
description: 'Gong unique numeric identifier for the user who added the call',
|
|
},
|
|
created: {
|
|
type: 'string',
|
|
description: 'Date and time the call was added to folder in ISO-8601 format',
|
|
},
|
|
url: { type: 'string', description: 'URL of the call' },
|
|
snippet: {
|
|
type: 'object',
|
|
description: 'Call snippet time range',
|
|
properties: {
|
|
fromSec: {
|
|
type: 'number',
|
|
description: 'Snippet start in seconds relative to call start',
|
|
},
|
|
toSec: {
|
|
type: 'number',
|
|
description: 'Snippet end in seconds relative to call start',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|