import { CreateRewardedVideoAdOptions } from "./CreateRewardedVideoAdOptions"; import { RewardedVideoAd } from "./RewardedVideoAd"; import { CreateInterstitialAdOptions } from "./CreateInterstitialAdOptions"; import { InterstitialAd } from "./InterstitialAd"; export declare class AdAPI { /** * 创建激励视频广告实例。 * 开发者可以在小程序中使用激励视频广告获得收入,具体接入方式参考[流量主接入能力](https://open.kuaishou.com/docs/develop/functionAccessGuide/ad/adApplication.html)。如果想查看广告数据,请到[控制台](https://open.kuaishou.com/project/publisher/contract),进入指定小程序后,在 【广告中心】-> 【流量主】-> 【数据统计】中查看。 * @version {"kma":"1.26.1","ide":"1.22.0"} * @param options 创建激励视频广告的参数 * @returns 激励视频广告实例 * * @example * ```javascript * let rewardedVideoAd = null; * Page({ * onLoad() { * rewardedVideoAd = ks.createRewardedVideoAd({ * type: 13001, * unitId: 13001001, * }); * rewardedVideoAd.onLoad(() => { * // 激励视频广告已加载 * }); * rewardedVideoAd.onError(({ errCode }) => { * // 激励视频广告出错 * }); * rewardedVideoAd.onClose(({ isEnded }) => { * // 激励视频广告已关闭 * if (isEnded) { * // 用户完整观看了激励视频广告,给用户发放激励 * } * }); * }, * onUnload() { * rewardedVideoAd?.destroy(); * rewardedVideoAd = null; * }, * showRewardedVideoAd() { * rewardedVideoAd?.show().catch(() => { * // 激励视频广告展示出错,重新加载激励视频广告数据 * rewardedVideoAd * ?.load() * .then(() => rewardedVideoAd?.show()) * .catch((err) => { * // 激励视频广告展示失败 * }); * }); * }, * }); * * ``` * */ createRewardedVideoAd(options: CreateRewardedVideoAdOptions): RewardedVideoAd; /** * 创建插屏广告实例。 * 创建插屏广告组件。每次调用该方法创建插屏广告都会返回一个全新的实例(小程序端的插屏广告实例不允许跨页面使用)。 * @version {"kma":"1.96.0"} * @param options 插屏广告的参数 * @returns 插屏广告实例 * @example * ```javascript * let interstitialAd = null; * Page({ * onLoad() { * interstitialAd = ks.createInterstitialAd({ * type: 13001, * unitId: 13001001, * }); * interstitialAd.onLoad(() => { * // 插屏广告已加载 * }); * interstitialAd.onError(({ errCode }) => { * // 插屏广告出错 * }); * interstitialAd.onClose(() => { * // 插屏广告已关闭 * }); * }, * onUnload() { * interstitialAd?.destroy(); * interstitialAd = null; * }, * showRewardedVideoAd() { * interstitialAd?.show().catch(() => { * // 插屏广告展示出错,重新加载插屏广告数据 * interstitialAd * ?.load() * .then(() => interstitialAd?.show()) * .catch((err) => { * // 插屏广告展示失败 * }); * }); * }, * }); * * ``` * */ createInterstitialAd(options: CreateInterstitialAdOptions): InterstitialAd; }