mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 21:10:23 +00:00
Merge pull request #24714 from joelhegg/master
[actions-on-google] Upgrade to 1.10
This commit is contained in:
+332
-5
@@ -1,6 +1,7 @@
|
||||
import * as express from 'express';
|
||||
|
||||
import { BasicCard, Carousel, ImageDisplays, List, OptionItem, RichResponse } from './response-builder';
|
||||
import { BasicCard, BrowseCarousel, BrowseItem, Carousel, ImageDisplays, List, MediaObject,
|
||||
MediaResponse, MediaValues, OptionItem, RichResponse, SimpleResponse } from './response-builder';
|
||||
import { ActionPaymentTransactionConfig, Cart, GooglePaymentTransactionConfig, LineItem,
|
||||
Location, Order, OrderUpdate, TransactionDecision, TransactionValues } from './transactions';
|
||||
|
||||
@@ -30,6 +31,8 @@ export enum StandardIntents {
|
||||
DELIVERY_ADDRESS,
|
||||
/** App fires TRANSACTION_DECISION intent when action asks for transaction decision. */
|
||||
TRANSACTION_DECISION,
|
||||
/** App fires PLACE intent when action asks for place. */
|
||||
PLACE,
|
||||
/** App fires CONFIRMATION intent when requesting affirmation from user. */
|
||||
CONFIRMATION,
|
||||
/** App fires DATETIME intent when requesting date/time from user. */
|
||||
@@ -45,7 +48,11 @@ export enum StandardIntents {
|
||||
/** App fires REGISTER_UPDATE intent when requesting user to register for proactive updates. */
|
||||
REGISTER_UPDATE,
|
||||
/** App receives CONFIGURE_UPDATES intent to indicate a REGISTER_UPDATE intent should be sent. */
|
||||
CONFIGURE_UPDATES
|
||||
CONFIGURE_UPDATES,
|
||||
/** App fires LINK intent to request user to open to link. */
|
||||
LINK,
|
||||
/** App receives MEDIA_STATUS intent when the MediaResponse status is updated from user. */
|
||||
MEDIA_STATUS
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,6 +108,10 @@ export enum BuiltInArgNames {
|
||||
* Transactions decision argument.
|
||||
*/
|
||||
TRANSACTION_DECISION_VALUE,
|
||||
/**
|
||||
* Place value argument.
|
||||
*/
|
||||
PLACE,
|
||||
/**
|
||||
* Confirmation argument.
|
||||
*/
|
||||
@@ -126,7 +137,11 @@ export enum BuiltInArgNames {
|
||||
*/
|
||||
NEW_SURFACE,
|
||||
/** Update registration value argument. */
|
||||
REGISTER_UPDATE
|
||||
REGISTER_UPDATE,
|
||||
/** Link request result argument. */
|
||||
LINK,
|
||||
/** MediaStatus value argument. */
|
||||
MEDIA_STATUS
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,6 +188,14 @@ export enum SurfaceCapabilities {
|
||||
* The ability to output on a screen
|
||||
*/
|
||||
SCREEN_OUTPUT,
|
||||
/**
|
||||
* The ability to output a MediaResponse
|
||||
*/
|
||||
MEDIA_RESPONSE_AUDIO,
|
||||
/**
|
||||
* The ability to open a web URL
|
||||
*/
|
||||
WEB_BROWSER
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,6 +246,18 @@ export enum SignInStatus {
|
||||
ERROR
|
||||
}
|
||||
|
||||
/**
|
||||
* SKU (Stock Keeping Units) types for Play Package Entitlements.
|
||||
*/
|
||||
export enum EntitlementSkuTypes {
|
||||
/** In app purchase */
|
||||
IN_APP,
|
||||
/** In app subscription */
|
||||
SUBSCRIPTION,
|
||||
/** Paid app. */
|
||||
APP
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible update trigger time context frequencies.
|
||||
*/
|
||||
@@ -259,10 +294,15 @@ export interface UserName {
|
||||
familyName: string;
|
||||
}
|
||||
|
||||
export interface LocationCoordinates {
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* User's permissioned device location.
|
||||
* Location information.
|
||||
*/
|
||||
export interface DeviceLocation {
|
||||
export interface Location {
|
||||
/** Coordinates: {latitude, longitude}. Requested with SupportedPermissions.DEVICE_PRECISE_LOCATION. */
|
||||
coordinates: Coordinates;
|
||||
/** Full, formatted street address. Requested with SupportedPermissions.DEVICE_PRECISE_LOCATION. */
|
||||
@@ -273,6 +313,22 @@ export interface DeviceLocation {
|
||||
city: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* User's permissioned device location.
|
||||
*/
|
||||
export type DeviceLocation = Location;
|
||||
|
||||
/**
|
||||
* Place information.
|
||||
*/
|
||||
export interface Place extends Location {
|
||||
/**
|
||||
* Used with Places API to fetch details of a place.
|
||||
* See {@link https://developers.google.com/places/web-service/place-id}
|
||||
*/
|
||||
placeId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Coordinates containing latitude and longitude
|
||||
*/
|
||||
@@ -309,6 +365,33 @@ export interface User {
|
||||
userStorage: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Google Play Android App Package Entitlements.
|
||||
*/
|
||||
export interface PackageEntitlement {
|
||||
/** Name of the Android app package. */
|
||||
packageName: string;
|
||||
/** List of entitlements for a given app. */
|
||||
entitlements: Entitlement[];
|
||||
}
|
||||
|
||||
/**
|
||||
* A user's digital entitlement.
|
||||
*/
|
||||
export interface Entitlement {
|
||||
/** Product SKU. Matches getSku() in Google Play InApp Billing API. */
|
||||
sku: string;
|
||||
/** The type of SKU. One of EntitlementSkuType. */
|
||||
skuType: string;
|
||||
/** For in app purchases/subscriptions, relevant details. */
|
||||
inAppDetails: {
|
||||
/** JSON data of the in app purchase. */
|
||||
inAppPurchaseData: object;
|
||||
/** Matches IN_APP_DATA_SIGNATURE from getPurchases() method in Play InApp Billing API. */
|
||||
inAppDataSignature: object;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Actions on Google Surface.
|
||||
*/
|
||||
@@ -437,6 +520,16 @@ export class AssistantApp {
|
||||
*/
|
||||
readonly Transactions: typeof TransactionValues;
|
||||
|
||||
/**
|
||||
* Values related to supporting {@link Media}.
|
||||
*/
|
||||
readonly Media: typeof MediaValues;
|
||||
|
||||
/**
|
||||
* SKU (Stock Keeping Units) types for Play Package Entitlements.
|
||||
*/
|
||||
readonly EntitlementSkuTypes: typeof EntitlementSkuTypes;
|
||||
|
||||
/**
|
||||
* Possible update trigger time context frequencies.
|
||||
*/
|
||||
@@ -923,6 +1016,80 @@ export class AssistantApp {
|
||||
*/
|
||||
askForDeliveryAddress(reason: string, dialogState?: object): express.Response | null;
|
||||
|
||||
/**
|
||||
* Asks user to provide a geo-located place, possibly using contextual information,
|
||||
* like a store near the user's location or a contact's address.
|
||||
*
|
||||
* Developer provides custom text prompts to tailor the request handled by Google.
|
||||
*
|
||||
* @example
|
||||
* // For DialogflowApp:
|
||||
*
|
||||
* // Dialogflow Actions
|
||||
* const Actions = {
|
||||
* WELCOME: 'input.welcome',
|
||||
* PLACE: 'get.place' // Create Dialogflow Action with actions_intent_PLACE event
|
||||
* };
|
||||
*
|
||||
* const app = new DialogflowApp({request, response});
|
||||
*
|
||||
* function handleWelcome (app) {
|
||||
* const requestPrompt = 'Where do you want to get picked up?';
|
||||
* const permissionContext = 'To find a place to pick you up';
|
||||
* app.askForPlace(requestPrompt, permissionContext);
|
||||
* }
|
||||
*
|
||||
* function handlePlace (app) {
|
||||
* const place = app.getPlace();
|
||||
* if (place) {
|
||||
* app.tell(`Ah, I see. You want to get picked up at ${place.address}`);
|
||||
* } else {
|
||||
* app.tell(`Sorry, I couldn't find where you want to get picked up`);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set(Actions.WELCOME, handleWelcome);
|
||||
* actionMap.set(Actions.PLACE, handlePlace);
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* // For ActionsSdkApp:
|
||||
* const app = new ActionsSdkApp({ request, response });
|
||||
*
|
||||
* function handleWelcome (app) {
|
||||
* const requestPrompt = 'Where do you want to get picked up?';
|
||||
* const permissionContext = 'To find a place to pick you up';
|
||||
* app.askForPlace(requestPrompt, permissionContext);
|
||||
* }
|
||||
*
|
||||
* function handlePlace (app) {
|
||||
* const place = app.getPlace();
|
||||
* if (place) {
|
||||
* app.tell(`Ah, I see. You want to get picked up at ${place.address}`);
|
||||
* } else {
|
||||
* app.tell(`Sorry, I couldn't find where you want to get picked up`);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* const actionsMap = new Map();
|
||||
* actionsMap.set(app.StandardIntents.MAIN, handleWelcome);
|
||||
* actionsMap.set(app.StandardIntents.PLACE, handlePlace);
|
||||
* app.handleRequest(actionsMap);
|
||||
*
|
||||
* @param requestPrompt This is the initial response by location sub-dialog.
|
||||
* For example: "Where do you want to get picked up?"
|
||||
* @param permissionContext This is the context for seeking permissions.
|
||||
* For example: "To find a place to pick you up"
|
||||
* Prompt to user: "*To find a place to pick you up*, I just need to check your location.
|
||||
* Can I get that from Google?".
|
||||
* @param dialogState JSON object the app uses to hold dialog state that
|
||||
* will be circulated back by Assistant.
|
||||
* @return HTTP response.
|
||||
* @actionssdk
|
||||
* @dialogflow
|
||||
*/
|
||||
askForPlace(requestPrompt: string, permissionContext: string, dialogState?: object): express.Response | null;
|
||||
|
||||
/**
|
||||
* Asks user for a confirmation.
|
||||
*
|
||||
@@ -1131,6 +1298,72 @@ export class AssistantApp {
|
||||
*/
|
||||
askToRegisterDailyUpdate(intent: string, intentArguments: IntentArgument[], dialogState?: object): express.Response | null;
|
||||
|
||||
/**
|
||||
* Requests the user to transfer to a linked out Android app intent. Using this feature
|
||||
* requires verifying the linked app in the (Actions console)[console.actions.google.com].
|
||||
*
|
||||
* @example
|
||||
* // For DialogflowApp:
|
||||
*
|
||||
* // Dialogflow Actions
|
||||
* const WELCOME_ACTION = 'input.welcome';
|
||||
* const HANDLE_LINK = 'handle.link'; // Create Dialogflow Action with actions_intent_LINK event
|
||||
*
|
||||
* const app = new DialogflowApp({ request, response });
|
||||
*
|
||||
* console.log('Request headers: ' + JSON.stringify(request.headers));
|
||||
* console.log('Request body: ' + JSON.stringify(request.body));
|
||||
*
|
||||
* function requestLink (app) {
|
||||
* app.askToDeepLink('Great! Looks like we can do that in the app.', 'Google',
|
||||
* 'example://gizmos', 'com.example.gizmos', 'handle this for you');
|
||||
* }
|
||||
*
|
||||
* function handleLink (app) {
|
||||
* const linkStatus = app.getLinkStatus();
|
||||
* app.tell('Okay maybe we can take care of that another time.');
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set(WELCOME_ACTION, requestLink);
|
||||
* actionMap.set(HANDLE_LINK, handleLink);
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* // For ActionsSdkApp
|
||||
* const app = new ActionsSdkApp({ request, response });
|
||||
*
|
||||
* console.log('Request headers: ' + JSON.stringify(request.headers));
|
||||
* console.log('Request body: ' + JSON.stringify(request.body));
|
||||
*
|
||||
* function requestLink (app) {
|
||||
* app.askToDeepLink('Great! Looks like we can do that in the app.', 'Google',
|
||||
* 'example://gizmos', 'com.example.gizmos', 'handle this for you.');
|
||||
* }
|
||||
*
|
||||
* function handleLink (app) {
|
||||
* const linkStatus = app.getLinkStatus();
|
||||
* app.tell('Okay maybe we can take care of that another time.');
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set(app.StandardIntents.MAIN, requestLink);
|
||||
* actionMap.set(app.StandardIntents.LINK, handleLink);
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @param prompt A simple response to prepend to the link request.
|
||||
* @param destinationName The name of the link destination.
|
||||
* @param url URL of Android deep link.
|
||||
* @param packageName Android app package name to which to link.
|
||||
* @param reason The reason to transfer the user. This may be appended to a
|
||||
* Google-specified prompt.
|
||||
* @param dialogState JSON object the app uses to hold dialog state that
|
||||
* will be circulated back by Assistant. Used in {@link ActionsSdkApp}.
|
||||
* @return HTTP response.
|
||||
* @dialogflow
|
||||
* @actionssdk
|
||||
*/
|
||||
askToDeepLink(prompt: string | SimpleResponse | null, destinationName: string, url: string, packageName: string, reason?: string | null, dialogState?: object): express.Response | null;
|
||||
|
||||
/**
|
||||
* Gets the {@link User} object.
|
||||
* The user object contains information about the user, including
|
||||
@@ -1209,6 +1442,20 @@ export class AssistantApp {
|
||||
*/
|
||||
getLastSeen(): Date | null;
|
||||
|
||||
/**
|
||||
* Get the the list of all digital goods that your user purchased from
|
||||
* your published Android apps. To enable this feature, see the instructions
|
||||
* in the (documentation)[https://developers.google.com/actions/identity/digital-goods].
|
||||
*
|
||||
* @example
|
||||
* const app = new DialogflowApp({request, response});
|
||||
* const packageEntitlements = app.getPackageEntitlements();
|
||||
*
|
||||
* @return The list of digital goods purchased by the user in
|
||||
* any verified Android app package. Null if no Package Entitlements present in the request.
|
||||
*/
|
||||
getPackageEntitlements(): PackageEntitlement[] | null;
|
||||
|
||||
/**
|
||||
* If granted permission to device's location in previous intent, returns device's
|
||||
* location (see {@link AssistantApp#askForPermissions|askForPermissions}).
|
||||
@@ -1273,6 +1520,15 @@ export class AssistantApp {
|
||||
*/
|
||||
getTransactionDecision(): TransactionDecision;
|
||||
|
||||
/**
|
||||
* Gets the user provided place. Use after askForPlace.
|
||||
*
|
||||
* @return Place information given by the user. Null if no place given.
|
||||
* @dialogflow
|
||||
* @actionssdk
|
||||
*/
|
||||
getPlace(): Place | null;
|
||||
|
||||
/**
|
||||
* Gets confirmation decision. Use after askForConfirmation.
|
||||
*
|
||||
@@ -1304,6 +1560,31 @@ export class AssistantApp {
|
||||
*/
|
||||
getSignInStatus(): string;
|
||||
|
||||
/**
|
||||
* Get status of MEDIA_STATUS intent.
|
||||
*
|
||||
* @example
|
||||
* const app = new DialogflowApp({request: request, response: response});
|
||||
*
|
||||
* function mediaStatusIntent (app) {
|
||||
* const status = app.getMediaStatus();
|
||||
* if (status === app.Media.Status.FINISHED) {
|
||||
* app.tell('Oh, I see you are done playing the media!');
|
||||
* } else {
|
||||
* app.tell(`I don't understand the current media status: ${status}`);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* const actionMap = new Map();
|
||||
* actionMap.set(app.StandardIntents.MEDIA_STATUS, mediaStatusIntent);
|
||||
* app.handleRequest(actionMap);
|
||||
*
|
||||
* @return Result of media status intent.
|
||||
* @dialogflow
|
||||
* @actionssdk
|
||||
*/
|
||||
getMediaStatus(): MediaValues.Status | null;
|
||||
|
||||
/**
|
||||
* Returns true if user device has a given surface capability.
|
||||
*
|
||||
@@ -1464,6 +1745,16 @@ export class AssistantApp {
|
||||
*/
|
||||
isUpdateRegistered(): boolean;
|
||||
|
||||
/**
|
||||
* Returns the status of a link request. Used with
|
||||
* {@link AssistantApp#askToDeepLink}
|
||||
*
|
||||
* @return The status code of the request to link.
|
||||
* @dialogflow
|
||||
* @actionssdk
|
||||
*/
|
||||
getLinkStatus(): number;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Response Builders
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -1500,6 +1791,13 @@ export class AssistantApp {
|
||||
*/
|
||||
buildCarousel(): Carousel;
|
||||
|
||||
/**
|
||||
* Constructs a Browse Carousel with chainable property setters.
|
||||
*
|
||||
* @return Constructed Browse Carousel.
|
||||
*/
|
||||
buildBrowseCarousel(): BrowseCarousel;
|
||||
|
||||
/**
|
||||
* Constructs OptionItem with chainable property setters.
|
||||
*
|
||||
@@ -1512,6 +1810,15 @@ export class AssistantApp {
|
||||
*/
|
||||
buildOptionItem(key?: string, synonyms?: string | string[]): OptionItem;
|
||||
|
||||
/**
|
||||
* Constructs BrowseItem for the Browse Carousel with chainable property setters.
|
||||
*
|
||||
* @param title The displayed title of the Browse Carousel card.
|
||||
* @param url The URL linked to by clicking the card.
|
||||
* @return Constructed BrowseItem.
|
||||
*/
|
||||
buildBrowseItem(title?: string, url?: string): BrowseItem;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Transaction Builders
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -1552,4 +1859,24 @@ export class AssistantApp {
|
||||
* @return Constructed OrderUpdate.
|
||||
*/
|
||||
buildOrderUpdate(orderId: string, isGoogleOrderId: boolean): OrderUpdate;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Media Builders
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs Media Response with chainable property setters.
|
||||
*
|
||||
* @return Constructed Media Response.
|
||||
*/
|
||||
buildMediaResponse(): MediaResponse;
|
||||
|
||||
/**
|
||||
* Constructs MediaObject with chainable property setters.
|
||||
*
|
||||
* @param name Name of media file.
|
||||
* @param contentUrl Location of media file.
|
||||
* @return Constructed MediaObject.
|
||||
*/
|
||||
buildMediaObject(name: string, contentUrl: string): MediaObject;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for actions-on-google 1.8
|
||||
// Type definitions for actions-on-google 1.10
|
||||
// Project: https://github.com/actions-on-google/actions-on-google-nodejs
|
||||
// Definitions by: Joel Hegg <https://github.com/joelhegg>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
+298
@@ -27,6 +27,53 @@ export enum ImageDisplays {
|
||||
CROPPED
|
||||
}
|
||||
|
||||
/**
|
||||
* Values related to supporting media.
|
||||
*/
|
||||
export namespace MediaValues {
|
||||
/**
|
||||
* Type of the media within a MediaResponse.
|
||||
*/
|
||||
enum Type {
|
||||
/**
|
||||
* Unspecified.
|
||||
*/
|
||||
MEDIA_TYPE_UNSPECIFIED,
|
||||
/**
|
||||
* Audio stream.
|
||||
*/
|
||||
AUDIO
|
||||
}
|
||||
|
||||
/**
|
||||
* List of media control status' returned.
|
||||
*/
|
||||
enum Status {
|
||||
/**
|
||||
* Unspecified.
|
||||
*/
|
||||
UNSPECIFIED,
|
||||
/**
|
||||
* Finished.
|
||||
*/
|
||||
FINISHED
|
||||
}
|
||||
|
||||
/**
|
||||
* List of possible item types.
|
||||
*/
|
||||
enum ImageType {
|
||||
/**
|
||||
* Icon.
|
||||
*/
|
||||
ICON,
|
||||
/**
|
||||
* Large image.
|
||||
*/
|
||||
LARGE
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple Response type.
|
||||
*/
|
||||
@@ -155,6 +202,22 @@ export class RichResponse {
|
||||
*/
|
||||
addBasicCard(basicCard: BasicCard): RichResponse;
|
||||
|
||||
/**
|
||||
* Adds media to this response.
|
||||
*
|
||||
* @param mediaResponse MediaResponse to include in response.
|
||||
* @return Returns current constructed RichResponse.
|
||||
*/
|
||||
addMediaResponse(mediaResponse: MediaResponse): RichResponse;
|
||||
|
||||
/**
|
||||
* Adds a Browse Carousel to list of items.
|
||||
*
|
||||
* @param browseCarousel Browse Carousel to present to user
|
||||
* @return Returns current constructed RichResponse.
|
||||
*/
|
||||
addBrowseCarousel(browseCarousel: string | BrowseCarousel): RichResponse;
|
||||
|
||||
/**
|
||||
* Adds a single suggestion or list of suggestions to list of items.
|
||||
*
|
||||
@@ -325,6 +388,43 @@ export class List {
|
||||
addItems(optionItems: OptionItem | OptionItem[]): List;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for initializing and constructing BrowseCarousel with chainable interface.
|
||||
*/
|
||||
export class BrowseCarousel {
|
||||
/**
|
||||
* Constructor for BrowseCarousel. Accepts optional BrowseCarousel to
|
||||
* clone or list of items to copy.
|
||||
*
|
||||
* @param carousel Either a carousel to clone
|
||||
* or an array of BrowseItem to initialize a new carousel
|
||||
*/
|
||||
constructor(carousel?: BrowseCarousel | BrowseItem[]);
|
||||
|
||||
/**
|
||||
* List of 2-20 items to show in this carousel. Required.
|
||||
*/
|
||||
items: BrowseItem[];
|
||||
|
||||
/**
|
||||
* Adds a single item or list of items to the carousel.
|
||||
*
|
||||
* @param browseItems BrowseItems to add.
|
||||
* @return Returns current constructed BrowseCarousel.
|
||||
*/
|
||||
addItems(browseItems: BrowseItem | BrowseItem[]): BrowseCarousel;
|
||||
|
||||
/**
|
||||
* Sets the display options for the images in this carousel.
|
||||
* Use one of the image display constants. If none is chosen,
|
||||
* ImageDisplays.DEFAULT will be enforced.
|
||||
*
|
||||
* @param option The option for displaying the image.
|
||||
* @return Returns current constructed BrowseCarousel.
|
||||
*/
|
||||
setImageDisplay(option: ImageDisplays): BrowseCarousel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for initializing and constructing Carousel with chainable interface.
|
||||
*/
|
||||
@@ -350,6 +450,120 @@ export class Carousel {
|
||||
* @return Returns current constructed Carousel.
|
||||
*/
|
||||
addItems(optionItems: OptionItem | OptionItem[]): Carousel;
|
||||
|
||||
/**
|
||||
* Sets the display options for the images in this carousel.
|
||||
* Use one of the image display constants. If none is chosen,
|
||||
* ImageDisplays.DEFAULT will be enforced.
|
||||
*
|
||||
* @param option The option for displaying the image.
|
||||
* @return Returns current constructed Carousel.
|
||||
*/
|
||||
setImageDisplay(option: ImageDisplays): Carousel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for initializing and constructing Option Items with chainable interface.
|
||||
*/
|
||||
export class BrowseItem {
|
||||
/**
|
||||
* Constructor for BrowseItem. Accepts a title and URL for the Browse Item
|
||||
* card.
|
||||
*
|
||||
* @param title The title of the Browse Item card.
|
||||
* @param url The URL of the link opened by clicking the Browse Item card.
|
||||
*/
|
||||
constructor(title?: string, url?: string);
|
||||
|
||||
/**
|
||||
* Title of the browse item. Required.
|
||||
*/
|
||||
title: string;
|
||||
|
||||
/**
|
||||
* Description text of the item. Optional.
|
||||
*/
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
* Footer text of the item. Optional.
|
||||
*/
|
||||
footer?: string;
|
||||
|
||||
/**
|
||||
* Image to show on item. Optional.
|
||||
*/
|
||||
image?: Image;
|
||||
|
||||
/**
|
||||
* Url to that clicking the card opens. Optional.
|
||||
*/
|
||||
openUrlAction?: object;
|
||||
|
||||
/**
|
||||
* @return Returns the possible valid values for URL type hints
|
||||
*/
|
||||
urlTypeHints(): object;
|
||||
|
||||
/**
|
||||
* Sets the title for this Browse Item.
|
||||
*
|
||||
* @param title Title to show on item.
|
||||
* @return Returns current constructed BrowseItem.
|
||||
*/
|
||||
setTitle(title: string): BrowseItem;
|
||||
|
||||
/**
|
||||
* Sets the description for this Browse Item.
|
||||
*
|
||||
* @param description Description to show on item.
|
||||
* @return Returns current constructed BrowseItem.
|
||||
*/
|
||||
setDescription(description: string): BrowseItem;
|
||||
|
||||
/**
|
||||
* Sets the footer for this Browse Item.
|
||||
*
|
||||
* @param footerText text to show on item.
|
||||
* @return Returns current constructed BrowseItem.
|
||||
*/
|
||||
setFooter(footerText: string): BrowseItem;
|
||||
|
||||
/**
|
||||
* Sets the image for this Browse Item.
|
||||
*
|
||||
* @param url Image source URL.
|
||||
* @param accessibilityText Text to replace for image for accessibility.
|
||||
* @param width Width of the image.
|
||||
* @param height Height of the image.
|
||||
* @return Returns current constructed BrowseItem.
|
||||
*/
|
||||
setImage(url: string, accessibilityText: string, width?: number, height?: number): BrowseItem;
|
||||
|
||||
/**
|
||||
* Sets the Open URL action - which includes the url and possibly the typeHint
|
||||
*
|
||||
* @param url Image source URL.
|
||||
* @param urlTypeHint One of the typeHints enumerated by this.urlTypeHints()
|
||||
* @return Returns the current constructed BrowseItem
|
||||
*/
|
||||
setOpenUrlAction(url: string, urlTypeHint?: string): BrowseItem;
|
||||
|
||||
/**
|
||||
* Sets the URL target of the BrowseItem card
|
||||
*
|
||||
* @param url Image source URL.
|
||||
* @return Returns the current constructed BrowseItem
|
||||
*/
|
||||
setUrl(url: string): BrowseItem;
|
||||
|
||||
/**
|
||||
* Sets the URL type hint for the BrowseItem card
|
||||
*
|
||||
* @param urlTypeHint One of the typeHints enumerated by this.urlTypeHints()
|
||||
* @return Returns the current constructed BrowseItem
|
||||
*/
|
||||
setUrlTypeHint(urlTypeHint: string): BrowseItem;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -430,6 +644,90 @@ export class OptionItem {
|
||||
addSynonyms(synonyms: string | string[]): OptionItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for initializing and constructing MediaResponse with chainable interface.
|
||||
*/
|
||||
export class MediaResponse {
|
||||
/**
|
||||
* Constructor for MediaResponse.
|
||||
* @param mediaType Type of the media which defaults to MediaValues.Type.AUDIO
|
||||
*/
|
||||
constructor(mediaType: MediaValues.Type);
|
||||
|
||||
/**
|
||||
* Array of MediaObject held in the MediaResponse.
|
||||
*/
|
||||
mediaObjects: MediaObject[];
|
||||
|
||||
/**
|
||||
* Type of the media within this MediaResponse
|
||||
*/
|
||||
mediaType: MediaValues.Type;
|
||||
|
||||
/**
|
||||
* Adds a single media file or list of media files to the cart.
|
||||
*
|
||||
* @param items Single or Array of MediaObject to add.
|
||||
* @return Returns current constructed MediaResponse.
|
||||
*/
|
||||
addMediaObjects(items: MediaObject | MediaObject[]): MediaResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for initializing and constructing MediaObject with chainable interface.
|
||||
*/
|
||||
export class MediaObject {
|
||||
/**
|
||||
* Constructor for MediaObject.
|
||||
*
|
||||
* @param name Name of the MediaObject.
|
||||
* @param contentUrl URL of the MediaObject.
|
||||
*/
|
||||
constructor(name: string, contentUrl: string);
|
||||
|
||||
/**
|
||||
* Name of the MediaObject.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* MediaObject URL.
|
||||
*/
|
||||
contentUrl: string;
|
||||
|
||||
/**
|
||||
* Description of the MediaObject.
|
||||
*/
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
* Large image.
|
||||
*/
|
||||
largeImage?: Image;
|
||||
|
||||
/**
|
||||
* Icon image.
|
||||
*/
|
||||
icon?: Image;
|
||||
|
||||
/**
|
||||
* Set the description of the item.
|
||||
*
|
||||
* @param description Description of the item.
|
||||
* @return Returns current constructed MediaObject.
|
||||
*/
|
||||
setDescription(description: string): MediaObject;
|
||||
|
||||
/**
|
||||
* Sets the image for this item.
|
||||
*
|
||||
* @param url Image source URL.
|
||||
* @param type Type of image (LARGE or ICON).
|
||||
* @return Returns current constructed MediaObject.
|
||||
*/
|
||||
setImage(url: string, type: MediaValues.ImageType): MediaObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if given text contains SSML.
|
||||
* @param text Text to check.
|
||||
|
||||
Reference in New Issue
Block a user