• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file Provides the capability of integrating advertising services with vendors
18 * @kit AdsKit
19 */
20
21import type advertising from './@ohos.advertising';
22
23/**
24 * Provides the capability of integrating advertising services with vendors.
25 * @syscap SystemCapability.Advertising.Ads
26 * @systemapi
27 * @since 11
28 */
29export default class AdsServiceExtensionAbility {
30
31  /**
32   * Called when media application starts to load ad.
33   * @param { advertising.AdRequestParams } adParam - Indicates the parameters in the request.
34   * @param { advertising.AdOptions } adOptions - Indicates the ad options.
35   * @param { RespCallback } respCallback - The response callback.
36   * @syscap SystemCapability.Advertising.Ads
37   * @systemapi
38   * @since 11
39   */
40  onLoadAd(adParam: advertising.AdRequestParams, adOptions: advertising.AdOptions, respCallback: RespCallback);
41
42  /**
43   * Called when media application starts to load ad with multi-slots.
44   * @param { advertising.AdRequestParams[] } adParams - Indicates the parameters in the request.
45   * @param { advertising.AdOptions } adOptions - Indicates the ad options.
46   * @param { RespCallback } respCallback - The response callback.
47   * @syscap SystemCapability.Advertising.Ads
48   * @systemapi
49   * @since 11
50   */
51  onLoadAdWithMultiSlots(adParams: advertising.AdRequestParams[], adOptions: advertising.AdOptions, respCallback: RespCallback);
52}
53
54/**
55 * Defines the callback of loading ad.
56 * @typedef RespCallback
57 * @syscap SystemCapability.Advertising.Ads
58 * @since 11
59 */
60export interface RespCallback {
61  /**
62   * Defines the callback data.
63   * @param { Map<string, Array<advertising.Advertisement>> } respData
64   * @syscap SystemCapability.Advertising.Ads
65   * @since 11
66   */
67  (respData: Map<string, Array<advertising.Advertisement>>): void;
68}
69
70
71
72