import {z} from 'zod' export type CommonEnablingState = 'UNSPECIFIED' | 'ENABLED' | 'DISABLED'; export type DspCreativeGroupStatus = 'UNKNOWN_STATUS' | 'DRAFT' | 'SUBMITTED' | 'REVIEW_NOT_NEEDED' | 'UNDER_REVIEW' | 'APPROVED' | 'DISAPPROVED'; export type CreativeGroupActionType = 'UNKNOWN_TYPE' | 'CREATE' | 'UPDATE' | 'START_REVIEW' | 'DISAPPROVE' | 'APPROVE' | 'REQUEST_REVIEW'; export type DspCreativeGroupAction = {id?: string | undefined, user_id?: string | undefined, user_display_name?: string | undefined, action_type?: CreativeGroupActionType | undefined, comment?: string | undefined, created_at?: string | undefined}; export type AudienceTargetingConditionPlacementReason = 'UNKNOWN_PLACEMENT_REASON' | 'REASON_BRAND_SAFETY' | 'REASON_PERFORMANCE_IMPROVEMENT' | 'REASON_AGE_RESTRICTION' | 'REASON_FRAUD' | 'REASON_OWN_APP_CROSS_PROMOTION_BLOCKING' | 'REASON_NOT_OPERATING_IN_A_SPECIFIC_LOCATION' | 'REASON_INCREMENTALITY_TESTING' | 'REASON_OTHER'; export type AdcloudcommonCreativeType = 'UNKNOWN_CREATIVE_TYPE' | 'IMAGE_BANNER' | 'IMAGE_INTERSTITIAL' | 'VIDEO_BANNER' | 'VIDEO_INTERSTITIAL' | 'NATIVE_LOGO' | 'NATIVE_VIDEO' | 'NATIVE_IMAGE' | 'CUSTOM_HTML_BANNER' | 'CUSTOM_HTML_INTERSTITIAL' | 'TEMPLATE_HTML_BANNER' | 'TEMPLATE_HTML_INTERSTITIAL' | 'RICH_CUSTOM_HTML_BANNER' | 'RICH_CUSTOM_HTML_INTERSTITIAL' | 'DYNAMIC_HTML_BANNER' | 'DYNAMIC_HTML_INTERSTITIAL'; export type CommonLatLng = {latitude?: number | undefined, longitude?: number | undefined}; export type CommonCircle = {center?: CommonLatLng | undefined, radius?: number | undefined}; export type CommonAdExchange = 'UNKNOWN_AD_EXCHANGE' | 'MOPUB' | 'ADX' | 'ADMIXER' | 'SMAATO' | 'RUBICON' | 'EXELBID' | 'BRIGHTROLL' | 'CAULYRTB' | 'ADLIB' | 'ORION' | 'MOLOCO' | 'ADOP' | 'APPLOVIN' | 'FYBER' | 'SAMSUNG' | 'ADCOLONY' | 'POLYMORPH' | 'CHARTBOOST' | 'MANPLUS' | 'KAKAO' | 'UNITY' | 'FYBERCORE' | 'ADGENERATION' | 'SAMSUNGPAY' | 'NHN' | 'ADPOPCORN' | 'OPENX' | 'VUNGLE' | 'ADALPHA' | 'BYTEDANCE' | 'NAVER' | 'INMOBI' | 'SIGNALPLAY' | 'ACUITY' | 'IRONSOURCE' | 'PUBMATIC' | 'BAIDU' | 'FLUCT' | 'FIVE' | 'APPODEAL' | 'ADPIE' | 'MOBILITYWARE' | 'TPMN' | 'PUBNATIVE' | 'TAPJOY' | 'MOMENTO' | 'BIDENCE' | 'APS' | 'INDEX' | 'IQZONE' | 'STARTIO' | 'FLOWER' | 'ONESTORE' | 'NIMBUS' | 'AEQUUS' | 'MCTV' | 'MINTEGRAL' | 'MOLOCO_SDK_APPLOVIN' | 'MOLOCO_SDK_IRONSOURCE' | 'PANGLE' | 'MAGNITE' | 'MOLOCO_SDK_X3MADS' | 'FREE_WHEEL' | 'MOLOCO_SDK_ADMOB' | 'ADX_RTB' | 'XIAOMI' | 'MOLOCO_SDK_CREATIVE_TEST' | 'MOLOCO_SDK_MAX' | 'MOLOCO_SDK_LEVELPLAY' | 'NEXXEN' | 'MOLOCO_SDK_ADMOB_MEDIATION' | 'MOLOCO_SDK' | 'MOLOCO_SDK_IN_HOUSE_MEDIATION' | 'TABOOLA' | 'CRITEO' | 'MOLOCO_SDK_DIRECT_AD' | 'APX1' | 'DIRECT_AD' | 'BIGO' | 'CAS' | 'TUBI' | 'SPRINGSERVE' | 'PUBLICA'; export type CommonDeviceType = 'UNKNOWN_DEVICE_TYPE' | 'MOBILE' | 'PERSONAL_COMPUTER' | 'CONNECTED_TV' | 'HIGHEND_PHONE' | 'TABLET' | 'CONNECTED_DEVICE' | 'SET_TOP_BOX'; export type AdcloudcommonEventType = 'UNKNOWN_EVENT_TYPE' | 'BID_MADE' | 'BID_WON' | 'IMPRESSION' | 'IMPRESSION_EXTRA' | 'CLICK' | 'INSTALL' | 'CUSTOM'; export type AudienceTargetingConditionRecentCampaignActivityFilter = {event: AdcloudcommonEventType, campaign_id: string, last_n_days: number}; export type AudienceTargetingConditionLocationFilter = {cities?: Array | undefined, regions?: Array | undefined, zipcodes?: Array | undefined, geofences?: Array | undefined}; export type CommonGender = 'UNKNOWN_GENDER' | 'FEMALE' | 'MALE'; export type CommonDeviceOs = 'UNKNOWN_DEVICE_OS' | 'ANDROID' | 'IOS' | 'VERSATILE' | 'MOBILE_WEB' | 'MACOS' | 'WINDOWS' | 'NEXT_VERSATILE'; export type AudienceTargetingConditionDeviceOsFilter = {os: CommonDeviceOs, min_version?: string | undefined, max_version?: string | undefined}; export type AudienceTargetingConditionMediaChannelType = 'UNKNOWN_MEDIA_CHANNEL_TYPE' | 'APP' | 'WEB'; export type AudienceTargetingConditionNewUserFilter = {last_n_days: number}; export type CommonAdvertiserIdType = 'UNKNOWN_ADVERTISER_ID_TYPE' | 'ANDROID_IDFA' | 'IOS_IDFA' | 'GENERIC_USER_ID' | 'GENERIC_DEVICE_ID' | 'ANDROID_LAT_IDFA' | 'IOS_LAT_IDFA'; export type DspAudienceTargetingConditionVideoType = 'UNKNOWN_VIDEO_TYPE' | 'REWARD_VIDEO' | 'NON_REWARD_VIDEO' | 'NON_VIDEO'; export type AdcloudcommonTimezonePolicy = 'UNKNOWN_TIME' | 'DEVICE_TIME' | 'UTC_TIME' | 'AD_ACCOUNT_TIME' | 'ADVERTISER_TIME'; export type AdcloudcommonInterval = {start?: number | undefined, end?: number | undefined}; export type AdcloudcommonDayOfWeek = 'UNKNOWN_DAY_OF_WEEK' | 'MON' | 'TUE' | 'WED' | 'THU' | 'FRI' | 'SAT' | 'SUN'; export type AudienceTargetingConditionWeeklyScheduleFilter = {timezone_policy?: AdcloudcommonTimezonePolicy | undefined, hour_range?: AdcloudcommonInterval | undefined, days: Array}; export type AdcloudcommonFloatingPointRange = {start?: number | undefined, end?: number | undefined}; export type CommonBannerApi = 'UNKNOWN_BANNER_API' | 'MRAID_2'; export type CommonTimeInterval = {start?: string | undefined, end?: string | undefined}; export type CommonAudienceData = {provider?: string | undefined, condition?: string | undefined}; export type CommonPostbackEventCount = {app_bundle?: string | undefined, range?: AdcloudcommonInterval | undefined, events?: Array | undefined}; export type CommonTagsThrottleCondition = {tags?: Array | undefined, throttle_rate?: number | undefined}; export type CommonDisplayManagerVersion = {min?: string | undefined, max?: string | undefined}; export type CommonTimeUnit = 'UNKNOWN_TIME_UNIT' | 'MINUTE' | 'HOUR' | 'DAY' | 'WEEK'; export type CommonPostbackEventsCondition = {audiences?: Array | undefined, events?: Array | undefined, past_time_range?: AdcloudcommonInterval | undefined, past_time_range_unit?: CommonTimeUnit | undefined, range?: CommonTimeInterval | undefined, short_term_user_profile?: boolean | undefined, count_range?: AdcloudcommonInterval | undefined}; export type LocationSetZipCodeSet = {zipcodes?: Array | undefined, country?: string | undefined}; export type AudienceTargetingConditionLocationSet = {osm_ids?: Array | undefined, zipcodes?: Array | undefined}; export type AudienceTargetingConditionCoppaAcceptance = 'UNKNOWN_COPPA' | 'ACCEPT_COPPA_ONLY' | 'DENY_COPPA'; export type AudienceTargetingConditionSkanTraffic = 'UNKNOWN_SKAN' | 'TARGET_SKAN_ONLY' | 'TARGET_NON_SKAN'; export type CommonTimeDuration = {amount?: unknown | undefined, unit?: CommonTimeUnit | undefined}; export type CustomAudienceSetAppEvent = {product_id?: string | undefined, event?: string | undefined, sliding_window_duration?: CommonTimeDuration | undefined}; export type CustomAudienceSetApp = {product_id?: string | undefined, sliding_window_duration?: CommonTimeDuration | undefined}; export type CustomAudienceSetCustomAudienceCondition = {app_events?: Array | undefined, user_lists?: Array | undefined, apps?: Array | undefined}; export type AudienceTargetingConditionCustomAudienceSet = {include_having_all?: CustomAudienceSetCustomAudienceCondition | undefined, include_having_any?: CustomAudienceSetCustomAudienceCondition | undefined, exclude_having_all?: CustomAudienceSetCustomAudienceCondition | undefined, exclude_having_any?: CustomAudienceSetCustomAudienceCondition | undefined}; export type DspAudienceTargetingCondition = {allowed_countries?: Array | undefined, blocked_countries?: Array | undefined, placement_reasons?: Array | undefined, custom_placement_reason?: string | undefined, allowed_app_bundles?: Array | undefined, blocked_app_bundles?: Array | undefined, allowed_content_categories?: Array | undefined, blocked_content_categories?: Array | undefined, allowed_cities?: Array | undefined, blocked_cities?: Array | undefined, allowed_creative_types?: Array | undefined, blocked_creative_types?: Array | undefined, allowed_websites?: Array | undefined, blocked_websites?: Array | undefined, allowed_geofences?: Array | undefined, blocked_geofences?: Array | undefined, allowed_exchanges?: Array | undefined, blocked_exchanges?: Array | undefined, allowed_idfas?: Array | undefined, blocked_idfas?: Array | undefined, allowed_zipcodes?: Array | undefined, blocked_zipcodes?: Array | undefined, allowed_device_models?: Array | undefined, blocked_device_models?: Array | undefined, allowed_user_audience_tags?: Array | undefined, blocked_user_audience_tags?: Array | undefined, allowed_languages?: Array | undefined, blocked_languages?: Array | undefined, allowed_device_types?: Array | undefined, blocked_device_types?: Array | undefined, allowed_mostly_visited_countries?: Array | undefined, blocked_mostly_visited_countries?: Array | undefined, allowed_regions?: Array | undefined, blocked_regions?: Array | undefined, allowed_recent_campaign_activities?: Array | undefined, blocked_recent_campaign_activities?: Array | undefined, allowed_locations?: Array | undefined, blocked_locations?: Array | undefined, genders?: Array | undefined, connection_types?: Array | undefined, allowed_direct_deal_ids?: Array | undefined, blocked_direct_deal_ids?: Array | undefined, device_oses?: Array | undefined, media_channel_type?: AudienceTargetingConditionMediaChannelType | undefined, new_users?: AudienceTargetingConditionNewUserFilter | undefined, advertiser_id_types?: Array | undefined, allowed_video_types?: Array | undefined, blocked_video_types?: Array | undefined, weekly_schedules?: Array | undefined, allowed_gender_score?: AdcloudcommonFloatingPointRange | undefined, blocked_gender_score?: AdcloudcommonFloatingPointRange | undefined, allowed_ages?: Array | undefined, blocked_ages?: Array | undefined, allowed_ip_ranges?: Array | undefined, blocked_ip_ranges?: Array | undefined, allowed_device_carriers?: Array | undefined, blocked_device_carriers?: Array | undefined, allowed_keywords?: Array | undefined, blocked_keywords?: Array | undefined, user_buckets?: Array | undefined, allowed_ad_units?: Array | undefined, blocked_ad_units?: Array | undefined, allowed_placements?: Array | undefined, blocked_placements?: Array | undefined, allowed_banner_apis?: Array | undefined, blocked_banner_apis?: Array | undefined, schedule?: CommonTimeInterval | undefined, audience_data?: CommonAudienceData | undefined, allowed_apps_by_checksum?: Array | undefined, blocked_apps_by_checksum?: Array | undefined, allowed_postback_event_counts?: Array | undefined, auction_types?: Array | undefined, throttle_apt_tags?: CommonTagsThrottleCondition | undefined, allowed_dev_makes?: Array | undefined, blocked_dev_makes?: Array | undefined, display_manager_versions?: Array | undefined, allowed_audiences?: Array | undefined, blocked_audiences?: Array | undefined, allowed_postback_has_all_events_conditions?: Array | undefined, blocked_postback_has_all_events_conditions?: Array | undefined, allowed_postback_has_any_events_conditions?: Array | undefined, blocked_postback_has_any_events_conditions?: Array | undefined, allowed_location_set?: AudienceTargetingConditionLocationSet | undefined, blocked_location_set?: AudienceTargetingConditionLocationSet | undefined, allowed_apt_tags?: Array | undefined, blocked_apt_tags?: Array | undefined, coppa_acceptance?: AudienceTargetingConditionCoppaAcceptance | undefined, skan_traffic?: AudienceTargetingConditionSkanTraffic | undefined, contains_custom_audience?: boolean | undefined, custom_audience_set?: AudienceTargetingConditionCustomAudienceSet | undefined}; export type AdclouddspAudience = {shared_audience_target_ids?: Array | undefined, targeting_condition?: DspAudienceTargetingCondition | undefined}; export type AdcloudcommonCreativeFeatureType = 'UNKNOWN_CREATIVE_FEATURE_TYPE' | 'GENERAL' | 'DYNAMIC_CREATIVE'; export type CreativeFeatureDynamicCreative = {app_icon_url?: string | undefined, brand_logo_url?: string | undefined, business_title?: string | undefined, cta_text?: string | undefined, cta_color?: string | undefined, image_border_color?: string | undefined, title_preamble?: string | undefined, main_text?: string | undefined, main_text_color?: string | undefined, cta_text_color?: string | undefined, background_color?: string | undefined, price_locale?: string | undefined, disclaimer_text?: string | undefined, disclaimer_text_color?: string | undefined, sponsored_by?: string | undefined}; export type DspCreativeFeature = {type?: AdcloudcommonCreativeFeatureType | undefined, dynamic_creative?: CreativeFeatureDynamicCreative | undefined}; export type DspCreativeVideoSrcTargetAdPosition = 'DEFAULT' | 'FIRST_AD_ONLY' | 'LAST_AD_ONLY'; export type DspCreativeGroupPublisherProperties = {skippable?: boolean | undefined, video_target_ad_position?: DspCreativeVideoSrcTargetAdPosition | undefined}; export type DspCreativeGroup = {id?: string | undefined, ad_account_id?: string | undefined, product_id?: string | undefined, title: string, description?: string | undefined, enabling_state?: CommonEnablingState | undefined, creative_ids?: Array | undefined, status?: DspCreativeGroupStatus | undefined, action_history?: Array | undefined, tracking_link_id?: string | undefined, landing_url?: string | undefined, final_landing_url?: string | undefined, mmp_tag?: string | undefined, audience?: AdclouddspAudience | undefined, feature?: DspCreativeFeature | undefined, created_at?: string | undefined, updated_at?: string | undefined, publisher_properties?: DspCreativeGroupPublisherProperties | undefined}; export type CreateApiCmV1CreativeGroupsArgs = {ad_account_id: string, product_id: string, body: DspCreativeGroup}; export type CreateApiCmV1CreativeGroupsOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; export const commonEnablingState = z.enum(["UNSPECIFIED", "ENABLED", "DISABLED"]); export const dspCreativeGroupStatus = z.enum(["UNKNOWN_STATUS", "DRAFT", "SUBMITTED", "REVIEW_NOT_NEEDED", "UNDER_REVIEW", "APPROVED", "DISAPPROVED"]); export const creativeGroupActionType = z.enum(["UNKNOWN_TYPE", "CREATE", "UPDATE", "START_REVIEW", "DISAPPROVE", "APPROVE", "REQUEST_REVIEW"]); export const dspCreativeGroupAction = z.object({id: z.string().optional(), user_id: z.string().optional(), user_display_name: z.string().optional(), action_type: creativeGroupActionType.optional(), comment: z.string().optional(), created_at: z.string().optional()}); export const audienceTargetingConditionPlacementReason = z.enum(["UNKNOWN_PLACEMENT_REASON", "REASON_BRAND_SAFETY", "REASON_PERFORMANCE_IMPROVEMENT", "REASON_AGE_RESTRICTION", "REASON_FRAUD", "REASON_OWN_APP_CROSS_PROMOTION_BLOCKING", "REASON_NOT_OPERATING_IN_A_SPECIFIC_LOCATION", "REASON_INCREMENTALITY_TESTING", "REASON_OTHER"]); export const adcloudcommonCreativeType = z.enum(["UNKNOWN_CREATIVE_TYPE", "IMAGE_BANNER", "IMAGE_INTERSTITIAL", "VIDEO_BANNER", "VIDEO_INTERSTITIAL", "NATIVE_LOGO", "NATIVE_VIDEO", "NATIVE_IMAGE", "CUSTOM_HTML_BANNER", "CUSTOM_HTML_INTERSTITIAL", "TEMPLATE_HTML_BANNER", "TEMPLATE_HTML_INTERSTITIAL", "RICH_CUSTOM_HTML_BANNER", "RICH_CUSTOM_HTML_INTERSTITIAL", "DYNAMIC_HTML_BANNER", "DYNAMIC_HTML_INTERSTITIAL"]); export const commonLatLng = z.object({latitude: z.number().optional(), longitude: z.number().optional()}); export const commonCircle = z.object({center: commonLatLng.optional(), radius: z.number().optional()}); export const commonAdExchange = z.enum(["UNKNOWN_AD_EXCHANGE", "MOPUB", "ADX", "ADMIXER", "SMAATO", "RUBICON", "EXELBID", "BRIGHTROLL", "CAULYRTB", "ADLIB", "ORION", "MOLOCO", "ADOP", "APPLOVIN", "FYBER", "SAMSUNG", "ADCOLONY", "POLYMORPH", "CHARTBOOST", "MANPLUS", "KAKAO", "UNITY", "FYBERCORE", "ADGENERATION", "SAMSUNGPAY", "NHN", "ADPOPCORN", "OPENX", "VUNGLE", "ADALPHA", "BYTEDANCE", "NAVER", "INMOBI", "SIGNALPLAY", "ACUITY", "IRONSOURCE", "PUBMATIC", "BAIDU", "FLUCT", "FIVE", "APPODEAL", "ADPIE", "MOBILITYWARE", "TPMN", "PUBNATIVE", "TAPJOY", "MOMENTO", "BIDENCE", "APS", "INDEX", "IQZONE", "STARTIO", "FLOWER", "ONESTORE", "NIMBUS", "AEQUUS", "MCTV", "MINTEGRAL", "MOLOCO_SDK_APPLOVIN", "MOLOCO_SDK_IRONSOURCE", "PANGLE", "MAGNITE", "MOLOCO_SDK_X3MADS", "FREE_WHEEL", "MOLOCO_SDK_ADMOB", "ADX_RTB", "XIAOMI", "MOLOCO_SDK_CREATIVE_TEST", "MOLOCO_SDK_MAX", "MOLOCO_SDK_LEVELPLAY", "NEXXEN", "MOLOCO_SDK_ADMOB_MEDIATION", "MOLOCO_SDK", "MOLOCO_SDK_IN_HOUSE_MEDIATION", "TABOOLA", "CRITEO", "MOLOCO_SDK_DIRECT_AD", "APX1", "DIRECT_AD", "BIGO", "CAS", "TUBI", "SPRINGSERVE", "PUBLICA"]); export const commonDeviceType = z.enum(["UNKNOWN_DEVICE_TYPE", "MOBILE", "PERSONAL_COMPUTER", "CONNECTED_TV", "HIGHEND_PHONE", "TABLET", "CONNECTED_DEVICE", "SET_TOP_BOX"]); export const adcloudcommonEventType = z.enum(["UNKNOWN_EVENT_TYPE", "BID_MADE", "BID_WON", "IMPRESSION", "IMPRESSION_EXTRA", "CLICK", "INSTALL", "CUSTOM"]); export const audienceTargetingConditionRecentCampaignActivityFilter = z.object({event: adcloudcommonEventType, campaign_id: z.string(), last_n_days: z.number().int()}); export const audienceTargetingConditionLocationFilter = z.object({cities: z.array(z.string()).optional(), regions: z.array(z.string()).optional(), zipcodes: z.array(z.string()).optional(), geofences: z.array(commonCircle).optional()}); export const commonGender = z.enum(["UNKNOWN_GENDER", "FEMALE", "MALE"]); export const commonDeviceOs = z.enum(["UNKNOWN_DEVICE_OS", "ANDROID", "IOS", "VERSATILE", "MOBILE_WEB", "MACOS", "WINDOWS", "NEXT_VERSATILE"]); export const audienceTargetingConditionDeviceOsFilter = z.object({os: commonDeviceOs, min_version: z.string().optional(), max_version: z.string().optional()}); export const audienceTargetingConditionMediaChannelType = z.enum(["UNKNOWN_MEDIA_CHANNEL_TYPE", "APP", "WEB"]); export const audienceTargetingConditionNewUserFilter = z.object({last_n_days: z.number().int()}); export const commonAdvertiserIdType = z.enum(["UNKNOWN_ADVERTISER_ID_TYPE", "ANDROID_IDFA", "IOS_IDFA", "GENERIC_USER_ID", "GENERIC_DEVICE_ID", "ANDROID_LAT_IDFA", "IOS_LAT_IDFA"]); export const dspAudienceTargetingConditionVideoType = z.enum(["UNKNOWN_VIDEO_TYPE", "REWARD_VIDEO", "NON_REWARD_VIDEO", "NON_VIDEO"]); export const adcloudcommonTimezonePolicy = z.enum(["UNKNOWN_TIME", "DEVICE_TIME", "UTC_TIME", "AD_ACCOUNT_TIME", "ADVERTISER_TIME"]); export const adcloudcommonInterval = z.object({start: z.number().int().optional(), end: z.number().int().optional()}); export const adcloudcommonDayOfWeek = z.enum(["UNKNOWN_DAY_OF_WEEK", "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]); export const audienceTargetingConditionWeeklyScheduleFilter = z.object({timezone_policy: adcloudcommonTimezonePolicy.optional(), hour_range: adcloudcommonInterval.optional(), days: z.array(adcloudcommonDayOfWeek)}); export const adcloudcommonFloatingPointRange = z.object({start: z.number().optional(), end: z.number().optional()}); export const commonBannerApi = z.enum(["UNKNOWN_BANNER_API", "MRAID_2"]); export const commonTimeInterval = z.object({start: z.string().optional(), end: z.string().optional()}); export const commonAudienceData = z.object({provider: z.string().optional(), condition: z.string().optional()}); export const commonPostbackEventCount = z.object({app_bundle: z.string().optional(), range: adcloudcommonInterval.optional(), events: z.array(z.string()).optional()}); export const commonTagsThrottleCondition = z.object({tags: z.array(z.string()).optional(), throttle_rate: z.number().optional()}); export const commonDisplayManagerVersion = z.object({min: z.string().optional(), max: z.string().optional()}); export const commonTimeUnit = z.enum(["UNKNOWN_TIME_UNIT", "MINUTE", "HOUR", "DAY", "WEEK"]); export const commonPostbackEventsCondition = z.object({audiences: z.array(z.string()).optional(), events: z.array(z.string()).optional(), past_time_range: adcloudcommonInterval.optional(), past_time_range_unit: commonTimeUnit.optional(), range: commonTimeInterval.optional(), short_term_user_profile: z.boolean().optional(), count_range: adcloudcommonInterval.optional()}); export const locationSetZipCodeSet = z.object({zipcodes: z.array(z.string()).optional(), country: z.string().optional()}); export const audienceTargetingConditionLocationSet = z.object({osm_ids: z.array(z.string()).optional(), zipcodes: z.array(locationSetZipCodeSet).optional()}); export const audienceTargetingConditionCoppaAcceptance = z.enum(["UNKNOWN_COPPA", "ACCEPT_COPPA_ONLY", "DENY_COPPA"]); export const audienceTargetingConditionSkanTraffic = z.enum(["UNKNOWN_SKAN", "TARGET_SKAN_ONLY", "TARGET_NON_SKAN"]); export const commonTimeDuration = z.object({amount: z.string().optional(), unit: commonTimeUnit.optional()}); export const customAudienceSetAppEvent = z.object({product_id: z.string().optional(), event: z.string().optional(), sliding_window_duration: commonTimeDuration.optional()}); export const customAudienceSetApp = z.object({product_id: z.string().optional(), sliding_window_duration: commonTimeDuration.optional()}); export const customAudienceSetCustomAudienceCondition = z.object({app_events: z.array(customAudienceSetAppEvent).optional(), user_lists: z.array(z.string()).optional(), apps: z.array(customAudienceSetApp).optional()}); export const audienceTargetingConditionCustomAudienceSet = z.object({include_having_all: customAudienceSetCustomAudienceCondition.optional(), include_having_any: customAudienceSetCustomAudienceCondition.optional(), exclude_having_all: customAudienceSetCustomAudienceCondition.optional(), exclude_having_any: customAudienceSetCustomAudienceCondition.optional()}); export const dspAudienceTargetingCondition = z.object({allowed_countries: z.array(z.string()).optional(), blocked_countries: z.array(z.string()).optional(), placement_reasons: z.array(audienceTargetingConditionPlacementReason).optional(), custom_placement_reason: z.string().optional(), allowed_app_bundles: z.array(z.string()).optional(), blocked_app_bundles: z.array(z.string()).optional(), allowed_content_categories: z.array(z.string()).optional(), blocked_content_categories: z.array(z.string()).optional(), allowed_cities: z.array(z.string()).optional(), blocked_cities: z.array(z.string()).optional(), allowed_creative_types: z.array(adcloudcommonCreativeType).optional(), blocked_creative_types: z.array(adcloudcommonCreativeType).optional(), allowed_websites: z.array(z.string()).optional(), blocked_websites: z.array(z.string()).optional(), allowed_geofences: z.array(commonCircle).optional(), blocked_geofences: z.array(commonCircle).optional(), allowed_exchanges: z.array(commonAdExchange).optional(), blocked_exchanges: z.array(commonAdExchange).optional(), allowed_idfas: z.array(z.string()).optional(), blocked_idfas: z.array(z.string()).optional(), allowed_zipcodes: z.array(z.string()).optional(), blocked_zipcodes: z.array(z.string()).optional(), allowed_device_models: z.array(z.string()).optional(), blocked_device_models: z.array(z.string()).optional(), allowed_user_audience_tags: z.array(z.string()).optional(), blocked_user_audience_tags: z.array(z.string()).optional(), allowed_languages: z.array(z.string()).optional(), blocked_languages: z.array(z.string()).optional(), allowed_device_types: z.array(commonDeviceType).optional(), blocked_device_types: z.array(commonDeviceType).optional(), allowed_mostly_visited_countries: z.array(z.string()).optional(), blocked_mostly_visited_countries: z.array(z.string()).optional(), allowed_regions: z.array(z.string()).optional(), blocked_regions: z.array(z.string()).optional(), allowed_recent_campaign_activities: z.array(audienceTargetingConditionRecentCampaignActivityFilter).optional(), blocked_recent_campaign_activities: z.array(audienceTargetingConditionRecentCampaignActivityFilter).optional(), allowed_locations: z.array(audienceTargetingConditionLocationFilter).optional(), blocked_locations: z.array(audienceTargetingConditionLocationFilter).optional(), genders: z.array(commonGender).optional(), connection_types: z.array(z.string()).optional(), allowed_direct_deal_ids: z.array(z.string()).optional(), blocked_direct_deal_ids: z.array(z.string()).optional(), device_oses: z.array(audienceTargetingConditionDeviceOsFilter).optional(), media_channel_type: audienceTargetingConditionMediaChannelType.optional(), new_users: audienceTargetingConditionNewUserFilter.optional(), advertiser_id_types: z.array(commonAdvertiserIdType).optional(), allowed_video_types: z.array(dspAudienceTargetingConditionVideoType).optional(), blocked_video_types: z.array(dspAudienceTargetingConditionVideoType).optional(), weekly_schedules: z.array(audienceTargetingConditionWeeklyScheduleFilter).optional(), allowed_gender_score: adcloudcommonFloatingPointRange.optional(), blocked_gender_score: adcloudcommonFloatingPointRange.optional(), allowed_ages: z.array(adcloudcommonInterval).optional(), blocked_ages: z.array(adcloudcommonInterval).optional(), allowed_ip_ranges: z.array(z.string()).optional(), blocked_ip_ranges: z.array(z.string()).optional(), allowed_device_carriers: z.array(z.string()).optional(), blocked_device_carriers: z.array(z.string()).optional(), allowed_keywords: z.array(z.string()).optional(), blocked_keywords: z.array(z.string()).optional(), user_buckets: z.array(adcloudcommonInterval).optional(), allowed_ad_units: z.array(z.string()).optional(), blocked_ad_units: z.array(z.string()).optional(), allowed_placements: z.array(z.string()).optional(), blocked_placements: z.array(z.string()).optional(), allowed_banner_apis: z.array(commonBannerApi).optional(), blocked_banner_apis: z.array(commonBannerApi).optional(), schedule: commonTimeInterval.optional(), audience_data: commonAudienceData.optional(), allowed_apps_by_checksum: z.array(z.string()).optional(), blocked_apps_by_checksum: z.array(z.string()).optional(), allowed_postback_event_counts: z.array(commonPostbackEventCount).optional(), auction_types: z.array(z.string()).optional(), throttle_apt_tags: commonTagsThrottleCondition.optional(), allowed_dev_makes: z.array(z.string()).optional(), blocked_dev_makes: z.array(z.string()).optional(), display_manager_versions: z.array(commonDisplayManagerVersion).optional(), allowed_audiences: z.array(z.string()).optional(), blocked_audiences: z.array(z.string()).optional(), allowed_postback_has_all_events_conditions: z.array(commonPostbackEventsCondition).optional(), blocked_postback_has_all_events_conditions: z.array(commonPostbackEventsCondition).optional(), allowed_postback_has_any_events_conditions: z.array(commonPostbackEventsCondition).optional(), blocked_postback_has_any_events_conditions: z.array(commonPostbackEventsCondition).optional(), allowed_location_set: audienceTargetingConditionLocationSet.optional(), blocked_location_set: audienceTargetingConditionLocationSet.optional(), allowed_apt_tags: z.array(z.string()).optional(), blocked_apt_tags: z.array(z.string()).optional(), coppa_acceptance: audienceTargetingConditionCoppaAcceptance.optional(), skan_traffic: audienceTargetingConditionSkanTraffic.optional(), contains_custom_audience: z.boolean().optional(), custom_audience_set: audienceTargetingConditionCustomAudienceSet.optional()}); export const adclouddspAudience = z.object({shared_audience_target_ids: z.array(z.string()).optional(), targeting_condition: dspAudienceTargetingCondition.optional()}); export const adcloudcommonCreativeFeatureType = z.enum(["UNKNOWN_CREATIVE_FEATURE_TYPE", "GENERAL", "DYNAMIC_CREATIVE"]); export const creativeFeatureDynamicCreative = z.object({app_icon_url: z.string().optional(), brand_logo_url: z.string().optional(), business_title: z.string().optional(), cta_text: z.string().optional(), cta_color: z.string().optional(), image_border_color: z.string().optional(), title_preamble: z.string().optional(), main_text: z.string().optional(), main_text_color: z.string().optional(), cta_text_color: z.string().optional(), background_color: z.string().optional(), price_locale: z.string().optional(), disclaimer_text: z.string().optional(), disclaimer_text_color: z.string().optional(), sponsored_by: z.string().optional()}); export const dspCreativeFeature = z.object({type: adcloudcommonCreativeFeatureType.optional(), dynamic_creative: creativeFeatureDynamicCreative.optional()}); export const dspCreativeVideoSrcTargetAdPosition = z.enum(["DEFAULT", "FIRST_AD_ONLY", "LAST_AD_ONLY"]); export const dspCreativeGroupPublisherProperties = z.object({skippable: z.boolean().optional(), video_target_ad_position: dspCreativeVideoSrcTargetAdPosition.optional()}); export const dspCreativeGroup = z.object({id: z.string().optional(), ad_account_id: z.string().optional(), product_id: z.string().optional(), title: z.string(), description: z.string().optional(), enabling_state: commonEnablingState.optional(), creative_ids: z.array(z.string()).optional(), status: dspCreativeGroupStatus.optional(), action_history: z.array(dspCreativeGroupAction).optional(), tracking_link_id: z.string().optional(), landing_url: z.string().optional(), final_landing_url: z.string().optional(), mmp_tag: z.string().optional(), audience: adclouddspAudience.optional(), feature: dspCreativeFeature.optional(), created_at: z.string().optional(), updated_at: z.string().optional(), publisher_properties: dspCreativeGroupPublisherProperties.optional()}); export const dspAdvertiserInfo = z.object({id: z.string().optional(), title: z.string().optional(), description: z.string().optional()}); export const dspCreativeType = z.enum(["UNKNOWN_TYPE", "IMAGE", "VIDEO", "VAST_VIDEO", "NATIVE", "NATIVE_IMAGE", "NATIVE_VIDEO", "CUSTOM_HTML", "TEMPLATE_HTML", "RICH_CUSTOM_HTML", "DYNAMIC_HTML", "AD_TAG"]); export const dspCreativeImageSrc = z.object({image_url: z.string().optional(), filename: z.string().optional(), width: z.number().int().optional(), height: z.number().int().optional(), size_in_bytes: z.number().int().optional()}); export const dspCreativeHtmlRequirementAttributesFlag = z.enum(["UNKNOWN_FLAG", "MRAID2", "IN_BANNER_VIDEO"]); export const creativeHtmlRequirementAttributesCustomCloseType = z.enum(["UNKNOWN_CUSTOM_CLOSE_TYPE", "CUSTOM_CLOSE_TYPE_NONE", "CUSTOM_CLOSE_TYPE_ENABLED", "CUSTOM_CLOSE_TYPE_CONTROLLABLE"]); export const creativeHtmlRequirementAttributesAutoPlayAudioType = z.enum(["UNKNOWN_AUTO_PLAY_AUDIO_TYPE", "AUTO_PLAY_AUDIO_TYPE_MUTED", "AUTO_PLAY_AUDIO_TYPE_AUTO_PLAY", "AUTO_PLAY_AUDIO_TYPE_CONTROLLABLE"]); export const dspCreativeHtmlRequirementAttributes = z.object({flags: z.array(dspCreativeHtmlRequirementAttributesFlag).optional(), use_custom_close: creativeHtmlRequirementAttributesCustomCloseType.optional(), auto_play_audio: creativeHtmlRequirementAttributesAutoPlayAudioType.optional()}); export const dspCreativeHtmlSizeAttributesFixed = z.object({width: z.number().int().optional(), height: z.number().int().optional()}); export const dspCreativeHtmlSizeAttributes = z.object({interstitial: z.boolean().optional(), fixed: z.array(dspCreativeHtmlSizeAttributesFixed).optional()}); export const dspCreativeRichCustomHtmlSrcPlayableADSourceType = z.enum(["UNKNOWN_PLAYABLE_AD_SOURCE_TYPE", "PLAYABLE_AD_SOURCE_TYPE_URL", "PLAYABLE_AD_SOURCE_TYPE_TAG"]); export const creativeRichCustomHtmlSrcPlayableADSourceData = z.object({type: dspCreativeRichCustomHtmlSrcPlayableADSourceType.optional(), value: z.string().optional()}); export const dspCreativeRichCustomHtmlSrc = z.object({entry_html: z.string().optional(), html_requirement_attributes: dspCreativeHtmlRequirementAttributes, html_size_attributes: dspCreativeHtmlSizeAttributes.optional(), max_video_duration_seconds: z.number().int().optional(), playable_ad_source: creativeRichCustomHtmlSrcPlayableADSourceData.optional(), filename: z.string().optional()}); export const dspCreativeDynamicHtmlSrcPolicyPolicyFunction = z.enum(["UNKNOWN_POLICY", "RANDOM_SELECTION", "MOST_RECENT_VIEW", "IN_CART", "GLOBAL_TREND", "TREND", "COMBINED_EVENTS_RECENCY", "FREQUENTLY_BOUGHT_TOGETHER", "FREQUENTLY_SEEN_TOGETHER", "KEYWORD_SEARCH_WITH_CLIENT_RESULT", "COMBINED_EVENTS_RECENCY_WITH_KEYWORD_SEARCH", "MODEL", "GAME", "RMP_AUDIENCE_EXTENSION", "MCM_ITEM_RECOMMENDATION", "NEXT_ITEM_SELECTION"]); export const dspCreativeDynamicHtmlSrcPolicyPolicyFunctionConfigTrendConfig = z.object({name: z.string().optional()}); export const policySourcerType = z.enum(["UNKNOWN_SOURCER", "SOURCER_TEST_CATALOG_DEPENDENT", "SOURCER_TEST_CATALOG_INDEPENDENT", "SOURCER_DEFAULT", "SOURCER_USER_SIGNAL", "SOURCER_TRENDS", "SOURCER_RELATED_ITEMS", "SOURCER_AUCTION_ITEMS"]); export const policyEvaluatorType = z.enum(["UNKNOWN_EVALUATOR", "EVALUATOR_TEST_CATALOG_DEPENDENT", "EVALUATOR_TEST_CATALOG_INDEPENDENT", "EVALUATOR_RANDOM", "EVALUATOR_LR"]); export const dspCreativeDynamicHtmlSrcPolicyPolicyFunctionConfigModelConfig = z.object({sourcer_type: policySourcerType.optional(), evaluator_type: policyEvaluatorType.optional(), evaluator_suffix: z.string().optional(), user_signal_window_hours: z.number().int().optional()}); export const dspCreativeDynamicHtmlSrcPolicyPolicyFunctionConfigGameConfig = z.object({game_id: z.string().optional()}); export const dspCreativeDynamicHtmlSrcPolicyPolicyFunctionConfigMcmItemRecommendationConfig = z.object({mcm_platform_id: z.string().optional(), inventory_id: z.string().optional()}); export const dspCreativeDynamicHtmlSrcPolicyPolicyFunctionConfigNextItemSelectionConfig = z.object({require_video: z.boolean().optional(), skip_internal_review: z.boolean().optional()}); export const dspCreativeDynamicHtmlSrcPolicyPolicyFunctionConfig = z.object({trend: dspCreativeDynamicHtmlSrcPolicyPolicyFunctionConfigTrendConfig.optional(), model: dspCreativeDynamicHtmlSrcPolicyPolicyFunctionConfigModelConfig.optional(), game: dspCreativeDynamicHtmlSrcPolicyPolicyFunctionConfigGameConfig.optional(), mcm_item_recommendation: dspCreativeDynamicHtmlSrcPolicyPolicyFunctionConfigMcmItemRecommendationConfig.optional(), next_item_selection: dspCreativeDynamicHtmlSrcPolicyPolicyFunctionConfigNextItemSelectionConfig.optional()}); export const dspCreativeDynamicHtmlSrcPolicyItemCapperFrequency = z.object({period: z.string().optional(), max_exposures: z.number().int().optional()}); export const dspCreativeDynamicHtmlSrcPolicyItemCapper = z.object({frequency: dspCreativeDynamicHtmlSrcPolicyItemCapperFrequency.optional()}); export const dspCreativeDynamicHtmlSrcPolicy = z.object({function: dspCreativeDynamicHtmlSrcPolicyPolicyFunction.optional(), function_config: dspCreativeDynamicHtmlSrcPolicyPolicyFunctionConfig.optional(), num_items: z.number().int().optional(), catalog: z.string().optional(), item_capper: dspCreativeDynamicHtmlSrcPolicyItemCapper.optional()}); export const dspCreativeDynamicHtmlSrc = z.object({template_id: z.string(), template_env: z.record(z.string(), z.string()).optional(), rendered_entry_html: z.string(), html_requirement_attributes: dspCreativeHtmlRequirementAttributes.optional(), html_size_attributes: dspCreativeHtmlSizeAttributes.optional(), policy: dspCreativeDynamicHtmlSrcPolicy.optional()}); export const dspCreativeVideoSrcTranscodingInfoStatus = z.enum(["UNKNOWN_STATUS", "IN_PROGRESS", "SUCCEEDED", "FAILED"]); export const dspCreativeVideoSrcTranscodingInfo = z.object({status: dspCreativeVideoSrcTranscodingInfoStatus.optional(), failed_reason: z.string().optional()}); export const dspCreativeVideoSrc = z.object({video_url: z.string(), filename: z.string().optional(), width: z.number().int(), height: z.number().int(), length_seconds: z.number().int(), fps: z.number().int().optional(), size_in_bytes: z.number().int().optional(), companion_images: z.array(dspCreativeImageSrc).optional(), auto_endcard: z.boolean().optional(), playable_endcard: dspCreativeRichCustomHtmlSrc.optional(), dynamic_html_endcard: dspCreativeDynamicHtmlSrc.optional(), transcoding_info: dspCreativeVideoSrcTranscodingInfo.optional()}); export const dspCreativeVastVideoSrc = z.object({vast_tag: z.string(), width: z.number().int().optional(), height: z.number().int().optional(), length_seconds: z.number().int().optional()}); export const dspCreativeNativeSrc = z.object({icon_image: dspCreativeImageSrc, main_image: dspCreativeImageSrc, shrunk_main_image: dspCreativeImageSrc.optional(), title: z.string(), text: z.string(), cta_text: z.string(), sponsored_by: z.string().optional(), star_rating: z.number().optional(), video: dspCreativeVideoSrc.optional(), vast_video: dspCreativeVastVideoSrc.optional()}); export const dspCreativeCustomHtmlSrc = z.object({html: z.string(), width: z.number().int(), height: z.number().int(), image_url: z.string()}); export const dspCreativeTemplateHtmlSrc = z.object({template_id: z.string(), template_env: z.record(z.string(), z.string()).optional(), rendered_entry_html: z.string(), html_requirement_attributes: dspCreativeHtmlRequirementAttributes.optional(), html_size_attributes: dspCreativeHtmlSizeAttributes.optional(), max_video_duration_seconds: z.number().int().optional()}); export const dspCreative = z.object({id: z.string().optional(), ad_account_id: z.string().optional(), product_id: z.string().optional(), title: z.string(), enabling_state: commonEnablingState.optional(), advertiser_info: dspAdvertiserInfo.optional(), type: dspCreativeType.optional(), original_filename: z.string(), size_in_bytes: z.number().int().optional(), custom_key_values: z.record(z.string(), z.string()).optional(), image: dspCreativeImageSrc.optional(), video: dspCreativeVideoSrc.optional(), vast_video: dspCreativeVastVideoSrc.optional(), native: dspCreativeNativeSrc.optional(), custom_html: dspCreativeCustomHtmlSrc.optional(), template_html: dspCreativeTemplateHtmlSrc.optional(), rich_custom_html: dspCreativeRichCustomHtmlSrc.optional(), dynamic_html: dspCreativeDynamicHtmlSrc.optional(), feature_type: adcloudcommonCreativeFeatureType.optional(), creator_tag: z.string().optional(), created_at: z.string().optional(), updated_at: z.string().optional()}); export const trackingLinkUrlDataVerificationStatus = z.enum(["UNKNOWN_VERIFICATION_STATUS", "UNVERIFIED", "VERIFYING", "VERIFIED"]); export const urlDataUnverifiedStatusData = z.object({stored_at: z.string().optional(), user_id: z.string().optional()}); export const urlDataVerifyingStatusData = z.object({attempt_ids: z.array(z.string()).optional()}); export const trackingLinkVerificationAttemptUrlDataType = z.enum(["UNKNOWN_URL_DATA_TYPE", "CT_LINK", "VT_LINK"]); export const dspTrackingLinkVerificationAttempt = z.object({id: z.string().optional(), ad_account_id: z.string().optional(), tracking_link_id: z.string().optional(), url_data_type: trackingLinkVerificationAttemptUrlDataType.optional(), user_id: z.string().optional(), user_email: z.string().optional(), user_name: z.string().optional(), tracking_bundle_id: z.string().optional(), resolved_url: z.string().optional(), resolved_idfa: z.string().optional(), started_at: z.string().optional(), verified_at: z.string().optional()}); export const urlDataVerifiedStatusData = z.object({verified_attempt: dspTrackingLinkVerificationAttempt.optional()}); export const trackingLinkUrlData = z.object({url: z.string(), status: trackingLinkUrlDataVerificationStatus.optional(), unverified_status_data: urlDataUnverifiedStatusData.optional(), verifying_status_data: urlDataVerifyingStatusData.optional(), verified_status_data: urlDataVerifiedStatusData.optional()}); export const adcloudcommonTrackingCompany = z.enum(["UNKNOWN_TRACKING_COMPANY", "KOCHAVA", "ADJUST", "MAT", "MOLOCO_PIXEL", "APPSFLYER", "ADBRIX", "WEB", "GENERIC", "TRACKFNT", "AIRBRIDGE", "MOLOCO_E2E", "APSALAR", "BRANCH", "TENJIN", "SINGULAR", "ADBRIX_V2", "TRAFFICGUARD", "GAMELOFT", "SKADNETWORK", "MYTRACKER", "MOLOCO_RMP", "MOLOCO_PIXEL_V2", "JUSTTRACK", "SHOPEE", "KOCHAVA_FOR_PUBLISHER", "GAMESIGHT", "CAULY", "HASOFFER", "ADACTION", "CURATE"]); export const dspTrackingLink = z.object({id: z.string().optional(), ad_account_id: z.string().optional(), product_id: z.string().optional(), title: z.string(), description: z.string().optional(), device_os: commonDeviceOs, click_through_link: trackingLinkUrlData, view_through_link: trackingLinkUrlData.optional(), ctv_adjust_dual_vt_link: trackingLinkUrlData.optional(), tracking_company: adcloudcommonTrackingCompany.optional(), created_at: z.string().optional(), updated_at: z.string().optional()}); export const messagesCreateCreativeGroupResponse = z.object({creative_group: dspCreativeGroup.optional(), creatives: z.array(dspCreative).optional(), tracking_link: dspTrackingLink.optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Create a new CreativeGroup. * * POST /cm/v1/creative-groups */ export const createApiCmV1CreativeGroups = async (args: CreateApiCmV1CreativeGroupsArgs, options?: CreateApiCmV1CreativeGroupsOptions) => { const {baseUrl = "https://api.moloco.cloud", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args.ad_account_id != null) query.append("ad_account_id", String(args.ad_account_id)) if (args.product_id != null) query.append("product_id", String(args.product_id)) if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/cm/v1/creative-groups${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(messagesCreateCreativeGroupResponse, await res.json()) };