@socketsecurity/sdk 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import type { ArtifactPatches, BatchPackageFetchResultType, BatchPackageStreamOptions, CreateDependenciesSnapshotOptions, Entitlement, GetOptions, PatchViewResponse, PostOrgTelemetryPayload, PostOrgTelemetryResponse, QueryParams, SendOptions, SocketSdkGenericResult, SocketSdkOptions, SocketSdkResult, StreamOrgFullScanOptions, UploadManifestFilesError, UploadManifestFilesOptions, UploadManifestFilesReturnType } from './types';
2
- import type { CreateFullScanOptions, DeleteRepositoryLabelResult, DeleteResult, FullScanListResult, FullScanResult, ListFullScansOptions, ListRepositoriesOptions, OrganizationsResult, RepositoriesListResult, RepositoryLabelResult, RepositoryLabelsListResult, RepositoryResult, StrictErrorResult } from './types-strict';
2
+ import type { CreateFullScanOptions, DeleteRepositoryLabelResult, DeleteResult, FullScanListResult, FullScanResult, GetRepositoryOptions, ListFullScansOptions, ListRepositoriesOptions, OrganizationsResult, RepositoriesListResult, RepositoryLabelResult, RepositoryLabelsListResult, RepositoryResult, StrictErrorResult } from './types-strict';
3
3
  import type { IncomingMessage } from 'node:http';
4
4
  /**
5
5
  * Socket SDK for programmatic access to Socket.dev security analysis APIs.
@@ -12,6 +12,45 @@ export declare class SocketSdk {
12
12
  * Sets up authentication, base URL, HTTP client options, retry behavior, and caching.
13
13
  */
14
14
  constructor(apiToken: string, options?: SocketSdkOptions | undefined);
15
+ /**
16
+ * Get package metadata and alerts by PURL strings for a specific organization.
17
+ * Organization-scoped version of batchPackageFetch with security policy label support.
18
+ *
19
+ * @param orgSlug - Organization identifier
20
+ * @param componentsObj - Object containing array of components with PURL strings
21
+ * @param queryParams - Optional query parameters including labels, alerts, compact, etc.
22
+ * @returns Package metadata and alerts for the requested PURLs
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const result = await sdk.batchOrgPackageFetch('my-org',
27
+ * {
28
+ * components: [
29
+ * { purl: 'pkg:npm/express@4.19.2' },
30
+ * { purl: 'pkg:pypi/django@5.0.6' }
31
+ * ]
32
+ * },
33
+ * { labels: ['production'], alerts: true }
34
+ * )
35
+ *
36
+ * if (result.success) {
37
+ * for (const artifact of result.data) {
38
+ * console.log(`${artifact.name}@${artifact.version}`)
39
+ * }
40
+ * }
41
+ * ```
42
+ *
43
+ * @see https://docs.socket.dev/reference/batchpackagefetchbyorg
44
+ * @apiEndpoint POST /orgs/{org_slug}/purl
45
+ * @quota 100 units
46
+ * @scopes packages:list
47
+ * @throws {Error} When server returns 5xx status codes
48
+ */
49
+ batchOrgPackageFetch(orgSlug: string, componentsObj: {
50
+ components: Array<{
51
+ purl: string;
52
+ }>;
53
+ }, queryParams?: QueryParams | undefined): Promise<SocketSdkResult<'batchPackageFetchByOrg'>>;
15
54
  /**
16
55
  * Fetch package analysis data for multiple packages in a single batch request.
17
56
  * Returns all results at once after processing is complete.
@@ -41,13 +80,6 @@ export declare class SocketSdk {
41
80
  * @throws {Error} When server returns 5xx status codes
42
81
  */
43
82
  createDependenciesSnapshot(filepaths: string[], options?: CreateDependenciesSnapshotOptions | undefined): Promise<SocketSdkResult<'createDependenciesSnapshot'>>;
44
- /**
45
- * Create a diff scan from two full scan IDs.
46
- * Compares two existing full scans to identify changes.
47
- *
48
- * @throws {Error} When server returns 5xx status codes
49
- */
50
- createOrgDiffScanFromIds(orgSlug: string, queryParams?: QueryParams | undefined): Promise<SocketSdkResult<'createOrgDiffScanFromIds'>>;
51
83
  /**
52
84
  * Create a full security scan for an organization.
53
85
  *
@@ -85,6 +117,60 @@ export declare class SocketSdk {
85
117
  * @throws {Error} When server returns 5xx status codes
86
118
  */
87
119
  createFullScan(orgSlug: string, filepaths: string[], options: CreateFullScanOptions): Promise<FullScanResult | StrictErrorResult>;
120
+ /**
121
+ * Create a diff scan from two full scan IDs.
122
+ * Compares two existing full scans to identify changes.
123
+ *
124
+ * @throws {Error} When server returns 5xx status codes
125
+ */
126
+ createOrgDiffScanFromIds(orgSlug: string, queryParams?: QueryParams | undefined): Promise<SocketSdkResult<'createOrgDiffScanFromIds'>>;
127
+ /**
128
+ * Create a full scan from an archive file (.tar, .tar.gz/.tgz, or .zip).
129
+ * Uploads and scans a compressed archive of project files.
130
+ *
131
+ * @param orgSlug - Organization identifier
132
+ * @param archivePath - Path to the archive file to upload
133
+ * @param options - Scan configuration options including repo, branch, and metadata
134
+ * @returns Created full scan details with scan ID and status
135
+ *
136
+ * @throws {Error} When server returns 5xx status codes or file cannot be read
137
+ */
138
+ createOrgFullScanFromArchive(orgSlug: string, archivePath: string, options: {
139
+ branch?: string | undefined;
140
+ commit_hash?: string | undefined;
141
+ commit_message?: string | undefined;
142
+ committers?: string | undefined;
143
+ integration_org_slug?: string | undefined;
144
+ integration_type?: 'api' | 'azure' | 'bitbucket' | 'github' | 'gitlab' | 'web' | undefined;
145
+ make_default_branch?: boolean | undefined;
146
+ pull_request?: number | undefined;
147
+ repo: string;
148
+ scan_type?: string | undefined;
149
+ set_as_pending_head?: boolean | undefined;
150
+ tmp?: boolean | undefined;
151
+ workspace?: string | undefined;
152
+ }): Promise<SocketSdkResult<'CreateOrgFullScanArchive'>>;
153
+ /**
154
+ * Create a new webhook for an organization.
155
+ * Webhooks allow you to receive HTTP POST notifications when specific events occur.
156
+ *
157
+ * @param orgSlug - Organization identifier
158
+ * @param webhookData - Webhook configuration including name, URL, secret, and events
159
+ * @returns Created webhook details including webhook ID
160
+ *
161
+ * @throws {Error} When server returns 5xx status codes
162
+ */
163
+ createOrgWebhook(orgSlug: string, webhookData: {
164
+ description?: null | string | undefined;
165
+ events: string[];
166
+ filters?: {
167
+ repositoryIds: null | string[];
168
+ } | null | undefined;
169
+ headers?: null | Record<string, unknown> | undefined;
170
+ name: string;
171
+ secret: string;
172
+ url: string;
173
+ }): Promise<SocketSdkResult<'createOrgWebhook'>>;
88
174
  /**
89
175
  * Create a new repository in an organization.
90
176
  *
@@ -140,39 +226,6 @@ export declare class SocketSdk {
140
226
  * @throws {Error} When server returns 5xx status codes
141
227
  */
