UNPKG

chargebee

Version:

A library for integrating with Chargebee.

75 lines (74 loc) 3.42 kB
"use strict"; // Generated Zod schemas: Alert // Actions: create, list, update, application_alertsForSubscription // Do not edit manually – regenerate via sdk-generator Object.defineProperty(exports, "__esModule", { value: true }); exports.ApplicationAlertsforsubscriptionAlertBodySchema = exports.UpdateAlertBodySchema = exports.ListAlertBodySchema = exports.CreateAlertBodySchema = void 0; const zod_1 = require("zod"); //Alert.create const CreateAlertThresholdSchema = zod_1.z.object({ mode: zod_1.z.enum(['absolute', 'percentage']), value: zod_1.z.number(), }); const CreateAlertFilterConditionsSchema = zod_1.z.object({ field: zod_1.z.array(zod_1.z.enum(['plan_price_id']).optional()).optional(), operator: zod_1.z.array(zod_1.z.enum(['equals', 'not_equals']).optional()).optional(), value: zod_1.z.array(zod_1.z.string().max(50).optional()).optional(), }); const CreateAlertBodySchema = zod_1.z.looseObject({ type: zod_1.z.enum(['usage_exceeded']), name: zod_1.z.string().max(50), description: zod_1.z.string().max(65000).optional(), metered_feature_id: zod_1.z.string().max(50), subscription_id: zod_1.z.string().max(50).optional(), meta: zod_1.z.string().max(65000).optional(), threshold: CreateAlertThresholdSchema.optional(), filter_conditions: CreateAlertFilterConditionsSchema.optional(), }); exports.CreateAlertBodySchema = CreateAlertBodySchema; //Alert.list const ListAlertIdSchema = zod_1.z.object({ in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(), }); const ListAlertTypeSchema = zod_1.z.object({ is: zod_1.z.enum(['usage_exceeded']).optional(), }); const ListAlertSubscriptionIdSchema = zod_1.z.object({ is: zod_1.z.string().min(1).optional(), }); const ListAlertStatusSchema = zod_1.z.object({ is: zod_1.z.enum(['enabled', 'disabled']).optional(), }); const ListAlertBodySchema = zod_1.z.looseObject({ limit: zod_1.z.number().int().min(1).max(100).optional(), offset: zod_1.z.string().max(1000).optional(), id: ListAlertIdSchema.optional(), type: ListAlertTypeSchema.optional(), subscription_id: ListAlertSubscriptionIdSchema.optional(), status: ListAlertStatusSchema.optional(), }); exports.ListAlertBodySchema = ListAlertBodySchema; //Alert.update const UpdateAlertThresholdSchema = zod_1.z.object({ mode: zod_1.z.enum(['absolute', 'percentage']).optional(), value: zod_1.z.number().optional(), }); const UpdateAlertBodySchema = zod_1.z.looseObject({ status: zod_1.z.enum(['enabled', 'disabled']).optional(), threshold: UpdateAlertThresholdSchema.optional(), }); exports.UpdateAlertBodySchema = UpdateAlertBodySchema; //Alert.application_alertsForSubscription const ApplicationAlertsforsubscriptionAlertStatusSchema = zod_1.z.object({ is: zod_1.z.enum(['enabled', 'disabled']).optional(), }); const ApplicationAlertsforsubscriptionAlertTypeSchema = zod_1.z.object({ is: zod_1.z.enum(['usage_exceeded']).optional(), }); const ApplicationAlertsforsubscriptionAlertBodySchema = zod_1.z.looseObject({ limit: zod_1.z.number().int().min(1).max(100).optional(), offset: zod_1.z.string().max(1000).optional(), status: ApplicationAlertsforsubscriptionAlertStatusSchema.optional(), type: ApplicationAlertsforsubscriptionAlertTypeSchema.optional(), }); exports.ApplicationAlertsforsubscriptionAlertBodySchema = ApplicationAlertsforsubscriptionAlertBodySchema;