@@ -73,6 +73,8 @@ import type {
7373 GetOptions ,
7474 GotOptions ,
7575 PatchViewResponse ,
76+ PostOrgTelemetryPayload ,
77+ PostOrgTelemetryResponse ,
7678 QueryParams ,
7779 RequestOptions ,
7880 SendOptions ,
@@ -3481,6 +3483,113 @@ export class SocketSdk {
34813483 } )
34823484 } )
34833485 }
3486+
3487+ /**
3488+ * Update organization's telemetry configuration.
3489+ * Enables or disables telemetry for the organization.
3490+ *
3491+ * @param orgSlug - Organization identifier
3492+ * @param telemetryData - Telemetry configuration with enabled flag
3493+ * @returns Updated telemetry configuration
3494+ *
3495+ * @throws {Error } When server returns 5xx status codes
3496+ */
3497+ async updateOrgTelemetryConfig (
3498+ orgSlug : string ,
3499+ telemetryData : { enabled ?: boolean | undefined } ,
3500+ ) : Promise < SocketSdkResult < 'updateOrgTelemetryConfig' > > {
3501+ try {
3502+ const data = await this . #executeWithRetry(
3503+ async ( ) =>
3504+ await getResponseJson (
3505+ await createRequestWithJson (
3506+ 'PUT' ,
3507+ this . #baseUrl,
3508+ `orgs/${ encodeURIComponent ( orgSlug ) } /telemetry/config` ,
3509+ telemetryData ,
3510+ this . #reqOptions,
3511+ ) ,
3512+ ) ,
3513+ )
3514+ return this . #handleApiSuccess< 'updateOrgTelemetryConfig' > ( data )
3515+ /* c8 ignore start - Standard API error handling, tested via public method error cases */
3516+ } catch ( e ) {
3517+ return await this . #handleApiError< 'updateOrgTelemetryConfig' > ( e )
3518+ }
3519+ /* c8 ignore stop */
3520+ }
3521+
3522+ /**
3523+ * Get organization's telemetry configuration.
3524+ * Returns whether telemetry is enabled for the organization.
3525+ *
3526+ * @param orgSlug - Organization identifier
3527+ * @returns Telemetry configuration with enabled status
3528+ *
3529+ * @throws {Error } When server returns 5xx status codes
3530+ */
3531+ async getTelemetryConfig (
3532+ orgSlug : string ,
3533+ ) : Promise < SocketSdkResult < 'getOrgTelemetryConfig' > > {
3534+ try {
3535+ const data = await this . #executeWithRetry(
3536+ async ( ) =>
3537+ await getResponseJson (
3538+ await createGetRequest (
3539+ this . #baseUrl,
3540+ `orgs/${ encodeURIComponent ( orgSlug ) } /telemetry/config` ,
3541+ this . #reqOptions,
3542+ ) ,
3543+ ) ,
3544+ )
3545+ return this . #handleApiSuccess< 'getOrgTelemetryConfig' > ( data )
3546+ /* c8 ignore start - Standard API error handling, tested via public method error cases */
3547+ } catch ( e ) {
3548+ return await this . #handleApiError< 'getOrgTelemetryConfig' > ( e )
3549+ }
3550+ /* c8 ignore stop */
3551+ }
3552+
3553+ /**
3554+ * Post telemetry data for an organization.
3555+ * Sends telemetry events and analytics data for monitoring and analysis.
3556+ *
3557+ * @param orgSlug - Organization identifier
3558+ * @param telemetryData - Telemetry payload containing events and metrics
3559+ * @returns Empty object on successful submission
3560+ *
3561+ * @throws {Error } When server returns 5xx status codes
3562+ */
3563+ async postOrgTelemetry (
3564+ orgSlug : string ,
3565+ telemetryData : PostOrgTelemetryPayload ,
3566+ ) : Promise < SocketSdkGenericResult < PostOrgTelemetryResponse > > {
3567+ try {
3568+ const data = ( await this . #executeWithRetry(
3569+ async ( ) =>
3570+ await getResponseJson (
3571+ await createRequestWithJson (
3572+ 'POST' ,
3573+ this . #baseUrl,
3574+ `orgs/${ encodeURIComponent ( orgSlug ) } /telemetry` ,
3575+ telemetryData ,
3576+ this . #reqOptions,
3577+ ) ,
3578+ ) ,
3579+ ) ) as PostOrgTelemetryResponse
3580+ return {
3581+ cause : undefined ,
3582+ data,
3583+ error : undefined ,
3584+ status : 200 ,
3585+ success : true ,
3586+ }
3587+ /* c8 ignore start - Standard API error handling, tested via public method error cases */
3588+ } catch ( e ) {
3589+ return this . #createQueryErrorResult< PostOrgTelemetryResponse > ( e )
3590+ }
3591+ /* c8 ignore stop */
3592+ }
34843593}
34853594
34863595// Optional live heap trace.
0 commit comments