import type { ArtifactPatches, BatchPackageFetchResultType, BatchPackageStreamOptions, CreateDependenciesSnapshotOptions, Entitlement, GetOptions, MalwareCheckResult, PatchViewResponse, PostOrgTelemetryPayload, PostOrgTelemetryResponse, QueryParams, SendOptions, SocketSdkGenericResult, SocketSdkOptions, SocketSdkResult, StreamOrgFullScanOptions, UploadManifestFilesError, UploadManifestFilesOptions, UploadManifestFilesReturnType } from './types'; import type { CreateFullScanOptions, DeleteRepositoryLabelResult, DeleteResult, FullScanListResult, FullScanResult, GetRepositoryOptions, ListFullScansOptions, ListRepositoriesOptions, OrganizationsResult, RepositoriesListResult, RepositoryLabelResult, RepositoryLabelsListResult, RepositoryResult, StrictErrorResult } from './types-strict'; import type { HttpResponse } from '@socketsecurity/lib/http-request'; /** * Socket SDK for programmatic access to Socket.dev security analysis APIs. * Provides methods for package scanning, organization management, and security analysis. */ export declare class SocketSdk { #private; /** * Initialize Socket SDK with API token and configuration options. * Sets up authentication, base URL, HTTP client options, retry behavior, and caching. */ constructor(apiToken: string, options?: SocketSdkOptions | undefined); /** * Get package metadata and alerts by PURL strings for a specific organization. * Organization-scoped version of batchPackageFetch with security policy label support. * * @param orgSlug - Organization identifier * @param componentsObj - Object containing array of components with PURL strings * @param queryParams - Optional query parameters including labels, alerts, compact, etc. * @returns Package metadata and alerts for the requested PURLs * * @example * ```typescript * const result = await sdk.batchOrgPackageFetch('my-org', * { * components: [ * { purl: 'pkg:npm/express@4.19.2' }, * { purl: 'pkg:pypi/django@5.0.6' } * ] * }, * { labels: ['production'], alerts: true } * ) * * if (result.success) { * for (const artifact of result.data) { * console.log(`${artifact.name}@${artifact.version}`) * } * } * ``` * * @see https://docs.socket.dev/reference/batchpackagefetchbyorg * @apiEndpoint POST /orgs/{org_slug}/purl * @quota 100 units * @scopes packages:list * @throws {Error} When server returns 5xx status codes */ batchOrgPackageFetch(orgSlug: string, componentsObj: { components: Array<{ purl: string; }>; }, queryParams?: QueryParams | undefined): Promise>; /** * Fetch package analysis data for multiple packages in a single batch request. * Returns all results at once after processing is complete. * * @throws {Error} When server returns 5xx status codes */ batchPackageFetch(componentsObj: { components: Array<{ purl: string; }>; }, queryParams?: QueryParams | undefined): Promise; /** * Stream package analysis data for multiple packages with chunked processing and concurrency control. * Returns results as they become available via async generator. * * @throws {Error} When server returns 5xx status codes */ batchPackageStream(componentsObj: { components: Array<{ purl: string; }>; }, options?: BatchPackageStreamOptions | undefined): AsyncGenerator; /** * Check packages for malware and security alerts. * * For small sets (≤ MAX_FIREWALL_COMPONENTS), uses parallel firewall API * requests which return full artifact data including score and alert details. * * For larger sets, uses the batch PURL API for efficiency. * * Both paths normalize alerts through publicPolicy and only return * malware-relevant results. * * @param components - Array of package URLs to check * @returns Normalized results with policy-filtered alerts per package */ checkMalware(components: Array<{ purl: string; }>): Promise>; /** * Create a snapshot of project dependencies by uploading manifest files. * Analyzes dependency files to generate a comprehensive security report. * * @throws {Error} When server returns 5xx status codes */ createDependenciesSnapshot(filepaths: string[], options?: CreateDependenciesSnapshotOptions | undefined): Promise>; /** * Create a full security scan for an organization. * * Uploads project manifest files and initiates full security analysis. * Returns scan metadata with guaranteed required fields. * * @param orgSlug - Organization identifier * @param filepaths - Array of file paths to upload (package.json, package-lock.json, etc.) * @param options - Scan configuration including repository, branch, and commit details * @returns Full scan metadata including ID and URLs * * @example * ```typescript * const result = await sdk.createFullScan('my-org', * ['package.json', 'package-lock.json'], * { * repo: 'my-repo', * branch: 'main', * commit_message: 'Update dependencies', * commit_hash: 'abc123', * pathsRelativeTo: './my-project' * } * ) * * if (result.success) { * console.log('Scan ID:', result.data.id) * console.log('Report URL:', result.data.html_report_url) * } * ``` * * @see https://docs.socket.dev/reference/createorgfullscan * @apiEndpoint POST /orgs/{org_slug}/full-scans * @quota 0 units * @scopes full-scans:create * @throws {Error} When server returns 5xx status codes */ createFullScan(orgSlug: string, filepaths: string[], options: CreateFullScanOptions): Promise; /** * Create a diff scan from two full scan IDs. * Compares two existing full scans to identify changes. * * @param orgSlug - Organization identifier * @param options - Diff scan creation options * @param options.after - ID of the after/head full scan (newer) * @param options.before - ID of the before/base full scan (older) * @param options.description - Description of the diff scan * @param options.external_href - External URL to associate with the diff scan * @param options.merge - Set true for merged commits, false for open PR diffs * @returns Diff scan details * * @example * ```typescript * const result = await sdk.createOrgDiffScanFromIds('my-org', { * before: 'scan-id-1', * after: 'scan-id-2', * description: 'Compare versions', * merge: false * }) * * if (result.success) { * console.log('Diff scan created:', result.data.diff_scan.id) * } * ``` * * @see https://docs.socket.dev/reference/createorgdiffscanfromids * @apiEndpoint POST /orgs/{org_slug}/diff-scans/from-ids * @quota 0 units * @scopes diff-scans:create, full-scans:list * @throws {Error} When server returns 5xx status codes */ createOrgDiffScanFromIds(orgSlug: string, options: { after: string; before: string; description?: string | undefined; external_href?: string | undefined; merge?: boolean | undefined; }): Promise>; /** * Create a full scan from an archive file (.tar, .tar.gz/.tgz, or .zip). * Uploads and scans a compressed archive of project files. * * @param orgSlug - Organization identifier * @param archivePath - Path to the archive file to upload * @param options - Scan configuration options including repo, branch, and metadata * @returns Created full scan details with scan ID and status * * @throws {Error} When server returns 5xx status codes or file cannot be read */ createOrgFullScanFromArchive(orgSlug: string, archivePath: string, options: { branch?: string | undefined; commit_hash?: string | undefined; commit_message?: string | undefined; committers?: string | undefined; integration_org_slug?: string | undefined; integration_type?: 'api' | 'azure' | 'bitbucket' | 'github' | 'gitlab' | 'web' | undefined; make_default_branch?: boolean | undefined; pull_request?: number | undefined; repo: string; scan_type?: string | undefined; set_as_pending_head?: boolean | undefined; tmp?: boolean | undefined; workspace?: string | undefined; }): Promise>; /** * Create a new webhook for an organization. * Webhooks allow you to receive HTTP POST notifications when specific events occur. * * @param orgSlug - Organization identifier * @param webhookData - Webhook configuration including name, URL, secret, and events * @returns Created webhook details including webhook ID * * @throws {Error} When server returns 5xx status codes */ createOrgWebhook(orgSlug: string, webhookData: { description?: null | string | undefined; events: string[]; filters?: { repositoryIds: null | string[]; } | null | undefined; headers?: null | Record | undefined; name: string; secret: string; url: string; }): Promise>; /** * Create a new repository in an organization. * * Registers a repository for monitoring and security scanning. * * @param orgSlug - Organization identifier * @param repoSlug - Repository name/slug * @param params - Additional repository configuration * @param params.archived - Whether the repository is archived * @param params.default_branch - Default branch of the repository * @param params.description - Description of the repository * @param params.homepage - Homepage URL of the repository * @param params.visibility - Visibility setting ('public' or 'private') * @param params.workspace - Workspace of the repository * @returns Created repository details * * @example * ```typescript * const result = await sdk.createRepository('my-org', 'my-repo', { * description: 'My project repository', * homepage: 'https://example.com', * visibility: 'private' * }) * * if (result.success) { * console.log('Repository created:', result.data.id) * } * ``` * * @see https://docs.socket.dev/reference/createorgrepo * @apiEndpoint POST /orgs/{org_slug}/repos * @quota 0 units * @scopes repo:write * @throws {Error} When server returns 5xx status codes */ createRepository(orgSlug: string, repoSlug: string, params?: { archived?: boolean | undefined; default_branch?: null | string | undefined; description?: null | string | undefined; homepage?: null | string | undefined; visibility?: 'private' | 'public' | undefined; workspace?: string | undefined; } | undefined): Promise; /** * Create a new repository label for an organization. * * Labels can be used to group and organize repositories and apply security/license policies. * * @param orgSlug - Organization identifier * @param labelData - Label configuration (must include name property) * @returns Created label with guaranteed id and name fields * * @example * ```typescript * const result = await sdk.createRepositoryLabel('my-org', { name: 'production' }) * * if (result.success) { * console.log('Label created:', result.data.id) * console.log('Label name:', result.data.name) * } * ``` * * @see https://docs.socket.dev/reference/createorgrepolabel * @apiEndpoint POST /orgs/{org_slug}/repos/labels * @quota 0 units * @scopes repo-label:create * @throws {Error} When server returns 5xx status codes */ createRepositoryLabel(orgSlug: string, labelData: QueryParams): Promise; /** * Delete a full scan from an organization. * * Permanently removes scan data and results. * * @param orgSlug - Organization identifier * @param scanId - Full scan identifier to delete * @returns Success confirmation * * @example * ```typescript * const result = await sdk.deleteFullScan('my-org', 'scan_123') * * if (result.success) { * console.log('Scan deleted successfully') * } * ``` * * @see https://docs.socket.dev/reference/deleteorgfullscan * @apiEndpoint DELETE /orgs/{org_slug}/full-scans/{full_scan_id} * @quota 0 units * @scopes full-scans:delete * @throws {Error} When server returns 5xx status codes */ deleteFullScan(orgSlug: string, scanId: string): Promise; /** * Delete a diff scan from an organization. * Permanently removes diff scan data and results. * * @throws {Error} When server returns 5xx status codes */ deleteOrgDiffScan(orgSlug: string, diffScanId: string): Promise>; /** * Delete a webhook from an organization. * This will stop all future webhook deliveries to the webhook URL. * * @param orgSlug - Organization identifier * @param webhookId - Webhook ID to delete * @returns Success status * * @throws {Error} When server returns 5xx status codes */ deleteOrgWebhook(orgSlug: string, webhookId: string): Promise>; /** * Delete a repository from an organization. * * Removes repository monitoring and associated scan data. * * @param orgSlug - Organization identifier * @param repoSlug - Repository slug/name to delete * @param options - Optional parameters including workspace * @returns Success confirmation * * @example * ```typescript * const result = await sdk.deleteRepository('my-org', 'old-repo') * * if (result.success) { * console.log('Repository deleted') * } * ``` * * @see https://docs.socket.dev/reference/deleteorgrepo * @apiEndpoint DELETE /orgs/{org_slug}/repos/{repo_slug} * @quota 0 units * @scopes repo:write * @throws {Error} When server returns 5xx status codes */ deleteRepository(orgSlug: string, repoSlug: string, options?: GetRepositoryOptions | undefined): Promise; /** * Delete a repository label from an organization. * * Removes label and all its associations (repositories, security policy, license policy, etc.). * * @param orgSlug - Organization identifier * @param labelId - Label identifier * @returns Deletion confirmation * * @example * ```typescript * const result = await sdk.deleteRepositoryLabel('my-org', 'label-id-123') * * if (result.success) { * console.log('Label deleted:', result.data.status) * } * ``` * * @see https://docs.socket.dev/reference/deleteorgrepolabel * @apiEndpoint DELETE /orgs/{org_slug}/repos/labels/{label_id} * @quota 0 units * @scopes repo-label:delete * @throws {Error} When server returns 5xx status codes */ deleteRepositoryLabel(orgSlug: string, labelId: string): Promise; /** * Download full scan files as a tar archive. * * Streams the full scan file contents to the specified output path as a tar file. * Includes size limit enforcement to prevent excessive disk usage. * * @param orgSlug - Organization identifier * @param fullScanId - Full scan identifier * @param outputPath - Local file path to write the tar archive * @returns Download result with success/error status * @throws {Error} When server returns 5xx status codes */ downloadOrgFullScanFilesAsTar(orgSlug: string, fullScanId: string, outputPath: string): Promise>; /** * Download patch file content from Socket blob storage. * Retrieves patched file contents using SSRI hash or hex hash. * * This is a low-level utility method - you'll typically use this after calling * `viewPatch()` to get patch metadata, then download individual patched files. * * @param hash - The blob hash in SSRI (sha256-base64) or hex format * @param options - Optional configuration * @param options.baseUrl - Override blob store URL (for testing) * @returns Promise - The patch file content as UTF-8 string * @throws Error if blob not found (404) or download fails * * @example * ```typescript * const sdk = new SocketSdk('your-api-token') * // First get patch metadata * const patch = await sdk.viewPatch('my-org', 'patch-uuid') * // Then download the actual patched file * const fileContent = await sdk.downloadPatch(patch.files['index.js'].socketBlob) * ``` */ downloadPatch(hash: string, options?: { baseUrl?: string | undefined; } | undefined): Promise; /** * Export scan results in CycloneDX SBOM format. * Returns Software Bill of Materials compliant with CycloneDX standard. * * @throws {Error} When server returns 5xx status codes */ exportCDX(orgSlug: string, fullScanId: string): Promise>; /** * Export vulnerability exploitability data as an OpenVEX v0.2.0 document. * Includes patch data and reachability analysis for vulnerability assessment. * * @param orgSlug - Organization identifier * @param id - Full scan or SBOM report ID * @param options - Optional parameters including author, role, and document_id * @returns OpenVEX document with vulnerability exploitability information * * @example * ```typescript * const result = await sdk.exportOpenVEX('my-org', 'scan-id', { * author: 'Security Team', * role: 'VEX Generator' * }) * * if (result.success) { * console.log('VEX Version:', result.data.version) * console.log('Statements:', result.data.statements.length) * } * ``` * * @see https://docs.socket.dev/reference/exportopenvex * @apiEndpoint GET /orgs/{org_slug}/export/openvex/{id} * @quota 0 units * @scopes report:read * @throws {Error} When server returns 5xx status codes */ exportOpenVEX(orgSlug: string, id: string, options?: { author?: string | undefined; document_id?: string | undefined; role?: string | undefined; } | undefined): Promise>; /** * Export scan results in SPDX SBOM format. * Returns Software Bill of Materials compliant with SPDX standard. * * @throws {Error} When server returns 5xx status codes */ exportSPDX(orgSlug: string, fullScanId: string): Promise>; /** * Execute a raw GET request to any API endpoint with configurable response type. * Supports both throwing (default) and non-throwing modes. * @param urlPath - API endpoint path (e.g., 'organizations') * @param options - Request options including responseType and throws behavior * @returns Raw response, parsed data, or SocketSdkGenericResult based on options */ getApi(urlPath: string, options?: GetOptions | undefined): Promise>; /** * Get list of API tokens for an organization. * Returns organization API tokens with metadata and permissions. * * @throws {Error} When server returns 5xx status codes */ getAPITokens(orgSlug: string): Promise>; /** * Retrieve audit log events for an organization. * Returns chronological log of security and administrative actions. * * @throws {Error} When server returns 5xx status codes */ getAuditLogEvents(orgSlug: string, queryParams?: QueryParams | undefined): Promise>; /** * Get details for a specific diff scan. * Returns comparison between two full scans with artifact changes. * * @throws {Error} When server returns 5xx status codes */ getDiffScanById(orgSlug: string, diffScanId: string): Promise>; /** * Get GitHub-flavored markdown comments for a diff scan. * Returns dependency overview and alert comments suitable for pull requests. * * @param orgSlug - Organization identifier * @param diffScanId - Diff scan identifier * @param options - Optional query parameters * @param options.github_installation_id - GitHub installation ID for settings * @returns Diff scan metadata with formatted markdown comments * * @example * ```typescript * const result = await sdk.getDiffScanGfm('my-org', 'diff-scan-id') * * if (result.success) { * console.log(result.data.dependency_overview_comment) * console.log(result.data.dependency_alert_comment) * } * ``` * * @see https://docs.socket.dev/reference/getdiffscangfm * @apiEndpoint GET /orgs/{org_slug}/diff-scans/{diff_scan_id}/gfm * @quota 0 units * @scopes diff-scans:list * @throws {Error} When server returns 5xx status codes */ getDiffScanGfm(orgSlug: string, diffScanId: string, options?: { github_installation_id?: string | undefined; } | undefined): Promise>; /** * Retrieve the enabled entitlements for an organization. * * This method fetches the organization's entitlements and filters for only the enabled ones, returning their keys. Entitlements represent Socket * Products that the organization has access to use. */ getEnabledEntitlements(orgSlug: string): Promise; /** * Retrieve all entitlements for an organization. * * This method fetches all entitlements (both enabled and disabled) for * an organization, returning the complete list with their status. */ getEntitlements(orgSlug: string): Promise; /** * Get complete full scan results buffered in memory. * * Returns entire scan data as JSON for programmatic processing. * For large scans, consider using streamFullScan() instead. * * @param orgSlug - Organization identifier * @param scanId - Full scan identifier * @returns Complete full scan data including all artifacts * * @example * ```typescript * const result = await sdk.getFullScan('my-org', 'scan_123') * * if (result.success) { * console.log('Scan status:', result.data.scan_state) * console.log('Repository:', result.data.repository_slug) * } * ``` * * @see https://docs.socket.dev/reference/getorgfullscan * @apiEndpoint GET /orgs/{org_slug}/full-scans/{full_scan_id} * @quota 0 units * @scopes full-scans:list * @throws {Error} When server returns 5xx status codes */ getFullScan(orgSlug: string, scanId: string): Promise; /** * Get metadata for a specific full scan. * * Returns scan configuration, status, and summary information without full artifact data. * Useful for checking scan status without downloading complete results. * * @param orgSlug - Organization identifier * @param scanId - Full scan identifier * @returns Scan metadata including status and configuration * * @example * ```typescript * const result = await sdk.getFullScanMetadata('my-org', 'scan_123') * * if (result.success) { * console.log('Scan state:', result.data.scan_state) * console.log('Branch:', result.data.branch) * } * ``` * * @see https://docs.socket.dev/reference/getorgfullscanmetadata * @apiEndpoint GET /orgs/{org_slug}/full-scans/{full_scan_id}/metadata * @quota 0 units * @scopes full-scans:list * @throws {Error} When server returns 5xx status codes */ getFullScanMetadata(orgSlug: string, scanId: string): Promise; /** * Get security issues for a specific npm package and version. * Returns detailed vulnerability and security alert information. * * @throws {Error} When server returns 5xx status codes */ getIssuesByNpmPackage(pkgName: string, version: string): Promise>; /** * List full scans associated with a specific alert. * Returns paginated full scan references for alert investigation. * * @param orgSlug - Organization identifier * @param options - Query parameters including alertKey, range, pagination * @returns Paginated array of full scans associated with the alert * * @example * ```typescript * const result = await sdk.getOrgAlertFullScans('my-org', { * alertKey: 'npm/lodash/cve-2021-23337', * range: '-7d', * per_page: 50 * }) * * if (result.success) { * for (const item of result.data.items) { * console.log('Full Scan ID:', item.fullScanId) * } * } * ``` * * @see https://docs.socket.dev/reference/alertfullscans * @apiEndpoint GET /orgs/{org_slug}/alert-full-scan-search * @quota 10 units * @scopes alerts:list * @throws {Error} When server returns 5xx status codes */ getOrgAlertFullScans(orgSlug: string, options: { alertKey: string; per_page?: number | undefined; range?: string | undefined; startAfterCursor?: string | undefined; }): Promise>; /** * List latest alerts for an organization (Beta). * Returns paginated alerts with comprehensive filtering options. * * @param orgSlug - Organization identifier * @param options - Optional query parameters for pagination and filtering * @returns Paginated list of alerts with cursor-based pagination * * @throws {Error} When server returns 5xx status codes */ getOrgAlertsList(orgSlug: string, options?: { 'filters.alertAction'?: string | undefined; 'filters.alertAction.notIn'?: string | undefined; 'filters.alertCategory'?: string | undefined; 'filters.alertCategory.notIn'?: string | undefined; 'filters.alertCveId'?: string | undefined; 'filters.alertCveId.notIn'?: string | undefined; 'filters.alertCveTitle'?: string | undefined; 'filters.alertCveTitle.notIn'?: string | undefined; 'filters.alertCweId'?: string | undefined; 'filters.alertCweId.notIn'?: string | undefined; 'filters.alertCweName'?: string | undefined; 'filters.alertCweName.notIn'?: string | undefined; 'filters.alertEPSS'?: string | undefined; 'filters.alertEPSS.notIn'?: string | undefined; 'filters.alertFixType'?: string | undefined; 'filters.alertFixType.notIn'?: string | undefined; 'filters.alertKEV'?: boolean | undefined; 'filters.alertKEV.notIn'?: boolean | undefined; 'filters.alertPriority'?: string | undefined; 'filters.alertPriority.notIn'?: string | undefined; 'filters.alertReachabilityType'?: string | undefined; 'filters.alertReachabilityType.notIn'?: string | undefined; 'filters.alertSeverity'?: string | undefined; 'filters.alertSeverity.notIn'?: string | undefined; 'filters.alertStatus'?: string | undefined; 'filters.alertStatus.notIn'?: string | undefined; 'filters.alertType'?: string | undefined; 'filters.alertType.notIn'?: string | undefined; 'filters.alertUpdatedAt.eq'?: string | undefined; 'filters.alertUpdatedAt.gt'?: string | undefined; 'filters.alertUpdatedAt.gte'?: string | undefined; 'filters.alertUpdatedAt.lt'?: string | undefined; 'filters.alertUpdatedAt.lte'?: string | undefined; 'filters.repoFullName'?: string | undefined; 'filters.repoFullName.notIn'?: string | undefined; 'filters.repoLabels'?: string | undefined; 'filters.repoLabels.notIn'?: string | undefined; 'filters.repoSlug'?: string | undefined; 'filters.repoSlug.notIn'?: string | undefined; per_page?: number | undefined; startAfterCursor?: string | undefined; } | undefined): Promise>; /** * Get analytics data for organization usage patterns and security metrics. * Returns statistical analysis for specified time period. * * @throws {Error} When server returns 5xx status codes */ getOrgAnalytics(time: string): Promise>; /** * Fetch available fixes for vulnerabilities in a repository or scan. * Returns fix recommendations including version upgrades and update types. * * @param orgSlug - Organization identifier * @param options - Fix query options including repo_slug or full_scan_id, vulnerability IDs, and preferences * @returns Fix details for requested vulnerabilities with upgrade recommendations * * @throws {Error} When server returns 5xx status codes */ getOrgFixes(orgSlug: string, options: { allow_major_updates: boolean; full_scan_id?: string | undefined; include_details?: boolean | undefined; include_responsible_direct_dependencies?: boolean | undefined; minimum_release_age?: string | undefined; repo_slug?: string | undefined; vulnerability_ids: string; }): Promise>; /** * Get organization's license policy configuration. * Returns allowed, restricted, and monitored license types. * * @throws {Error} When server returns 5xx status codes */ getOrgLicensePolicy(orgSlug: string): Promise>; /** * Get organization's security policy configuration. * Returns alert rules, severity thresholds, and enforcement settings. * * @throws {Error} When server returns 5xx status codes */ getOrgSecurityPolicy(orgSlug: string): Promise>; /** * Get organization's telemetry configuration. * Returns whether telemetry is enabled for the organization. * * @param orgSlug - Organization identifier * @returns Telemetry configuration with enabled status * * @throws {Error} When server returns 5xx status codes */ getOrgTelemetryConfig(orgSlug: string): Promise>; /** * Get organization triage settings and status. * Returns alert triage configuration and current state. * * @throws {Error} When server returns 5xx status codes */ getOrgTriage(orgSlug: string): Promise>; /** * Get details of a specific webhook. * Returns webhook configuration including events, URL, and filters. * * @param orgSlug - Organization identifier * @param webhookId - Webhook ID to retrieve * @returns Webhook details * * @throws {Error} When server returns 5xx status codes */ getOrgWebhook(orgSlug: string, webhookId: string): Promise>; /** * List all webhooks for an organization. * Supports pagination and sorting options. * * @param orgSlug - Organization identifier * @param options - Optional query parameters for pagination and sorting * @returns List of webhooks with pagination info * * @throws {Error} When server returns 5xx status codes */ getOrgWebhooksList(orgSlug: string, options?: { direction?: string | undefined; page?: number | undefined; per_page?: number | undefined; sort?: string | undefined; } | undefined): Promise>; /** * Get current API quota usage and limits. * Returns remaining requests, rate limits, and quota reset times. * * @throws {Error} When server returns 5xx status codes */ getQuota(): Promise>; /** * Get analytics data for a specific repository. * Returns security metrics, dependency trends, and vulnerability statistics. * * @throws {Error} When server returns 5xx status codes */ getRepoAnalytics(repo: string, time: string): Promise>; /** * Get details for a specific repository. * * Returns repository configuration, monitoring status, and metadata. * * @param orgSlug - Organization identifier * @param repoSlug - Repository slug/name * @param options - Optional parameters including workspace * @returns Repository details with configuration * * @example * ```typescript * const result = await sdk.getRepository('my-org', 'my-repo') * * if (result.success) { * console.log('Repository:', result.data.name) * console.log('Visibility:', result.data.visibility) * console.log('Default branch:', result.data.default_branch) * } * ``` * * @see https://docs.socket.dev/reference/getorgrepo * @apiEndpoint GET /orgs/{org_slug}/repos/{repo_slug} * @quota 0 units * @scopes repo:read * @throws {Error} When server returns 5xx status codes */ getRepository(orgSlug: string, repoSlug: string, options?: GetRepositoryOptions | undefined): Promise; /** * Get details for a specific repository label. * * Returns label configuration, associated repositories, and policy settings. * * @param orgSlug - Organization identifier * @param labelId - Label identifier * @returns Label details with guaranteed id and name fields * * @example * ```typescript * const result = await sdk.getRepositoryLabel('my-org', 'label-id-123') * * if (result.success) { * console.log('Label name:', result.data.name) * console.log('Associated repos:', result.data.repository_ids) * console.log('Has security policy:', result.data.has_security_policy) * } * ``` * * @see https://docs.socket.dev/reference/getorgrepolabel * @apiEndpoint GET /orgs/{org_slug}/repos/labels/{label_id} * @quota 0 units * @scopes repo-label:list * @throws {Error} When server returns 5xx status codes */ getRepositoryLabel(orgSlug: string, labelId: string): Promise; /** * Get security score for a specific npm package and version. * Returns numerical security rating and scoring breakdown. * * @throws {Error} When server returns 5xx status codes */ getScoreByNpmPackage(pkgName: string, version: string): Promise>; /** * Get list of supported file types for full scan generation. * Returns glob patterns for supported manifest files, lockfiles, and configuration formats. * * Files whose names match the patterns returned by this endpoint can be uploaded * for report generation. Examples include `package.json`, `package-lock.json`, and `yarn.lock`. * * @param orgSlug - Organization identifier * @returns Nested object with environment and file type patterns * * @example * ```typescript * const result = await sdk.getSupportedFiles('my-org') * * if (result.success) { * console.log('NPM patterns:', result.data.NPM) * console.log('PyPI patterns:', result.data.PyPI) * } * ``` * * @see https://docs.socket.dev/reference/getsupportedfiles * @apiEndpoint GET /orgs/{org_slug}/supported-files * @quota 0 units * @scopes No scopes required, but authentication is required * @throws {Error} When server returns 5xx status codes */ getSupportedFiles(orgSlug: string): Promise>; /** * List all full scans for an organization. * * Returns paginated list of full scan metadata with guaranteed required fields * for improved TypeScript autocomplete. * * @param orgSlug - Organization identifier * @param options - Filtering and pagination options * @returns List of full scans with metadata * * @example * ```typescript * const result = await sdk.listFullScans('my-org', { * branch: 'main', * per_page: 50, * use_cursor: true * }) * * if (result.success) { * result.data.results.forEach(scan => { * console.log(scan.id, scan.created_at) // Guaranteed fields * }) * } * ``` * * @see https://docs.socket.dev/reference/getorgfullscanlist * @apiEndpoint GET /orgs/{org_slug}/full-scans * @quota 0 units * @scopes full-scans:list * @throws {Error} When server returns 5xx status codes */ listFullScans(orgSlug: string, options?: ListFullScansOptions | undefined): Promise; /** * List all organizations accessible to the current user. * * Returns organization details and access permissions with guaranteed required fields. * * @returns List of organizations with metadata * * @example * ```typescript * const result = await sdk.listOrganizations() * * if (result.success) { * result.data.organizations.forEach(org => { * console.log(org.name, org.slug) // Guaranteed fields * }) * } * ``` * * @see https://docs.socket.dev/reference/getorganizations * @apiEndpoint GET /organizations * @quota 0 units * @throws {Error} When server returns 5xx status codes */ listOrganizations(): Promise; /** * List all diff scans for an organization. * Returns paginated list of diff scan metadata and status. * * @throws {Error} When server returns 5xx status codes */ listOrgDiffScans(orgSlug: string): Promise>; /** * List all repositories in an organization. * * Returns paginated list of repository metadata with guaranteed required fields. * * @param orgSlug - Organization identifier * @param options - Pagination and filtering options * @returns List of repositories with metadata * * @example * ```typescript * const result = await sdk.listRepositories('my-org', { * per_page: 50, * sort: 'name', * direction: 'asc' * }) * * if (result.success) { * result.data.results.forEach(repo => { * console.log(repo.name, repo.visibility) * }) * } * ``` * * @see https://docs.socket.dev/reference/getorgrepolist * @apiEndpoint GET /orgs/{org_slug}/repos * @quota 0 units * @scopes repo:list * @throws {Error} When server returns 5xx status codes */ listRepositories(orgSlug: string, options?: ListRepositoriesOptions | undefined): Promise; /** * List all repository labels for an organization. * * Returns paginated list of labels configured for repository organization and policy management. * * @param orgSlug - Organization identifier * @param options - Pagination options * @returns List of labels with guaranteed id and name fields * * @example * ```typescript * const result = await sdk.listRepositoryLabels('my-org', { per_page: 50, page: 1 }) * * if (result.success) { * result.data.results.forEach(label => { * console.log('Label:', label.name) * console.log('Associated repos:', label.repository_ids?.length || 0) * }) * } * ``` * * @see https://docs.socket.dev/reference/getorgrepolabellist * @apiEndpoint GET /orgs/{org_slug}/repos/labels * @quota 0 units * @scopes repo-label:list * @throws {Error} When server returns 5xx status codes */ listRepositoryLabels(orgSlug: string, options?: QueryParams | undefined): Promise; /** * Create a new API token for an organization. * Generates API token with specified scopes and metadata. * * @throws {Error} When server returns 5xx status codes */ postAPIToken(orgSlug: string, tokenData: QueryParams): Promise>; /** * Revoke an API token for an organization. * Permanently disables the token and removes access. * * @throws {Error} When server returns 5xx status codes */ postAPITokensRevoke(orgSlug: string, tokenId: string): Promise>; /** * Rotate an API token for an organization. * Generates new token value while preserving token metadata. * * @throws {Error} When server returns 5xx status codes */ postAPITokensRotate(orgSlug: string, tokenId: string): Promise>; /** * Update an existing API token for an organization. * Modifies token metadata, scopes, or other properties. * * @throws {Error} When server returns 5xx status codes */ postAPITokenUpdate(orgSlug: string, tokenId: string, updateData: QueryParams): Promise>; /** * Post telemetry data for an organization. * Sends telemetry events and analytics data for monitoring and analysis. * * @param orgSlug - Organization identifier * @param telemetryData - Telemetry payload containing events and metrics * @returns Empty object on successful submission * * @throws {Error} When server returns 5xx status codes */ postOrgTelemetry(orgSlug: string, telemetryData: PostOrgTelemetryPayload): Promise>; /** * Update user or organization settings. * Configures preferences, notifications, and security policies. * * @throws {Error} When server returns 5xx status codes */ postSettings(selectors: Array<{ organization?: string | undefined; }>): Promise>; /** * Create a new full scan by rescanning an existing scan. * Supports shallow (policy reapplication) and deep (dependency resolution rerun) modes. * * @param orgSlug - Organization identifier * @param fullScanId - Full scan ID to rescan * @param options - Rescan options including mode (shallow or deep) * @returns New scan ID and status * * @example * ```typescript * // Shallow rescan (reapply policies to cached data) * const result = await sdk.rescanFullScan('my-org', 'scan_123', { * mode: 'shallow' * }) * * if (result.success) { * console.log('New Scan ID:', result.data.id) * console.log('Status:', result.data.status) * } * * // Deep rescan (rerun dependency resolution) * const deepResult = await sdk.rescanFullScan('my-org', 'scan_123', { * mode: 'deep' * }) * ``` * * @see https://docs.socket.dev/reference/rescanorgfullscan * @apiEndpoint POST /orgs/{org_slug}/full-scans/{full_scan_id}/rescan * @quota 0 units * @scopes full-scans:create * @throws {Error} When server returns 5xx status codes */ rescanFullScan(orgSlug: string, fullScanId: string, options?: { mode?: 'shallow' | 'deep' | undefined; } | undefined): Promise>; /** * Search for dependencies across monitored projects. * Returns matching packages with security information and usage patterns. * * @throws {Error} When server returns 5xx status codes */ searchDependencies(queryParams?: QueryParams | undefined): Promise>; /** * Send POST or PUT request with JSON body and return parsed JSON response. * Supports both throwing (default) and non-throwing modes. * @param urlPath - API endpoint path (e.g., 'organizations') * @param options - Request options including method, body, and throws behavior * @returns Parsed JSON response or SocketSdkGenericResult based on options */ sendApi(urlPath: string, options?: SendOptions | undefined): Promise>; /** * Stream a full scan's results to file or stdout. * * Provides efficient streaming for large scan datasets without loading * entire response into memory. Useful for processing large SBOMs. * * @param orgSlug - Organization identifier * @param scanId - Full scan identifier * @param options - Streaming options (output file path, stdout, or buffered) * @returns Scan result with streaming response * * @example * ```typescript * // Stream to file * await sdk.streamFullScan('my-org', 'scan_123', { * output: './scan-results.json' * }) * * // Stream to stdout * await sdk.streamFullScan('my-org', 'scan_123', { * output: true * }) * * // Get buffered response * const result = await sdk.streamFullScan('my-org', 'scan_123') * ``` * * @see https://docs.socket.dev/reference/getorgfullscan * @apiEndpoint GET /orgs/{org_slug}/full-scans/{full_scan_id} * @quota 0 units * @scopes full-scans:list * @throws {Error} When server returns 5xx status codes */ streamFullScan(orgSlug: string, scanId: string, options?: StreamOrgFullScanOptions | undefined): Promise>; /** * Stream patches for artifacts in a scan report. * * This method streams all available patches for artifacts in a scan. * Free tier users will only receive free patches. * * Note: This method returns a ReadableStream for processing large datasets. */ streamPatchesFromScan(orgSlug: string, scanId: string): Promise>; /** * Update alert triage status for an organization. * Modifies alert resolution status and triage decisions. * * @throws {Error} When server returns 5xx status codes */ updateOrgAlertTriage(orgSlug: string, alertId: string, triageData: QueryParams): Promise>; /** * Update organization's license policy configuration. * Modifies allowed, restricted, and monitored license types. * * @throws {Error} When server returns 5xx status codes */ updateOrgLicensePolicy(orgSlug: string, policyData: QueryParams, queryParams?: QueryParams | undefined): Promise>; /** * Update organization's security policy configuration. * Modifies alert rules, severity thresholds, and enforcement settings. * * @throws {Error} When server returns 5xx status codes */ updateOrgSecurityPolicy(orgSlug: string, policyData: QueryParams): Promise>; /** * Update organization's telemetry configuration. * Enables or disables telemetry for the organization. * * @param orgSlug - Organization identifier * @param telemetryData - Telemetry configuration with enabled flag * @returns Updated telemetry configuration * * @throws {Error} When server returns 5xx status codes */ updateOrgTelemetryConfig(orgSlug: string, telemetryData: { enabled?: boolean | undefined; }): Promise>; /** * Update an existing webhook's configuration. * All fields are optional - only provided fields will be updated. * * @param orgSlug - Organization identifier * @param webhookId - Webhook ID to update * @param webhookData - Updated webhook configuration * @returns Updated webhook details * * @throws {Error} When server returns 5xx status codes */ updateOrgWebhook(orgSlug: string, webhookId: string, webhookData: { description?: null | string | undefined; events?: string[] | undefined; filters?: { repositoryIds: null | string[]; } | null | undefined; headers?: null | Record | undefined; name?: string | undefined; secret?: null | string | undefined; url?: string | undefined; }): Promise>; /** * Update configuration for a repository. * * Modifies monitoring settings, branch configuration, and scan preferences. * * @param orgSlug - Organization identifier * @param repoSlug - Repository slug/name * @param params - Configuration updates (description, homepage, default_branch, etc.) * @param options - Optional parameters including workspace * @returns Updated repository details * * @example * ```typescript * const result = await sdk.updateRepository('my-org', 'my-repo', { * description: 'Updated description', * default_branch: 'develop' * }) * * if (result.success) { * console.log('Repository updated:', result.data.name) * } * ``` * * @see https://docs.socket.dev/reference/updateorgrepo * @apiEndpoint POST /orgs/{org_slug}/repos/{repo_slug} * @quota 0 units * @scopes repo:write * @throws {Error} When server returns 5xx status codes */ updateRepository(orgSlug: string, repoSlug: string, params?: QueryParams | undefined, options?: GetRepositoryOptions | undefined): Promise; /** * Update a repository label for an organization. * * Modifies label properties like name. Label names must be non-empty and less than 1000 characters. * * @param orgSlug - Organization identifier * @param labelId - Label identifier * @param labelData - Label updates (typically name property) * @returns Updated label with guaranteed id and name fields * * @example * ```typescript * const result = await sdk.updateRepositoryLabel('my-org', 'label-id-123', { name: 'staging' }) * * if (result.success) { * console.log('Label updated:', result.data.name) * console.log('Label ID:', result.data.id) * } * ``` * * @see https://docs.socket.dev/reference/updateorgrepolabel * @apiEndpoint PUT /orgs/{org_slug}/repos/labels/{label_id} * @quota 0 units * @scopes repo-label:update * @throws {Error} When server returns 5xx status codes */ updateRepositoryLabel(orgSlug: string, labelId: string, labelData: QueryParams): Promise; /** * Upload manifest files for dependency analysis. * Processes package files to create dependency snapshots and security analysis. * * @throws {Error} When server returns 5xx status codes */ uploadManifestFiles(orgSlug: string, filepaths: string[], options?: UploadManifestFilesOptions | undefined): Promise; /** * View detailed information about a specific patch by its UUID. * * This method retrieves comprehensive patch details including files, * vulnerabilities, description, license, and tier information. */ viewPatch(orgSlug: string, uuid: string): Promise; }