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
100 lines
2.4 KiB
TypeScript
100 lines
2.4 KiB
TypeScript
import type { ToolConfig } from '@/tools/types'
|
|
import {
|
|
buildZendeskUrl,
|
|
handleZendeskError,
|
|
ORGANIZATION_OUTPUT_PROPERTIES,
|
|
} from '@/tools/zendesk/types'
|
|
|
|
export interface ZendeskGetOrganizationParams {
|
|
email: string
|
|
apiToken: string
|
|
subdomain: string
|
|
organizationId: string
|
|
}
|
|
|
|
export interface ZendeskGetOrganizationResponse {
|
|
success: boolean
|
|
output: {
|
|
organization: any
|
|
organization_id: number
|
|
success: boolean
|
|
}
|
|
}
|
|
|
|
export const zendeskGetOrganizationTool: ToolConfig<
|
|
ZendeskGetOrganizationParams,
|
|
ZendeskGetOrganizationResponse
|
|
> = {
|
|
id: 'zendesk_get_organization',
|
|
name: 'Get Single Organization from Zendesk',
|
|
description: 'Get a single organization by ID from Zendesk',
|
|
version: '1.0.0',
|
|
|
|
params: {
|
|
email: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'Your Zendesk email address',
|
|
},
|
|
apiToken: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'hidden',
|
|
description: 'Zendesk API token',
|
|
},
|
|
subdomain: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'Your Zendesk subdomain',
|
|
},
|
|
organizationId: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Organization ID to retrieve as a numeric string (e.g., "12345")',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: (params) => buildZendeskUrl(params.subdomain, `/organizations/${params.organizationId}`),
|
|
method: 'GET',
|
|
headers: (params) => {
|
|
const credentials = `${params.email}/token:${params.apiToken}`
|
|
const base64Credentials = Buffer.from(credentials).toString('base64')
|
|
return {
|
|
Authorization: `Basic ${base64Credentials}`,
|
|
'Content-Type': 'application/json',
|
|
}
|
|
},
|
|
},
|
|
|
|
transformResponse: async (response: Response) => {
|
|
if (!response.ok) {
|
|
const data = await response.json()
|
|
handleZendeskError(data, response.status, 'get_organization')
|
|
}
|
|
|
|
const data = await response.json()
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
organization: data.organization,
|
|
organization_id: data.organization?.id,
|
|
success: true,
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
organization: {
|
|
type: 'object',
|
|
description: 'Organization object',
|
|
properties: ORGANIZATION_OUTPUT_PROPERTIES,
|
|
},
|
|
organization_id: { type: 'number', description: 'The organization ID' },
|
|
},
|
|
}
|