Files
wehub-resource-sync 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
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

121 lines
3.4 KiB
TypeScript

import type {
DropboxListSharedLinksParams,
DropboxListSharedLinksResponse,
} from '@/tools/dropbox/types'
import type { ToolConfig } from '@/tools/types'
export const dropboxListSharedLinksTool: ToolConfig<
DropboxListSharedLinksParams,
DropboxListSharedLinksResponse
> = {
id: 'dropbox_list_shared_links',
name: 'Dropbox List Shared Links',
description: 'List shared links for a path, or for the entire account if no path is given',
version: '1.0.0',
oauth: {
required: true,
provider: 'dropbox',
},
params: {
path: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Path to list shared links for. If omitted, lists all shared links.',
},
directOnly: {
type: 'boolean',
required: false,
visibility: 'user-only',
description: 'If true, only return links directly to the path, not parent folder links',
},
cursor: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Cursor from a previous call to fetch the next page of results',
},
},
request: {
url: 'https://api.dropboxapi.com/2/sharing/list_shared_links',
method: 'POST',
headers: (params) => {
if (!params.accessToken) {
throw new Error('Missing access token for Dropbox API request')
}
return {
Authorization: `Bearer ${params.accessToken}`,
'Content-Type': 'application/json',
}
},
body: (params) => {
const body: Record<string, any> = {}
if (params.path) {
const trimmedPath = params.path.trim()
// Dropbox only returns every shared link on the account when `path` is omitted
// entirely; sending "" scopes the results to the root folder instead. Since our UI
// tells users "/" means "list all links", omit the field rather than sending "".
if (trimmedPath !== '/' && trimmedPath !== '') {
body.path = trimmedPath
}
}
if (params.directOnly !== undefined) body.direct_only = params.directOnly
if (params.cursor) body.cursor = params.cursor
return body
},
},
transformResponse: async (response) => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.error_summary || data.error?.message || 'Failed to list shared links',
output: {},
}
}
return {
success: true,
output: {
links: data.links ?? [],
hasMore: data.has_more ?? false,
cursor: data.cursor,
},
}
},
outputs: {
links: {
type: 'array',
description: 'Shared links applicable to the path argument',
items: {
type: 'object',
properties: {
'.tag': { type: 'string', description: 'Type: file or folder' },
url: { type: 'string', description: 'The shared link URL' },
name: { type: 'string', description: 'Name of the shared item' },
path_lower: {
type: 'string',
description: 'Lowercase path of the shared item',
optional: true,
},
expires: { type: 'string', description: 'Expiration date if set', optional: true },
},
},
},
hasMore: {
type: 'boolean',
description: 'Whether there are more results',
},
cursor: {
type: 'string',
description: 'Cursor for pagination (only returned when no path is given)',
},
},
}