From 7bd14e117fbe57fa11ab8d1ca3da464e6d8a639b Mon Sep 17 00:00:00 2001 From: Joel Hegg Date: Tue, 3 Apr 2018 12:39:08 -0400 Subject: [PATCH 1/2] [actions-on-google] Upgrade to 1.9 --- types/actions-on-google/assistant-app.d.ts | 204 +++++++++++++++++- types/actions-on-google/index.d.ts | 2 +- types/actions-on-google/response-builder.d.ts | 10 + 3 files changed, 210 insertions(+), 6 deletions(-) diff --git a/types/actions-on-google/assistant-app.d.ts b/types/actions-on-google/assistant-app.d.ts index d835915259..b3608b85e8 100644 --- a/types/actions-on-google/assistant-app.d.ts +++ b/types/actions-on-google/assistant-app.d.ts @@ -1,6 +1,6 @@ import * as express from 'express'; -import { BasicCard, Carousel, ImageDisplays, List, OptionItem, RichResponse } from './response-builder'; +import { BasicCard, Carousel, ImageDisplays, List, OptionItem, RichResponse, SimpleResponse } from './response-builder'; import { ActionPaymentTransactionConfig, Cart, GooglePaymentTransactionConfig, LineItem, Location, Order, OrderUpdate, TransactionDecision, TransactionValues } from './transactions'; @@ -30,6 +30,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 +47,9 @@ 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 } /** @@ -101,6 +105,10 @@ export enum BuiltInArgNames { * Transactions decision argument. */ TRANSACTION_DECISION_VALUE, + /** + * Place value argument. + */ + PLACE, /** * Confirmation argument. */ @@ -126,7 +134,9 @@ export enum BuiltInArgNames { */ NEW_SURFACE, /** Update registration value argument. */ - REGISTER_UPDATE + REGISTER_UPDATE, + /** Link request result argument. */ + LINK } /** @@ -173,6 +183,10 @@ export enum SurfaceCapabilities { * The ability to output on a screen */ SCREEN_OUTPUT, + /** + * The ability to open a web URL + */ + WEB_BROWSER } /** @@ -259,10 +273,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 +292,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 */ @@ -923,6 +958,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 +1240,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 @@ -1273,6 +1448,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. * @@ -1464,6 +1648,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 // --------------------------------------------------------------------------- diff --git a/types/actions-on-google/index.d.ts b/types/actions-on-google/index.d.ts index 937943e1f0..0260bc6cee 100644 --- a/types/actions-on-google/index.d.ts +++ b/types/actions-on-google/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for actions-on-google 1.8 +// Type definitions for actions-on-google 1.9 // Project: https://github.com/actions-on-google/actions-on-google-nodejs // Definitions by: Joel Hegg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/actions-on-google/response-builder.d.ts b/types/actions-on-google/response-builder.d.ts index 227d102958..966c881ba6 100644 --- a/types/actions-on-google/response-builder.d.ts +++ b/types/actions-on-google/response-builder.d.ts @@ -350,6 +350,16 @@ 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; } /** From ae57c33929ad2677fe1d0ed516e372298e60892d Mon Sep 17 00:00:00 2001 From: Joel Hegg Date: Tue, 3 Apr 2018 16:44:32 -0400 Subject: [PATCH 2/2] [actions-on-google] Upgrade to 1.10 --- types/actions-on-google/assistant-app.d.ts | 139 ++++++++- types/actions-on-google/index.d.ts | 2 +- types/actions-on-google/response-builder.d.ts | 288 ++++++++++++++++++ 3 files changed, 425 insertions(+), 4 deletions(-) diff --git a/types/actions-on-google/assistant-app.d.ts b/types/actions-on-google/assistant-app.d.ts index b3608b85e8..76a206122c 100644 --- a/types/actions-on-google/assistant-app.d.ts +++ b/types/actions-on-google/assistant-app.d.ts @@ -1,6 +1,7 @@ import * as express from 'express'; -import { BasicCard, Carousel, ImageDisplays, List, OptionItem, RichResponse, SimpleResponse } 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'; @@ -49,7 +50,9 @@ export enum StandardIntents { /** App receives CONFIGURE_UPDATES intent to indicate a REGISTER_UPDATE intent should be sent. */ CONFIGURE_UPDATES, /** App fires LINK intent to request user to open to link. */ - LINK + LINK, + /** App receives MEDIA_STATUS intent when the MediaResponse status is updated from user. */ + MEDIA_STATUS } /** @@ -136,7 +139,9 @@ export enum BuiltInArgNames { /** Update registration value argument. */ REGISTER_UPDATE, /** Link request result argument. */ - LINK + LINK, + /** MediaStatus value argument. */ + MEDIA_STATUS } /** @@ -183,6 +188,10 @@ 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 */ @@ -237,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. */ @@ -344,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. */ @@ -472,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. */ @@ -1384,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}). @@ -1488,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. * @@ -1694,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. * @@ -1706,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 // --------------------------------------------------------------------------- @@ -1746,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; } diff --git a/types/actions-on-google/index.d.ts b/types/actions-on-google/index.d.ts index 0260bc6cee..943554586f 100644 --- a/types/actions-on-google/index.d.ts +++ b/types/actions-on-google/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for actions-on-google 1.9 +// Type definitions for actions-on-google 1.10 // Project: https://github.com/actions-on-google/actions-on-google-nodejs // Definitions by: Joel Hegg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/actions-on-google/response-builder.d.ts b/types/actions-on-google/response-builder.d.ts index 966c881ba6..9844fe45c1 100644 --- a/types/actions-on-google/response-builder.d.ts +++ b/types/actions-on-google/response-builder.d.ts @@ -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. */ @@ -362,6 +462,110 @@ export class 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; +} + /** * Class for initializing and constructing Option Items with chainable interface. */ @@ -440,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.