142
228
  createRepositoryLabel(orgSlug: string, labelData: QueryParams): Promise<RepositoryLabelResult | StrictErrorResult>;
143
- /**
144
- * Create a full scan from an archive file (.tar, .tar.gz/.tgz, or .zip).
145
- * Uploads and scans a compressed archive of project files.
146
- *
147
- * @param orgSlug - Organization identifier
148
- * @param archivePath - Path to the archive file to upload
149
- * @param options - Scan configuration options including repo, branch, and metadata
150
- * @returns Created full scan details with scan ID and status
151
- *
152
- * @throws {Error} When server returns 5xx status codes or file cannot be read
153
- */
154
- createOrgFullScanFromArchive(orgSlug: string, archivePath: string, options: {
155
- branch?: string | undefined;
156
- commit_hash?: string | undefined;
157
- commit_message?: string | undefined;
158
- committers?: string | undefined;
159
- integration_org_slug?: string | undefined;
160
- integration_type?: 'api' | 'azure' | 'bitbucket' | 'github' | 'gitlab' | 'web' | undefined;
161
- make_default_branch?: boolean | undefined;
162
- pull_request?: number | undefined;
163
- repo: string;
164
- scan_type?: string | undefined;
165
- set_as_pending_head?: boolean | undefined;
166
- tmp?: boolean | undefined;
167
- workspace?: string | undefined;
168
- }): Promise<SocketSdkResult<'CreateOrgFullScanArchive'>>;
169
- /**
170
- * Delete a diff scan from an organization.
171
- * Permanently removes diff scan data and results.
172
- *
173
- * @throws {Error} When server returns 5xx status codes
174
- */
175
- deleteOrgDiffScan(orgSlug: string, diffScanId: string): Promise<SocketSdkResult<'deleteOrgDiffScan'>>;
176
229
  /**
177
230
  * Delete a full scan from an organization.
178
231
  *
@@ -198,6 +251,24 @@ export declare class SocketSdk {
198
251
  * @throws {Error} When server returns 5xx status codes
199
252
  */
200
253
  deleteFullScan(orgSlug: string, scanId: string): Promise<DeleteResult | StrictErrorResult>;
254
+ /**
255
+ * Delete a diff scan from an organization.
256
+ * Permanently removes diff scan data and results.
257
+ *
258
+ * @throws {Error} When server returns 5xx status codes
259
+ */
260
+ deleteOrgDiffScan(orgSlug: string, diffScanId: string): Promise<SocketSdkResult<'deleteOrgDiffScan'>>;
261
+ /**
262
+ * Delete a webhook from an organization.
263
+ * This will stop all future webhook deliveries to the webhook URL.
264
+ *
265
+ * @param orgSlug - Organization identifier
266
+ * @param webhookId - Webhook ID to delete
267
+ * @returns Success status
268
+ *
269
+ * @throws {Error} When server returns 5xx status codes
270
+ */
271
+ deleteOrgWebhook(orgSlug: string, webhookId: string): Promise<SocketSdkResult<'deleteOrgWebhook'>>;
201
272
  /**
202
273
  * Delete a repository from an organization.
203
274
  *
@@ -205,6 +276,7 @@ export declare class SocketSdk {
205
276
  *
206
277
  * @param orgSlug - Organization identifier
207
278
  * @param repoSlug - Repository slug/name to delete
279
+ * @param options - Optional parameters including workspace
208
280
  * @returns Success confirmation
209
281
  *
210
282
  * @example
@@ -222,7 +294,7 @@ export declare class SocketSdk {
222
294
  * @scopes repo:write
223
295
  * @throws {Error} When server returns 5xx status codes
224
296
  */
225
- deleteRepository(orgSlug: string, repoSlug: string): Promise<DeleteResult | StrictErrorResult>;
297
+ deleteRepository(orgSlug: string, repoSlug: string, options?: GetRepositoryOptions | undefined): Promise<DeleteResult | StrictErrorResult>;
226
298
  /**
227
299
  * Delete a repository label from an organization.
228
300
  *
@@ -250,6 +322,55 @@ export declare class SocketSdk {
250
322
  deleteRepositoryLabel(orgSlug: string, labelId: string): Promise<DeleteRepositoryLabelResult | StrictErrorResult>;
251
323
  /**
252
324
  * Delete a legacy scan report permanently.
325
+
326
+ /**
327
+ * Download patch file content by hash.
328
+ *
329
+ * Downloads the actual patched file content from the public Socket blob store.
330
+ * This is used after calling viewPatch() to get the patch metadata.
331
+ * No authentication is required as patch blobs are publicly accessible.
332
+ *
333
+ * @param hash - The blob hash in SSRI (sha256-base64) or hex format
334
+ * @param options - Optional configuration
335
+ * @param options.baseUrl - Override blob store URL (for testing)
336
+ * @returns Promise<string> - The patch file content as UTF-8 string
337
+ * @throws Error if blob not found (404) or download fails
338
+ *
339
+ * @example
340
+ * ```typescript
341
+ * const sdk = new SocketSdk('your-api-token')
342
+ * // First get patch metadata
343
+ * const patch = await sdk.viewPatch('my-org', 'patch-uuid')
344
+ * // Then download the actual patched file
345
+ * const fileContent = await sdk.downloadPatch(patch.files['index.js'].socketBlob)
346
+ * ```
347
+ */
348
+ downloadOrgFullScanFilesAsTar(orgSlug: string, fullScanId: string, outputPath: string): Promise<SocketSdkResult<'downloadOrgFullScanFilesAsTar'>>;
349
+ /**
350
+ * Download patch file content from Socket blob storage.
351
+ * Retrieves patched file contents using SSRI hash or hex hash.
352
+ *
353
+ * This is a low-level utility method - you'll typically use this after calling
354
+ * `viewPatch()` to get patch metadata, then download individual patched files.
355
+ *
356
+ * @param hash - The blob hash in SSRI (sha256-base64) or hex format
357
+ * @param options - Optional configuration
358
+ * @param options.baseUrl - Override blob store URL (for testing)
359
+ * @returns Promise<string> - The patch file content as UTF-8 string
360
+ * @throws Error if blob not found (404) or download fails
361
+ *
362
+ * @example
363
+ * ```typescript
364
+ * const sdk = new SocketSdk('your-api-token')
365
+ * // First get patch metadata
366
+ * const patch = await sdk.viewPatch('my-org', 'patch-uuid')
367
+ * // Then download the actual patched file
368
+ * const fileContent = await sdk.downloadPatch(patch.files['index.js'].socketBlob)
369
+ * ```
370
+ */
371
+ downloadPatch(hash: string, options?: {
372
+ baseUrl?: string | undefined;
373
+ } | undefined): Promise<string>;
253
374
  /**
254
375
  * Export scan results in CycloneDX SBOM format.
255
376
  * Returns Software Bill of Materials compliant with CycloneDX standard.
@@ -257,6 +378,39 @@ export declare class SocketSdk {
257
378
  * @throws {Error} When server returns 5xx status codes
258
379
  */
