Files
simstudioai--sim/apps/sim/tools/greenhouse/get_user.ts
T
wehub-resource-sync d25d482dc2
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
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

101 lines
3.4 KiB
TypeScript

import type { GreenhouseGetUserParams, GreenhouseGetUserResponse } from '@/tools/greenhouse/types'
import type { ToolConfig } from '@/tools/types'
export const greenhouseGetUserTool: ToolConfig<GreenhouseGetUserParams, GreenhouseGetUserResponse> =
{
id: 'greenhouse_get_user',
name: 'Greenhouse Get User',
description: 'Retrieves a specific Greenhouse user by ID',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Greenhouse Harvest API key',
},
userId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The ID of the user to retrieve',
},
},
request: {
url: (params: GreenhouseGetUserParams) =>
`https://harvest.greenhouse.io/v1/users/${params.userId.trim()}`,
method: 'GET',
headers: (params: GreenhouseGetUserParams) => ({
Authorization: `Basic ${btoa(`${params.apiKey}:`)}`,
'Content-Type': 'application/json',
}),
},
transformResponse: async (response: Response): Promise<GreenhouseGetUserResponse> => {
if (!response.ok) {
return {
success: false,
output: {
id: 0,
name: null,
first_name: null,
last_name: null,
primary_email_address: null,
disabled: false,
site_admin: false,
emails: [],
employee_id: null,
linked_candidate_ids: [],
created_at: null,
updated_at: null,
},
error: `Greenhouse API error: ${response.status} ${response.statusText}`,
}
}
const u = await response.json()
return {
success: true,
output: {
id: u.id ?? 0,
name: u.name ?? null,
first_name: u.first_name ?? null,
last_name: u.last_name ?? null,
primary_email_address: u.primary_email_address ?? null,
disabled: u.disabled ?? false,
site_admin: u.site_admin ?? false,
emails: u.emails ?? [],
employee_id: u.employee_id ?? null,
linked_candidate_ids: u.linked_candidate_ids ?? [],
created_at: u.created_at ?? null,
updated_at: u.updated_at ?? null,
},
}
},
outputs: {
id: { type: 'number', description: 'User ID' },
name: { type: 'string', description: 'Full name' },
first_name: { type: 'string', description: 'First name' },
last_name: { type: 'string', description: 'Last name' },
primary_email_address: { type: 'string', description: 'Primary email address' },
disabled: { type: 'boolean', description: 'Whether the user is disabled' },
site_admin: { type: 'boolean', description: 'Whether the user is a site admin' },
emails: {
type: 'array',
description: 'All email addresses',
items: { type: 'string', description: 'Email address' },
},
employee_id: { type: 'string', description: 'Employee ID', optional: true },
linked_candidate_ids: {
type: 'array',
description: 'IDs of candidates linked to this user',
items: { type: 'number', description: 'Candidate ID' },
},
created_at: { type: 'string', description: 'Creation timestamp (ISO 8601)' },
updated_at: { type: 'string', description: 'Last updated timestamp (ISO 8601)' },
},
}