@@ -385,6 +385,113 @@ 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<'getOrgRepo'>> }
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<'getOrgRepo'> } */ ( this . #handleApiError( err ) )
421
+ }
422
+ }
423
+
424
+ /**
425
+ * @param {string } orgSlug
426
+ * @param {string } repoSlug
427
+ * @returns {Promise<SocketSdkResultType<'deleteOrgRepo'>> }
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<'deleteOrgRepo'> } */ ( this . #handleApiError( err ) )
439
+ }
440
+ }
441
+
442
+ /**
443
+ * @param {string } orgSlug
444
+ * @param {{[key: string]: any } } queryParams
445
+ * @returns {Promise<SocketSdkResultType<'getOrgRepoList'>> }
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<'getOrgRepoList'> } */ ( this . #handleApiError( err ) )
457
+ }
458
+ }
459
+
460
+ /**
461
+ * @param {string } orgSlug
462
+ * @param {string } params
463
+ * @returns {Promise<SocketSdkResultType<'createOrgRepo'>> }
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` , { json : params } ) . json ( )
471
+ return { success : true , status : 200 , data }
472
+ } catch ( err ) {
473
+ return /** @type {SocketSdkErrorType<'createOrgRepo'> } */ ( this . #handleApiError( err ) )
474
+ }
475
+ }
476
+
477
+ /**
478
+ * @param {string } orgSlug
479
+ * @param {string } repoSlug
480
+ * @param {string } params
481
+ * @returns {Promise<SocketSdkResultType<'updateOrgRepo'>> }
482
+ */
483
+ async updateOrgRepo ( orgSlug , repoSlug , params ) {
484
+ const orgSlugParam = encodeURIComponent ( orgSlug )
485
+
486
+ try {
487
+ const client = await this . #getClient( )
488
+ const data = await client . post ( `orgs/${ orgSlugParam } /repos/${ repoSlug } ` , { json : params } ) . json ( )
489
+ return { success : true , status : 200 , data }
490
+ } catch ( err ) {
491
+ return /** @type {SocketSdkErrorType<'updateOrgRepo'> } */ ( this . #handleApiError( err ) )
492
+ }
493
+ }
494
+
388
495
/**
389
496
* @param {Array<{ organization?: string }> } selectors
390
497
* @returns {Promise<SocketSdkResultType<'postSettings'>> }
0 commit comments