259
380
  exportCDX(orgSlug: string, fullScanId: string): Promise<SocketSdkResult<'exportCDX'>>;
381
+ /**
382
+ * Export vulnerability exploitability data as an OpenVEX v0.2.0 document.
383
+ * Includes patch data and reachability analysis for vulnerability assessment.
384
+ *
385
+ * @param orgSlug - Organization identifier
386
+ * @param id - Full scan or SBOM report ID
387
+ * @param options - Optional parameters including author, role, and document_id
388
+ * @returns OpenVEX document with vulnerability exploitability information
389
+ *
390
+ * @example
391
+ * ```typescript
392
+ * const result = await sdk.exportOpenVEX('my-org', 'scan-id', {
393
+ * author: 'Security Team',
394
+ * role: 'VEX Generator'
395
+ * })
396
+ *
397
+ * if (result.success) {
398
+ * console.log('VEX Version:', result.data.version)
399
+ * console.log('Statements:', result.data.statements.length)
400
+ * }
401
+ * ```
402
+ *
403
+ * @see https://docs.socket.dev/reference/exportopenvex
404
+ * @apiEndpoint GET /orgs/{org_slug}/export/openvex/{id}
405
+ * @quota 1 unit
406
+ * @scopes report:read
407
+ * @throws {Error} When server returns 5xx status codes
408
+ */
409
+ exportOpenVEX(orgSlug: string, id: string, options?: {
410
+ author?: string | undefined;
411
+ document_id?: string | undefined;
412
+ role?: string | undefined;
413
+ } | undefined): Promise<SocketSdkResult<'exportOpenVEX'>>;
260
414
  /**
261
415
  * Export scan results in SPDX SBOM format.
262
416
  * Returns Software Bill of Materials compliant with SPDX standard.
@@ -307,6 +461,60 @@ export declare class SocketSdk {
307
461
  * an organization, returning the complete list with their status.
308
462
  */
309
463
  getEntitlements(orgSlug: string): Promise<Entitlement[]>;
464
+ /**
465
+ * Get complete full scan results buffered in memory.
466
+ *
467
+ * Returns entire scan data as JSON for programmatic processing.
468
+ * For large scans, consider using streamFullScan() instead.
469
+ *
470
+ * @param orgSlug - Organization identifier
471
+ * @param scanId - Full scan identifier
472
+ * @returns Complete full scan data including all artifacts
473
+ *
474
+ * @example
475
+ * ```typescript
476
+ * const result = await sdk.getFullScan('my-org', 'scan_123')
477
+ *
478
+ * if (result.success) {
479
+ * console.log('Scan status:', result.data.scan_state)
480
+ * console.log('Repository:', result.data.repository_slug)
481
+ * }
482
+ * ```
483
+ *
484
+ * @see https://docs.socket.dev/reference/getorgfullscan
485
+ * @apiEndpoint GET /orgs/{org_slug}/full-scans/{full_scan_id}
486
+ * @quota 1 unit
487
+ * @scopes full-scans:list
488
+ * @throws {Error} When server returns 5xx status codes
489
+ */
490
+ getFullScan(orgSlug: string, scanId: string): Promise<FullScanResult | StrictErrorResult>;
491
+ /**
492
+ * Get metadata for a specific full scan.
493
+ *
494
+ * Returns scan configuration, status, and summary information without full artifact data.
495
+ * Useful for checking scan status without downloading complete results.
496
+ *
497
+ * @param orgSlug - Organization identifier
498
+ * @param scanId - Full scan identifier
499
+ * @returns Scan metadata including status and configuration
500
+ *
501
+ * @example
502
+ * ```typescript
503
+ * const result = await sdk.getFullScanMetadata('my-org', 'scan_123')
504
+ *
505
+ * if (result.success) {
506
+ * console.log('Scan state:', result.data.scan_state)
507
+ * console.log('Branch:', result.data.branch)
508
+ * }
509
+ * ```
510
+ *
511
+ * @see https://docs.socket.dev/reference/getorgfullscanmetadata
512
+ * @apiEndpoint GET /orgs/{org_slug}/full-scans/{full_scan_id}/metadata
513
+ * @quota 1 unit
514
+ * @scopes full-scans:list
515
+ * @throws {Error} When server returns 5xx status codes
516
+ */
517
+ getFullScanMetadata(orgSlug: string, scanId: string): Promise<FullScanResult | StrictErrorResult>;
310
518
  /**
311
519
  * Get security issues for a specific npm package and version.
312
520
  * Returns detailed vulnerability and security alert information.
@@ -315,19 +523,54 @@ export declare class SocketSdk {
315
523
  */
316
524
  getIssuesByNpmPackage(pkgName: string, version: string): Promise<SocketSdkResult<'getIssuesByNPMPackage'>>;
