mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-10-07 22:24:20 +00:00
Description: 广告API打标元服务
Feature or Bugfix: feature Binary Source: NO Signed-off-by: xiangjiang <xiangjiang@huawei.com>
This commit is contained in:
parent
9969acad7c
commit
e8e38b4f07
@ -23,6 +23,7 @@ import advertising from './@ohos.advertising';
|
||||
/**
|
||||
* Defines the ad component.
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
@Component
|
||||
@ -31,6 +32,7 @@ declare struct AdComponent {
|
||||
* The ads to display.
|
||||
* @type { Advertisement[] }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
ads: advertising.Advertisement[];
|
||||
@ -39,6 +41,7 @@ declare struct AdComponent {
|
||||
* The interaction options info for displaying ads.
|
||||
* @type { AdDisplayOptions }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
displayOptions: advertising.AdDisplayOptions;
|
||||
@ -47,6 +50,7 @@ declare struct AdComponent {
|
||||
* The interaction listener to be registered that use to show ads.
|
||||
* @type { AdInteractionListener }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
interactionListener: advertising.AdInteractionListener;
|
||||
@ -54,6 +58,7 @@ declare struct AdComponent {
|
||||
/**
|
||||
* The method to build ad component.
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
build(): void;
|
||||
|
@ -23,6 +23,7 @@ import advertising from './@ohos.advertising';
|
||||
/**
|
||||
* Defines the auto ad component.
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
@Component
|
||||
@ -31,6 +32,7 @@ declare struct AutoAdComponent {
|
||||
* The parameters in the request for loading ads.
|
||||
* @type { AdRequestParams }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
adParam: advertising.AdRequestParams;
|
||||
@ -39,6 +41,7 @@ declare struct AutoAdComponent {
|
||||
* The ad options of loading ads.
|
||||
* @type { AdOptions }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
adOptions: advertising.AdOptions;
|
||||
@ -47,6 +50,7 @@ declare struct AutoAdComponent {
|
||||
* The interaction options info for displaying ads.
|
||||
* @type { AdDisplayOptions }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
displayOptions: advertising.AdDisplayOptions;
|
||||
@ -55,6 +59,7 @@ declare struct AutoAdComponent {
|
||||
* The interaction listener to be registered that use to show ads.
|
||||
* @type { AdInteractionListener }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
interactionListener: advertising.AdInteractionListener;
|
||||
@ -62,6 +67,7 @@ declare struct AutoAdComponent {
|
||||
/**
|
||||
* The method to build auto ad component.
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
build(): void;
|
||||
|
35
api/@ohos.advertising.d.ts
vendored
35
api/@ohos.advertising.d.ts
vendored
@ -25,12 +25,14 @@ import type { Advertisement as _Advertisement } from './advertising/advertisemen
|
||||
* Provides the capability to load and display advertisements.
|
||||
* @namespace advertising
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
declare namespace advertising {
|
||||
/**
|
||||
* Indicates the advertisement data model.
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
export type Advertisement = _Advertisement;
|
||||
@ -39,6 +41,7 @@ declare namespace advertising {
|
||||
* The parameters in the request for loading one or more advertisements.
|
||||
* @typedef AdRequestParams
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
export interface AdRequestParams {
|
||||
@ -46,6 +49,7 @@ declare namespace advertising {
|
||||
* The advertisement slot id.
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
adId: string;
|
||||
@ -54,6 +58,7 @@ declare namespace advertising {
|
||||
* The advertisement type of request.
|
||||
* @type { ?number }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
adType?: number;
|
||||
@ -62,6 +67,7 @@ declare namespace advertising {
|
||||
* The advertisement quantity of request.
|
||||
* @type { ?number }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
adCount?: number;
|
||||
@ -70,6 +76,7 @@ declare namespace advertising {
|
||||
* The advertisement view size width that expects.
|
||||
* @type { ?number }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
adWidth?: number;
|
||||
@ -78,6 +85,7 @@ declare namespace advertising {
|
||||
* The advertisement view size height that expects.
|
||||
* @type { ?number }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
adHeight?: number;
|
||||
@ -86,6 +94,7 @@ declare namespace advertising {
|
||||
* The advertisement search keyword.
|
||||
* @type { ?string }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
adSearchKeyword?: string;
|
||||
@ -94,6 +103,7 @@ declare namespace advertising {
|
||||
* The extended attributes for request parameters.
|
||||
* @type { number | boolean | string | undefined }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
[key: string]: number | boolean | string | undefined;
|
||||
@ -103,6 +113,7 @@ declare namespace advertising {
|
||||
* The ad options of loading ads.
|
||||
* @typedef AdOptions
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
export interface AdOptions {
|
||||
@ -110,6 +121,7 @@ declare namespace advertising {
|
||||
* The tags for children's content.
|
||||
* @type { ?number }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
tagForChildProtection?: number;
|
||||
@ -118,6 +130,7 @@ declare namespace advertising {
|
||||
* Advertisement content classification setting.
|
||||
* @type { ?string }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
adContentClassification?: string;
|
||||
@ -126,6 +139,7 @@ declare namespace advertising {
|
||||
* Non-personalized ad settings.
|
||||
* @type { ?number }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
nonPersonalizedAd?: number;
|
||||
@ -134,6 +148,7 @@ declare namespace advertising {
|
||||
* The extended attributes for ad options.
|
||||
* @type { number | boolean | string | undefined }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
[key: string]: number | boolean | string | undefined;
|
||||
@ -143,6 +158,7 @@ declare namespace advertising {
|
||||
* The interaction options info for displaying ad.
|
||||
* @typedef AdDisplayOptions
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
export interface AdDisplayOptions {
|
||||
@ -150,6 +166,7 @@ declare namespace advertising {
|
||||
* Ad custom data.
|
||||
* @type { ?string }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
customData?: string;
|
||||
@ -158,6 +175,7 @@ declare namespace advertising {
|
||||
* User id.
|
||||
* @type { ?string }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
userId?: string;
|
||||
@ -167,6 +185,7 @@ declare namespace advertising {
|
||||
* and application download in non-Wi-Fi scenarios.
|
||||
* @type { ?boolean }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
useMobileDataReminder?: boolean;
|
||||
@ -175,6 +194,7 @@ declare namespace advertising {
|
||||
* Indicates whether to mute the playback of the ad video.
|
||||
* @type { ?boolean }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
mute?: boolean;
|
||||
@ -183,6 +203,7 @@ declare namespace advertising {
|
||||
* The type of the scenario where the audio focus is obtained during video playback.
|
||||
* @type { ?number }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
audioFocusType?: number;
|
||||
@ -191,6 +212,7 @@ declare namespace advertising {
|
||||
* The extended attributes for interaction options.
|
||||
* @type { number | boolean | string | undefined }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
[key: string]: number | boolean | string | undefined;
|
||||
@ -200,6 +222,7 @@ declare namespace advertising {
|
||||
* The listener of ad interaction.
|
||||
* @interface AdInteractionListener
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
export interface AdInteractionListener {
|
||||
@ -209,6 +232,7 @@ declare namespace advertising {
|
||||
* @param { Advertisement } ad - The ad which status is changed.
|
||||
* @param { string } data - The data of current ad status.
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
onStatusChanged(status: string, ad: Advertisement, data: string);
|
||||
@ -218,6 +242,7 @@ declare namespace advertising {
|
||||
* The listener of loading ad.
|
||||
* @interface AdLoadListener
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
export interface AdLoadListener {
|
||||
@ -226,6 +251,7 @@ declare namespace advertising {
|
||||
* @param { number } errorCode - code of ad loading failure.
|
||||
* @param { string } errorMsg - error message.
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
onAdLoadFailure(errorCode: number, errorMsg: string): void;
|
||||
@ -234,6 +260,7 @@ declare namespace advertising {
|
||||
* Called by system when the ad load has been succeeded.
|
||||
* @param { Array<Advertisement> } ads - advertisements are loaded successfully.
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
onAdLoadSuccess(ads: Array<Advertisement>): void;
|
||||
@ -243,6 +270,7 @@ declare namespace advertising {
|
||||
* The listener of loading multi-slots ad.
|
||||
* @interface MultiSlotsAdLoadListener
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
export interface MultiSlotsAdLoadListener {
|
||||
@ -251,6 +279,7 @@ declare namespace advertising {
|
||||
* @param { number } errorCode - code of ad loading failure.
|
||||
* @param { string } errorMsg - error message.
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
onAdLoadFailure(errorCode: number, errorMsg: string): void;
|
||||
@ -259,6 +288,7 @@ declare namespace advertising {
|
||||
* Called by system when the ad load has been succeeded.
|
||||
* @param { Map<string, Array<Advertisement>> } adsMap - advertisements are loaded successfully.
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
onAdLoadSuccess(adsMap: Map<string, Array<Advertisement>>): void;
|
||||
@ -273,6 +303,7 @@ declare namespace advertising {
|
||||
* @throws { BusinessError } 21800001 - System internal error.
|
||||
* @throws { BusinessError } 21800004 - Failed to display the ad.
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
function showAd(ad: Advertisement, options: AdDisplayOptions, context?: common.UIAbilityContext): void;
|
||||
@ -280,6 +311,7 @@ declare namespace advertising {
|
||||
/**
|
||||
* Provides the functions of loading ads.
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
export class AdLoader {
|
||||
@ -287,6 +319,7 @@ declare namespace advertising {
|
||||
* Constructs a adLoader object, context should be transferred.
|
||||
* @param { common.Context } context - Indicates the context of the media application.
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
constructor(context: common.Context);
|
||||
@ -300,6 +333,7 @@ declare namespace advertising {
|
||||
* @throws { BusinessError } 21800001 - System internal error.
|
||||
* @throws { BusinessError } 21800003 - Failed to load the ad request.
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
loadAd(adParam: AdRequestParams, adOptions: AdOptions, listener: AdLoadListener): void;
|
||||
@ -313,6 +347,7 @@ declare namespace advertising {
|
||||
* @throws { BusinessError } 21800001 - System internal error.
|
||||
* @throws { BusinessError } 21800003 - Failed to load the ad request.
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
loadAdWithMultiSlots(adParams: AdRequestParams[], adOptions: AdOptions, listener: MultiSlotsAdLoadListener): void;
|
||||
|
8
api/advertising/advertisement.d.ts
vendored
8
api/advertising/advertisement.d.ts
vendored
@ -17,6 +17,7 @@
|
||||
* Defines the advertisement data model.
|
||||
* @typedef Advertisement
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
export interface Advertisement {
|
||||
@ -24,6 +25,7 @@ export interface Advertisement {
|
||||
* The advertisement type.
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
adType: number;
|
||||
@ -32,6 +34,7 @@ export interface Advertisement {
|
||||
* The server verifies the configuration parameters.
|
||||
* @type { Map<string, string> }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
rewardVerifyConfig: Map<string, string>;
|
||||
@ -40,6 +43,7 @@ export interface Advertisement {
|
||||
* The unique identifier of the advertisement.
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
uniqueId: string;
|
||||
@ -48,6 +52,7 @@ export interface Advertisement {
|
||||
* The subscriber has been rewarded.
|
||||
* @type { boolean }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
rewarded: boolean;
|
||||
@ -56,6 +61,7 @@ export interface Advertisement {
|
||||
* The advertisement has been shown.
|
||||
* @type { boolean }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
shown: boolean;
|
||||
@ -64,6 +70,7 @@ export interface Advertisement {
|
||||
* The advertisement has been clicked.
|
||||
* @type { boolean }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
clicked: boolean;
|
||||
@ -72,6 +79,7 @@ export interface Advertisement {
|
||||
* The extended attributes of advertisement.
|
||||
* @type { Object }
|
||||
* @syscap SystemCapability.Advertising.Ads
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
[key:string]: Object;
|
||||
|
Loading…
Reference in New Issue
Block a user