@@ -385,6 +385,112 @@ class SocketSdk {
385
385
}
386
386
}
387
387
388
+ /**
389
+ * @param {string } orgSlug
390
+ * @param {{[key: string]: any } } queryParams
391
+ * @returns {Promise<SocketSdkResultType<'getAuditLogEvents'>> }
392
+ */
393
+ async getAuditLogEvents ( orgSlug , queryParams ) {
394
+ const orgSlugParam = encodeURIComponent ( orgSlug )
395
+ const formattedQueryParam = new URLSearchParams ( queryParams )
396
+
397
+ try {
398
+ const client = await this . #getClient( )
399
+ const data = await client . get ( `orgs/${ orgSlugParam } /audit-log?${ formattedQueryParam } ` ) . json ( )
400
+ return { success : true , status : 200 , data }
401
+ } catch ( err ) {
402
+ return /** @type {SocketSdkErrorType<'getAuditLogEvents'> } */ ( this . #handleApiError( err ) )
403
+ }
404
+ }
405
+
406
+ /**
407
+ * @param {string } orgSlug
408
+ * @param {string } repoSlug
409
+ * @returns {Promise<SocketSdkResultType<'getAuditLogEvents'>> }
410
+ */
411
+ async getOrgRepo ( orgSlug , repoSlug ) {
412
+ const orgSlugParam = encodeURIComponent ( orgSlug )
413
+ const repoSlugParam = encodeURIComponent ( repoSlug )
414
+
415
+ try {
416
+ const client = await this . #getClient( )
417
+ const data = await client . get ( `orgs/${ orgSlugParam } /repos/${ repoSlugParam } ` ) . json ( )
418
+ return { success : true , status : 200 , data }
419
+ } catch ( err ) {
420
+ return /** @type {SocketSdkErrorType<'getAuditLogEvents'> } */ ( this . #handleApiError( err ) )
421
+ }
422
+ }
423
+
424
+ /**
425
+ * @param {string } orgSlug
426
+ * @param {string } repoSlug
427
+ * @returns {Promise<SocketSdkResultType<'getAuditLogEvents'>> }
428
+ */
429
+ async deleteOrgRepo ( orgSlug , repoSlug ) {
430
+ const orgSlugParam = encodeURIComponent ( orgSlug )
431
+ const repoSlugParam = encodeURIComponent ( repoSlug )
432
+
433
+ try {
434
+ const client = await this . #getClient( )
435
+ const data = await client . delete ( `orgs/${ orgSlugParam } /repos/${ repoSlugParam } ` ) . json ( )
436
+ return { success : true , status : 200 , data }
437
+ } catch ( err ) {
438
+ return /** @type {SocketSdkErrorType<'getAuditLogEvents'> } */ ( this . #handleApiError( err ) )
439
+ }
440
+ }
441
+
442
+ /**
443
+ * @param {string } orgSlug
444
+ * @param {{[key: string]: any } } queryParams
445
+ * @returns {Promise<SocketSdkResultType<'getAuditLogEvents'>> }
446
+ */
447
+ async getOrgRepoList ( orgSlug , queryParams ) {
448
+ const orgSlugParam = encodeURIComponent ( orgSlug )
449
+ const formattedQueryParam = new URLSearchParams ( queryParams )
450
+
451
+ try {
452
+ const client = await this . #getClient( )
453
+ const data = await client . get ( `orgs/${ orgSlugParam } /repos?${ formattedQueryParam } ` ) . json ( )
454
+ return { success : true , status : 200 , data }
455
+ } catch ( err ) {
456
+ return /** @type {SocketSdkErrorType<'getAuditLogEvents'> } */ ( this . #handleApiError( err ) )
457
+ }
458
+ }
459
+
460
+ /**
461
+ * @param {string } orgSlug
462
+ * @param {string } params
463
+ * @returns {Promise<SocketSdkResultType<'getAuditLogEvents'>> }
464
+ */
465
+ async createOrgRepo ( orgSlug , params ) {
466
+ const orgSlugParam = encodeURIComponent ( orgSlug )
467
+
468
+ try {
469
+ const client = await this . #getClient( )
470
+ const data = await client . post ( `orgs/${ orgSlugParam } /repos` , { body : params } ) . json ( )
471
+ return { success : true , status : 200 , data }
472
+ } catch ( err ) {
473
+ return /** @type {SocketSdkErrorType<'getAuditLogEvents'> } */ ( this . #handleApiError( err ) )
474
+ }
475
+ }
476
+
477
+ /**
478
+ * @param {string } orgSlug
479
+ * @param {string } repoSlug
480
+ * @returns {Promise<SocketSdkResultType<'getAuditLogEvents'>> }
481
+ */
482
+ async updateOrgRepo ( orgSlug , repoSlug ) {
483
+ const orgSlugParam = encodeURIComponent ( orgSlug )
484
+
485
+ try {
486
+ const client = await this . #getClient( )
487
+ const data = await client . post ( `orgs/${ orgSlugParam } /repos/${ repoSlug } ` ) . json ( )
488
+ return { success : true , status : 200 , data }
489
+ } catch ( err ) {
490
+ return /** @type {SocketSdkErrorType<'getAuditLogEvents'> } */ ( this . #handleApiError( err ) )
491
+ }
492
+ }
493
+
388
494
/**
389
495
* @param {Array<{ organization?: string }> } selectors
390
496
* @returns {Promise<SocketSdkResultType<'postSettings'>> }
0 commit comments