317
525
  /**
318
- * List latest alerts for an organization (Beta).
319
- * Returns paginated alerts with comprehensive filtering options.
526
+ * List full scans associated with a specific alert.
527
+ * Returns paginated full scan references for alert investigation.
320
528
  *
321
529
  * @param orgSlug - Organization identifier
322
- * @param options - Optional query parameters for pagination and filtering
323
- * @returns Paginated list of alerts with cursor-based pagination
530
+ * @param options - Query parameters including alertKey, range, pagination
531
+ * @returns Paginated array of full scans associated with the alert
324
532
  *
325
- * @throws {Error} When server returns 5xx status codes
326
- */
327
- getOrgAlertsList(orgSlug: string, options?: {
328
- 'filters.alertAction'?: string | undefined;
329
- 'filters.alertAction.notIn'?: string | undefined;
330
- 'filters.alertCategory'?: string | undefined;
533
+ * @example
534
+ * ```typescript
535
+ * const result = await sdk.getOrgAlertFullScans('my-org', {
536
+ * alertKey: 'npm/lodash/cve-2021-23337',
537
+ * range: '-7d',
538
+ * per_page: 50
539
+ * })
540
+ *
541
+ * if (result.success) {
542
+ * for (const item of result.data.items) {
543
+ * console.log('Full Scan ID:', item.fullScanId)
544
+ * }
545
+ * }
546
+ * ```
547
+ *
548
+ * @see https://docs.socket.dev/reference/alertfullscans
549
+ * @apiEndpoint GET /orgs/{org_slug}/alert-full-scan-search
550
+ * @quota 10 units
551
+ * @scopes alerts:list
552
+ * @throws {Error} When server returns 5xx status codes
553
+ */
554
+ getOrgAlertFullScans(orgSlug: string, options: {
555
+ alertKey: string;
556
+ per_page?: number | undefined;
557
+ range?: string | undefined;
558
+ startAfterCursor?: string | undefined;
559
+ }): Promise<SocketSdkResult<'alertFullScans'>>;
560
+ /**
561
+ * List latest alerts for an organization (Beta).
562
+ * Returns paginated alerts with comprehensive filtering options.
563
+ *
564
+ * @param orgSlug - Organization identifier
565
+ * @param options - Optional query parameters for pagination and filtering
566
+ * @returns Paginated list of alerts with cursor-based pagination
567
+ *
568
+ * @throws {Error} When server returns 5xx status codes
569
+ */
570
+ getOrgAlertsList(orgSlug: string, options?: {
571
+ 'filters.alertAction'?: string | undefined;
572
+ 'filters.alertAction.notIn'?: string | undefined;
573
+ 'filters.alertCategory'?: string | undefined;
331
574
  'filters.alertCategory.notIn'?: string | undefined;
332
575
  'filters.alertCveId'?: string | undefined;
333
576
  'filters.alertCveId.notIn'?: string | undefined;
@@ -366,7 +609,7 @@ export declare class SocketSdk {
366
609
  'filters.repoSlug.notIn'?: string | undefined;
367
610
  per_page?: number | undefined;
368
611
  startAfterCursor?: string | undefined;
369
- }): Promise<SocketSdkResult<'alertsList'>>;
612
+ } | undefined): Promise<SocketSdkResult<'alertsList'>>;
370
613
  /**
371
614
  * Get analytics data for organization usage patterns and security metrics.
372
615
  * Returns statistical analysis for specified time period.
@@ -375,140 +618,98 @@ export declare class SocketSdk {
375
618
  */
376
619
  getOrgAnalytics(time: string): Promise<SocketSdkResult<'getOrgAnalytics'>>;
377
620
  /**
378
- * List all organizations accessible to the current user.
379
- *
380
- * Returns organization details and access permissions with guaranteed required fields.
381
- *
382
- * @returns List of organizations with metadata
621
+ * Fetch available fixes for vulnerabilities in a repository or scan.
622
+ * Returns fix recommendations including version upgrades and update types.
383
623
  *
384
- * @example
385
- * ```typescript
386
- * const result = await sdk.listOrganizations()
624
+ * @param orgSlug - Organization identifier
625
+ * @param options - Fix query options including repo_slug or full_scan_id, vulnerability IDs, and preferences
626
+ * @returns Fix details for requested vulnerabilities with upgrade recommendations
387
627
  *
388
- * if (result.success) {
389
- * result.data.organizations.forEach(org => {
390
- * console.log(org.name, org.slug) // Guaranteed fields
391
- * })
392
- * }
393
- * ```
628
+ * @throws {Error} When server returns 5xx status codes
629
+ */
630
+ getOrgFixes(orgSlug: string, options: {
631
+ allow_major_updates: boolean;
632
+ full_scan_id?: string | undefined;
633
+ include_details?: boolean | undefined;
634
+ include_responsible_direct_dependencies?: boolean | undefined;
635
+ minimum_release_age?: string | undefined;
636
+ repo_slug?: string | undefined;
637
+ vulnerability_ids: string;
638
+ }): Promise<SocketSdkResult<'fetch-fixes'>>;
639
+ /**
640
+ * Get organization's license policy configuration.* Returns allowed, restricted, and monitored license types.
394
641
  *
395
- * @see https://docs.socket.dev/reference/getorganizations
396
- * @apiEndpoint GET /organizations
397
- * @quota 1 unit
398
642
  * @throws {Error} When server returns 5xx status codes
399
643
  */
400
- listOrganizations(): Promise<OrganizationsResult | StrictErrorResult>;
644
+ getOrgLicensePolicy(orgSlug: string): Promise<SocketSdkResult<'getOrgLicensePolicy'>>;
401
645
  /**
402
- * Get complete full scan results buffered in memory.
646
+ * Get organization's security policy configuration.* Returns alert rules, severity thresholds, and enforcement settings.
403
647
  *
404
- * Returns entire scan data as JSON for programmatic processing.
405
- * For large scans, consider using streamFullScan() instead.
648
+ * @throws {Error} When server returns 5xx status codes
649
+ */
650
+ getOrgSecurityPolicy(orgSlug: string): Promise<SocketSdkResult<'getOrgSecurityPolicy'>>;
651
+ /**
652
+ * Get organization's telemetry configuration.
653
+ * Returns whether telemetry is enabled for the organization.
406
654
  *
407
655
  * @param orgSlug - Organization identifier
408
- * @param scanId - Full scan identifier
409
- * @returns Complete full scan data including all artifacts
410
- *
411
- * @example
412
- * ```typescript
413
- * const result = await sdk.getFullScan('my-org', 'scan_123')
414
- *
415
- * if (result.success) {
416
- * console.log('Scan status:', result.data.scan_state)
417
- * console.log('Repository:', result.data.repository_slug)
418
- * }
419
- * ```
656
+ * @returns Telemetry configuration with enabled status
420
657
  *
421
- * @see https://docs.socket.dev/reference/getorgfullscan
422
- * @apiEndpoint GET /orgs/{org_slug}/full-scans/{full_scan_id}
423
- * @quota 1 unit
424
- * @scopes full-scans:list
425
658
  * @throws {Error} When server returns 5xx status codes
426
659
  */
427
- getFullScan(orgSlug: string, scanId: string): Promise<FullScanResult | StrictErrorResult>;
660
+ getOrgTelemetryConfig(orgSlug: string): Promise<SocketSdkResult<'getOrgTelemetryConfig'>>;
428
661
  /**
429
- * List all full scans for an organization.
662
+ * Get organization triage settings and status.
663
+ * Returns alert triage configuration and current state.
430
664
  *
431
- * Returns paginated list of full scan metadata with guaranteed required fields
432
- * for improved TypeScript autocomplete.
665
+ * @throws {Error} When server returns 5xx status codes
666
+ */
667
+ getOrgTriage(orgSlug: string): Promise<SocketSdkResult<'getOrgTriage'>>;
668
+ /**
669
+ * Get details of a specific webhook.
670
+ * Returns webhook configuration including events, URL, and filters.
433
671
  *
434
672
  * @param orgSlug - Organization identifier
435
- * @param options - Filtering and pagination options
436
- * @returns List of full scans with metadata
437
- *
438
- * @example
439
- * ```typescript
440
- * const result = await sdk.listFullScans('my-org', {
441
- * branch: 'main',
442
- * per_page: 50,
443
- * use_cursor: true
444
- * })
445
- *
446
- * if (result.success) {
447
- * result.data.results.forEach(scan => {
448
- * console.log(scan.id, scan.created_at) // Guaranteed fields
449
- * })
450
- * }
451
- * ```
673
+ * @param webhookId - Webhook ID to retrieve
674
+ * @returns Webhook details
452
675
  *
453
- * @see https://docs.socket.dev/reference/getorgfullscanlist
454
- * @apiEndpoint GET /orgs/{org_slug}/full-scans
455
- * @quota 1 unit
456
- * @scopes full-scans:list
457
676
  * @throws {Error} When server returns 5xx status codes
458
677
  */
459
- listFullScans(orgSlug: string, options?: ListFullScansOptions | undefined): Promise<FullScanListResult | StrictErrorResult>;
678
+ getOrgWebhook(orgSlug: string, webhookId: string): Promise<SocketSdkResult<'getOrgWebhook'>>;
460
679
  /**
461
- * Get metadata for a specific full scan.
462
- *
463
- * Returns scan configuration, status, and summary information without full artifact data.
464
- * Useful for checking scan status without downloading complete results.
680
+ * List all webhooks for an organization.
681
+ * Supports pagination and sorting options.
465
682
  *
466
683
  * @param orgSlug - Organization identifier
467
- * @param scanId - Full scan identifier
468
- * @returns Scan metadata including status and configuration
469
- *
470
- * @example
471
- * ```typescript
472
- * const result = await sdk.getFullScanMetadata('my-org', 'scan_123')
473
- *
474
- * if (result.success) {
475
- * console.log('Scan state:', result.data.scan_state)
476
- * console.log('Branch:', result.data.branch)
477
- * }
478
- * ```
684
+ * @param options - Optional query parameters for pagination and sorting
685
+ * @returns List of webhooks with pagination info
479
686
  *
480
- * @see https://docs.socket.dev/reference/getorgfullscanmetadata
481
- * @apiEndpoint GET /orgs/{org_slug}/full-scans/{full_scan_id}/metadata
482
- * @quota 1 unit
483
- * @scopes full-scans:list
484
687
  * @throws {Error} When server returns 5xx status codes
485
688
  */
486
- getFullScanMetadata(orgSlug: string, scanId: string): Promise<FullScanResult | StrictErrorResult>;
689
+ getOrgWebhooksList(orgSlug: string, options?: {
690
+ direction?: string | undefined;
691
+ page?: number | undefined;
692
+ per_page?: number | undefined;
693
+ sort?: string | undefined;
694
+ } | undefined): Promise<SocketSdkResult<'getOrgWebhooksList'>>;
487
695
  /**
488
- * Fetch available fixes for vulnerabilities in a repository or scan.
489
- * Returns fix recommendations including version upgrades and update types.
490
- *
491
- * @param orgSlug - Organization identifier
492
- * @param options - Fix query options including repo_slug or full_scan_id, vulnerability IDs, and preferences
493
- * @returns Fix details for requested vulnerabilities with upgrade recommendations
696
+ * Get current API quota usage and limits.
697
+ * Returns remaining requests, rate limits, and quota reset times.
494
698
  *
495
699
  * @throws {Error} When server returns 5xx status codes
496
700
  */
497
- getOrgFixes(orgSlug: string, options: {
498
- allow_major_updates: boolean;
499
- full_scan_id?: string | undefined;
500
- include_details?: boolean | undefined;
501
- include_responsible_direct_dependencies?: boolean | undefined;
502
- minimum_release_age?: string | undefined;
503
- repo_slug?: string | undefined;
504
- vulnerability_ids: string;
505
- }): Promise<SocketSdkResult<'fetch-fixes'>>;
701
+ getQuota(): Promise<SocketSdkResult<'getQuota'>>;
506
702
  /**
507
- * Get organization's license policy configuration.* Returns allowed, restricted, and monitored license types.
703
+ * Get analytics data for a specific repository.
704
+ * Returns security metrics, dependency trends, and vulnerability statistics.
508
705
  *
509
706
  * @throws {Error} When server returns 5xx status codes
510
707
  */
511
- getOrgLicensePolicy(orgSlug: string): Promise<SocketSdkResult<'getOrgLicensePolicy'>>;
708
+ getRepoAnalytics(repo: string, time: string): Promise<SocketSdkResult<'getRepoAnalytics'>>;
709
+ /**
710
+ * Get detailed results for a legacy scan report.
711
+ /**
712
+
512
713
  /**
513
714
  * Get details for a specific repository.
514
715
  *
@@ -516,6 +717,7 @@ export declare class SocketSdk {
516
717
  *
517
718
  * @param orgSlug - Organization identifier
518
719
  * @param repoSlug - Repository slug/name
720
+ * @param options - Optional parameters including workspace
519
721
  * @returns Repository details with configuration
520
722
  *
521
723
  * @example
@@ -535,7 +737,7 @@ export declare class SocketSdk {
535
737
  * @scopes repo:read
536
738
  * @throws {Error} When server returns 5xx status codes
537
739
  */
538
- getRepository(orgSlug: string, repoSlug: string): Promise<RepositoryResult | StrictErrorResult>;
740
+ getRepository(orgSlug: string, repoSlug: string, options?: GetRepositoryOptions | undefined): Promise<RepositoryResult | StrictErrorResult>;
539
741
  /**
540
742
  * Get details for a specific repository label.
541
743
  *
@@ -564,33 +766,82 @@ export declare class SocketSdk {
564
766
  */
565
767
  getRepositoryLabel(orgSlug: string, labelId: string): Promise<RepositoryLabelResult | StrictErrorResult>;
566
768
  /**
567
- * List all repository labels for an organization.
769
+ * Get security score for a specific npm package and version.
770
+ * Returns numerical security rating and scoring breakdown.
568
771
  *
569
- * Returns paginated list of labels configured for repository organization and policy management.
772
+ * @throws {Error} When server returns 5xx status codes
773
+ */
774
+ getScoreByNpmPackage(pkgName: string, version: string): Promise<SocketSdkResult<'getScoreByNPMPackage'>>;
775
+ /**
776
+ * Get list of file types and formats supported for scanning.
777
+ * Returns supported manifest files, lockfiles, and configuration formats.
778
+ *
779
+ * @throws {Error} When server returns 5xx status codes
780
+ */
781
+ getSupportedScanFiles(): Promise<SocketSdkResult<'getReportSupportedFiles'>>;
782
+ /**
783
+ * List all full scans for an organization.
784
+ *
785
+ * Returns paginated list of full scan metadata with guaranteed required fields
786
+ * for improved TypeScript autocomplete.
570
787
  *
571
788
  * @param orgSlug - Organization identifier
572
- * @param options - Pagination options
573
- * @returns List of labels with guaranteed id and name fields
789
+ * @param options - Filtering and pagination options
790
+ * @returns List of full scans with metadata
574
791
  *
575
792
  * @example
576
793
  * ```typescript
577
- * const result = await sdk.listRepositoryLabels('my-org', { per_page: 50, page: 1 })
794
+ * const result = await sdk.listFullScans('my-org', {
795
+ * branch: 'main',
796
+ * per_page: 50,
797
+ * use_cursor: true
798
+ * })
578
799
  *
579
800
  * if (result.success) {
580
- * result.data.results.forEach(label => {
581
- * console.log('Label:', label.name)
582
- * console.log('Associated repos:', label.repository_ids?.length || 0)
801
+ * result.data.results.forEach(scan => {
802
+ * console.log(scan.id, scan.created_at) // Guaranteed fields
583
803
  * })
584
804
  * }
585
805
  * ```
586
806
  *
587
- * @see https://docs.socket.dev/reference/getorgrepolabellist
588
- * @apiEndpoint GET /orgs/{org_slug}/repos/labels
807
+ * @see https://docs.socket.dev/reference/getorgfullscanlist
808
+ * @apiEndpoint GET /orgs/{org_slug}/full-scans
589
809
  * @quota 1 unit
590
- * @scopes repo-label:list
810
+ * @scopes full-scans:list
591
811
  * @throws {Error} When server returns 5xx status codes
592
812
  */
593
- listRepositoryLabels(orgSlug: string, options?: QueryParams | undefined): Promise<RepositoryLabelsListResult | StrictErrorResult>;
813
+ listFullScans(orgSlug: string, options?: ListFullScansOptions | undefined): Promise<FullScanListResult | StrictErrorResult>;
814
+ /**
815
+ * List all organizations accessible to the current user.
816
+ *
817
+ * Returns organization details and access permissions with guaranteed required fields.
818
+ *
819
+ * @returns List of organizations with metadata
820
+ *
821
+ * @example
822
+ * ```typescript
823
+ * const result = await sdk.listOrganizations()
824
+ *
825
+ * if (result.success) {
826
+ * result.data.organizations.forEach(org => {
827
+ * console.log(org.name, org.slug) // Guaranteed fields
828
+ * })
829
+ * }
830
+ * ```
831
+ *
832
+ * @see https://docs.socket.dev/reference/getorganizations
833
+ * @apiEndpoint GET /organizations
834
+ * @quota 1 unit
835
+ * @throws {Error} When server returns 5xx status codes
836
+ */
837
+ listOrganizations(): Promise<OrganizationsResult | StrictErrorResult>;
838
+ /**
839
+ * List all diff scans for an organization.
840
+ * Returns paginated list of diff scan metadata and status.
841
+ *
842
+ * @throws {Error} When server returns 5xx status codes
843
+ */
844
+ listOrgDiffScans(orgSlug: string): Promise<SocketSdkResult<'listOrgDiffScans'>>;
594
845
  /**
595
846
  * List all repositories in an organization.
596
847
  *
@@ -623,56 +874,33 @@ export declare class SocketSdk {
623
874
  */
624
875
  listRepositories(orgSlug: string, options?: ListRepositoriesOptions | undefined): Promise<RepositoriesListResult | StrictErrorResult>;
625
876
  /**
626
- * Get organization's security policy configuration.* Returns alert rules, severity thresholds, and enforcement settings.
627
- *
628
- * @throws {Error} When server returns 5xx status codes
629
- */
630
- getOrgSecurityPolicy(orgSlug: string): Promise<SocketSdkResult<'getOrgSecurityPolicy'>>;
631
- /**
632
- * Get organization triage settings and status.
633
- * Returns alert triage configuration and current state.
634
- *
635
- * @throws {Error} When server returns 5xx status codes
636
- */
637
- getOrgTriage(orgSlug: string): Promise<SocketSdkResult<'getOrgTriage'>>;
638
- /**
639
- * Get current API quota usage and limits.
640
- * Returns remaining requests, rate limits, and quota reset times.
877
+ * List all repository labels for an organization.
641
878
  *
642
- * @throws {Error} When server returns 5xx status codes
643
- */
644
- getQuota(): Promise<SocketSdkResult<'getQuota'>>;
645
- /**
646
- * Get analytics data for a specific repository.
647
- * Returns security metrics, dependency trends, and vulnerability statistics.
879
+ * Returns paginated list of labels configured for repository organization and policy management.
648
880
  *
649
- * @throws {Error} When server returns 5xx status codes
650
- */
651
- getRepoAnalytics(repo: string, time: string): Promise<SocketSdkResult<'getRepoAnalytics'>>;
652
- /**
653
- * Get detailed results for a legacy scan report.
654
- /**
655
- /**
656
- * Get security score for a specific npm package and version.
657
- * Returns numerical security rating and scoring breakdown.
881
+ * @param orgSlug - Organization identifier
882
+ * @param options - Pagination options
883
+ * @returns List of labels with guaranteed id and name fields
658
884
  *
659
- * @throws {Error} When server returns 5xx status codes
660
- */
661
- getScoreByNpmPackage(pkgName: string, version: string): Promise<SocketSdkResult<'getScoreByNPMPackage'>>;
662
- /**
663
- * Get list of file types and formats supported for scanning.
664
- * Returns supported manifest files, lockfiles, and configuration formats.
885
+ * @example
886
+ * ```typescript
887
+ * const result = await sdk.listRepositoryLabels('my-org', { per_page: 50, page: 1 })
665
888
  *
666
- * @throws {Error} When server returns 5xx status codes
667
- */
668
- getSupportedScanFiles(): Promise<SocketSdkResult<'getReportSupportedFiles'>>;
669
- /**
670
- * List all diff scans for an organization.
671
- * Returns paginated list of diff scan metadata and status.
889
+ * if (result.success) {
890
+ * result.data.results.forEach(label => {
891
+ * console.log('Label:', label.name)
892
+ * console.log('Associated repos:', label.repository_ids?.length || 0)
893
+ * })
894
+ * }
895
+ * ```
672
896
  *
897
+ * @see https://docs.socket.dev/reference/getorgrepolabellist
898
+ * @apiEndpoint GET /orgs/{org_slug}/repos/labels
899
+ * @quota 1 unit
900
+ * @scopes repo-label:list
673
901
  * @throws {Error} When server returns 5xx status codes
674
902
  */
675
- listOrgDiffScans(orgSlug: string): Promise<SocketSdkResult<'listOrgDiffScans'>>;
903
+ listRepositoryLabels(orgSlug: string, options?: QueryParams | undefined): Promise<RepositoryLabelsListResult | StrictErrorResult>;
676
904
  /**
677
905
  * Create a new API token for an organization.
678
906
  * Generates API token with specified scopes and metadata.
@@ -701,6 +929,17 @@ export declare class SocketSdk {
701
929
  * @throws {Error} When server returns 5xx status codes
702
930
  */
703
931
  postAPITokenUpdate(orgSlug: string, tokenId: string, updateData: QueryParams): Promise<SocketSdkResult<'postAPITokenUpdate'>>;
932
+ /**
933
+ * Post telemetry data for an organization.
934
+ * Sends telemetry events and analytics data for monitoring and analysis.
935
+ *
936
+ * @param orgSlug - Organization identifier
937
+ * @param telemetryData - Telemetry payload containing events and metrics
938
+ * @returns Empty object on successful submission
939
+ *
940
+ * @throws {Error} When server returns 5xx status codes
941
+ */
942
+ postOrgTelemetry(orgSlug: string, telemetryData: PostOrgTelemetryPayload): Promise<SocketSdkGenericResult<PostOrgTelemetryResponse>>;
704
943
  /**
705
944
  * Update user or organization settings.
706
945
  * Configures preferences, notifications, and security policies.
@@ -710,6 +949,42 @@ export declare class SocketSdk {
710
949
  postSettings(selectors: Array<{
711
950
  organization?: string | undefined;
712
951
  }>): Promise<SocketSdkResult<'postSettings'>>;
952
+ /**
953
+ * Create a new full scan by rescanning an existing scan.
954
+ * Supports shallow (policy reapplication) and deep (dependency resolution rerun) modes.
955
+ *
956
+ * @param orgSlug - Organization identifier
957
+ * @param fullScanId - Full scan ID to rescan
958
+ * @param options - Rescan options including mode (shallow or deep)
959
+ * @returns New scan ID and status
960
+ *
961
+ * @example
962
+ * ```typescript
963
+ * // Shallow rescan (reapply policies to cached data)
964
+ * const result = await sdk.rescanFullScan('my-org', 'scan_123', {
965
+ * mode: 'shallow'
966
+ * })
967
+ *
968
+ * if (result.success) {
969
+ * console.log('New Scan ID:', result.data.id)
970
+ * console.log('Status:', result.data.status)
971
+ * }
972
+ *
973
+ * // Deep rescan (rerun dependency resolution)
974
+ * const deepResult = await sdk.rescanFullScan('my-org', 'scan_123', {
975
+ * mode: 'deep'
976
+ * })
977
+ * ```
978
+ *
979
+ * @see https://docs.socket.dev/reference/rescanorgfullscan
980
+ * @apiEndpoint POST /orgs/{org_slug}/full-scans/{full_scan_id}/rescan
981
+ * @quota 1 unit
982
+ * @scopes full-scans:create
983
+ * @throws {Error} When server returns 5xx status codes
984
+ */
985
+ rescanFullScan(orgSlug: string, fullScanId: string, options?: {
986
+ mode?: 'shallow' | 'deep' | undefined;
987
+ } | undefined): Promise<SocketSdkResult<'rescanOrgFullScan'>>;
713
988
  /**
714
989
  * Search for dependencies across monitored projects.
715
990
  * Returns matching packages with security information and usage patterns.
@@ -781,6 +1056,47 @@ export declare class SocketSdk {
781
1056
  * @throws {Error} When server returns 5xx status codes
782
1057
  */
783
1058
  updateOrgLicensePolicy(orgSlug: string, policyData: QueryParams, queryParams?: QueryParams | undefined): Promise<SocketSdkResult<'updateOrgLicensePolicy'>>;
1059
+ /**
1060
+ * Update organization's security policy configuration.* Modifies alert rules, severity thresholds, and enforcement settings.
1061
+ *
1062
+ * @throws {Error} When server returns 5xx status codes
1063
+ */
1064
+ updateOrgSecurityPolicy(orgSlug: string, policyData: QueryParams): Promise<SocketSdkResult<'updateOrgSecurityPolicy'>>;
1065
+ /**
1066
+ * Update organization's telemetry configuration.
1067
+ * Enables or disables telemetry for the organization.
1068
+ *
1069
+ * @param orgSlug - Organization identifier
1070
+ * @param telemetryData - Telemetry configuration with enabled flag
1071
+ * @returns Updated telemetry configuration
1072
+ *
1073
+ * @throws {Error} When server returns 5xx status codes
1074
+ */
1075
+ updateOrgTelemetryConfig(orgSlug: string, telemetryData: {
1076
+ enabled?: boolean | undefined;
1077
+ }): Promise<SocketSdkResult<'updateOrgTelemetryConfig'>>;
1078
+ /**
1079
+ * Update an existing webhook's configuration.
1080
+ * All fields are optional - only provided fields will be updated.
1081
+ *
1082
+ * @param orgSlug - Organization identifier
1083
+ * @param webhookId - Webhook ID to update
1084
+ * @param webhookData - Updated webhook configuration
1085
+ * @returns Updated webhook details
1086
+ *
1087
+ * @throws {Error} When server returns 5xx status codes
1088
+ */
1089
+ updateOrgWebhook(orgSlug: string, webhookId: string, webhookData: {
1090
+ description?: null | string | undefined;
1091
+ events?: string[] | undefined;
1092
+ filters?: {
1093
+ repositoryIds: null | string[];
1094
+ } | null | undefined;
1095
+ headers?: null | Record<string, unknown> | undefined;
1096
+ name?: string | undefined;
1097
+ secret?: null | string | undefined;
1098
+ url?: string | undefined;
1099
+ }): Promise<SocketSdkResult<'updateOrgWebhook'>>;
784
1100
  /**
785
1101
  * Update configuration for a repository.
786
1102
  *
@@ -789,6 +1105,7 @@ export declare class SocketSdk {
789
1105
  * @param orgSlug - Organization identifier
790
1106
  * @param repoSlug - Repository slug/name
791
1107
  * @param params - Configuration updates (description, homepage, default_branch, etc.)
1108
+ * @param options - Optional parameters including workspace
792
1109
  * @returns Updated repository details
793
1110
  *
794
1111
  * @example
@@ -809,7 +1126,7 @@ export declare class SocketSdk {
809
1126
  * @scopes repo:write
810
1127
  * @throws {Error} When server returns 5xx status codes
811
1128
  */
812
- updateRepository(orgSlug: string, repoSlug: string, params?: QueryParams | undefined): Promise<RepositoryResult | StrictErrorResult>;
1129
+ updateRepository(orgSlug: string, repoSlug: string, params?: QueryParams | undefined, options?: GetRepositoryOptions | undefined): Promise<RepositoryResult | StrictErrorResult>;
813
1130
  /**
814
1131
  * Update a repository label for an organization.
815
1132
  *
@@ -837,12 +1154,6 @@ export declare class SocketSdk {
837
1154
  * @throws {Error} When server returns 5xx status codes
838
1155
  */
839
1156
  updateRepositoryLabel(orgSlug: string, labelId: string, labelData: QueryParams): Promise<RepositoryLabelResult | StrictErrorResult>;
840
- /**
841
- * Update organization's security policy configuration.* Modifies alert rules, severity thresholds, and enforcement settings.
842
- *
843
- * @throws {Error} When server returns 5xx status codes
844
- */
845
- updateOrgSecurityPolicy(orgSlug: string, policyData: QueryParams): Promise<SocketSdkResult<'updateOrgSecurityPolicy'>>;
846
1157
  /**
847
1158
  * Upload manifest files for dependency analysis.
848
1159
  * Processes package files to create dependency snapshots and security analysis.
@@ -857,167 +1168,4 @@ export declare class SocketSdk {
857
1168
  * vulnerabilities, description, license, and tier information.
858
1169
  */
859
1170
  viewPatch(orgSlug: string, uuid: string): Promise<PatchViewResponse>;
860
- /**
861
- * Download patch file content by hash.
862
- *
863
- * Downloads the actual patched file content from the public Socket blob store.
864
- * This is used after calling viewPatch() to get the patch metadata.
865
- * No authentication is required as patch blobs are publicly accessible.
866
- *
867
- * @param hash - The blob hash in SSRI (sha256-base64) or hex format
868
- * @param options - Optional configuration
869
- * @param options.baseUrl - Override blob store URL (for testing)
870
- * @returns Promise<string> - The patch file content as UTF-8 string
871
- * @throws Error if blob not found (404) or download fails
872
- *
873
- * @example
874
- * ```typescript
875
- * const sdk = new SocketSdk('your-api-token')
876
- * // First get patch metadata
877
- * const patch = await sdk.viewPatch('my-org', 'patch-uuid')
878
- * // Then download the actual patched file
879
- * const fileContent = await sdk.downloadPatch(patch.files['index.js'].socketBlob)
880
- * ```
881
- */
882
- downloadOrgFullScanFilesAsTar(orgSlug: string, fullScanId: string, outputPath: string): Promise<SocketSdkResult<'downloadOrgFullScanFilesAsTar'>>;
883
- /**
884
- * Download patch file content from Socket blob storage.
885
- * Retrieves patched file contents using SSRI hash or hex hash.
886
- *
887
- * This is a low-level utility method - you'll typically use this after calling
888
- * `viewPatch()` to get patch metadata, then download individual patched files.
889
- *
890
- * @param hash - The blob hash in SSRI (sha256-base64) or hex format
891
- * @param options - Optional configuration
892
- * @param options.baseUrl - Override blob store URL (for testing)
893
- * @returns Promise<string> - The patch file content as UTF-8 string
894
- * @throws Error if blob not found (404) or download fails
895
- *
896
- * @example
897
- * ```typescript
898
- * const sdk = new SocketSdk('your-api-token')
899
- * // First get patch metadata
900
- * const patch = await sdk.viewPatch('my-org', 'patch-uuid')
901
- * // Then download the actual patched file
902
- * const fileContent = await sdk.downloadPatch(patch.files['index.js'].socketBlob)
903
- * ```
904
- */
905
- downloadPatch(hash: string, options?: {
906
- baseUrl?: string;
907
- }): Promise<string>;
908
- /**
909
- * Update organization's telemetry configuration.
910
- * Enables or disables telemetry for the organization.
911
- *
912
- * @param orgSlug - Organization identifier
913
- * @param telemetryData - Telemetry configuration with enabled flag
914
- * @returns Updated telemetry configuration
915
- *
916
- * @throws {Error} When server returns 5xx status codes
917
- */
918
- updateOrgTelemetryConfig(orgSlug: string, telemetryData: {
919
- enabled?: boolean | undefined;
920
- }): Promise<SocketSdkResult<'updateOrgTelemetryConfig'>>;
921
- /**
922
- * Get organization's telemetry configuration.
923
- * Returns whether telemetry is enabled for the organization.
924
- *
925
- * @param orgSlug - Organization identifier
926
- * @returns Telemetry configuration with enabled status
927
- *
928
- * @throws {Error} When server returns 5xx status codes
929
- */
930
- getOrgTelemetryConfig(orgSlug: string): Promise<SocketSdkResult<'getOrgTelemetryConfig'>>;
931
- /**
932
- * Post telemetry data for an organization.
933
- * Sends telemetry events and analytics data for monitoring and analysis.
934
- *
935
- * @param orgSlug - Organization identifier
936
- * @param telemetryData - Telemetry payload containing events and metrics
937
- * @returns Empty object on successful submission
938
- *
939
- * @throws {Error} When server returns 5xx status codes
940
- */
941
- postOrgTelemetry(orgSlug: string, telemetryData: PostOrgTelemetryPayload): Promise<SocketSdkGenericResult<PostOrgTelemetryResponse>>;
942
- /**
943
- * Create a new webhook for an organization.
944
- * Webhooks allow you to receive HTTP POST notifications when specific events occur.
945
- *
946
- * @param orgSlug - Organization identifier
947
- * @param webhookData - Webhook configuration including name, URL, secret, and events
948
- * @returns Created webhook details including webhook ID
949
- *
950
- * @throws {Error} When server returns 5xx status codes
951
- */
952
- createOrgWebhook(orgSlug: string, webhookData: {
953
- description?: null | string | undefined;
954
- events: string[];
955
- filters?: {
956
- repositoryIds: null | string[];
957
- } | null | undefined;
958
- headers?: null | Record<string, unknown> | undefined;
959
- name: string;
960
- secret: string;
961
- url: string;
962
- }): Promise<SocketSdkResult<'createOrgWebhook'>>;
963
- /**
964
- * Delete a webhook from an organization.
965
- * This will stop all future webhook deliveries to the webhook URL.
966
- *
967
- * @param orgSlug - Organization identifier
968
- * @param webhookId - Webhook ID to delete
969
- * @returns Success status
970
- *
971
- * @throws {Error} When server returns 5xx status codes
972
- */
973
- deleteOrgWebhook(orgSlug: string, webhookId: string): Promise<SocketSdkResult<'deleteOrgWebhook'>>;
974
- /**
975
- * Get details of a specific webhook.
976
- * Returns webhook configuration including events, URL, and filters.
977
- *
978
- * @param orgSlug - Organization identifier
979
- * @param webhookId - Webhook ID to retrieve
980
- * @returns Webhook details
981
- *
982
- * @throws {Error} When server returns 5xx status codes
983
- */
984
- getOrgWebhook(orgSlug: string, webhookId: string): Promise<SocketSdkResult<'getOrgWebhook'>>;
985
- /**
986
- * List all webhooks for an organization.
987
- * Supports pagination and sorting options.
988
- *
989
- * @param orgSlug - Organization identifier
990
- * @param options - Optional query parameters for pagination and sorting
991
- * @returns List of webhooks with pagination info
992
- *
993
- * @throws {Error} When server returns 5xx status codes
994
- */
995
- getOrgWebhooksList(orgSlug: string, options?: {
996
- direction?: string | undefined;
997
- page?: number | undefined;
998
- per_page?: number | undefined;
999
- sort?: string | undefined;
1000
- }): Promise<SocketSdkResult<'getOrgWebhooksList'>>;
1001
- /**
1002
- * Update an existing webhook's configuration.
1003
- * All fields are optional - only provided fields will be updated.
1004
- *
1005
- * @param orgSlug - Organization identifier
1006
- * @param webhookId - Webhook ID to update
1007
- * @param webhookData - Updated webhook configuration
1008
- * @returns Updated webhook details
1009
- *
1010
- * @throws {Error} When server returns 5xx status codes
1011
- */
1012
- updateOrgWebhook(orgSlug: string, webhookId: string, webhookData: {
1013
- description?: null | string | undefined;
1014
- events?: string[] | undefined;
1015
- filters?: {
1016
- repositoryIds: null | string[];
1017
- } | null | undefined;
1018
- headers?: null | Record<string, unknown> | undefined;
1019
- name?: string | undefined;
1020
- secret?: null | string | undefined;
1021
- url?: string | undefined;
1022
- }): Promise<SocketSdkResult<'updateOrgWebhook'>>;
1023
1171
  }