diff --git a/types/actions-on-google/actions-sdk-app.d.ts b/types/actions-on-google/actions-sdk-app.d.ts index 8de0de0cfb..09a4fbe0ad 100644 --- a/types/actions-on-google/actions-sdk-app.d.ts +++ b/types/actions-on-google/actions-sdk-app.d.ts @@ -35,6 +35,7 @@ export class ActionsSdkApp extends AssistantApp { constructor(options: ActionsSdkAppOptions); /** + * @deprecated * Validates whether request is from Assistant through signature verification. * Uses Google-Auth-Library to verify authorization token against given * Google Cloud Project ID. Auth token is given in request header with key, @@ -58,6 +59,30 @@ export class ActionsSdkApp extends AssistantApp { */ isRequestFromAssistant(projectId: string): Promise; + /** + * Validates whether request is from Google through signature verification. + * Uses Google-Auth-Library to verify authorization token against given + * Google Cloud Project ID. Auth token is given in request header with key, + * "Authorization". + * + * @example + * const app = new ActionsSdkApp({request, response}); + * app.isRequestFromGoogle('nodejs-cloud-test-project-1234') + * .then(() => { + * app.ask('Hey there, thanks for stopping by!'); + * }) + * .catch(err => { + * response.status(400).send(); + * }); + * + * @param projectId Google Cloud Project ID for the Assistant app. + * @return Promise resolving with google-auth-library LoginTicket + * if request is from a valid source, otherwise rejects with the error reason + * for an invalid token. + * @actionssdk + */ + isRequestFromGoogle(projectId: string): Promise; + /** * Gets the request Conversation API version. * diff --git a/types/actions-on-google/assistant-app.d.ts b/types/actions-on-google/assistant-app.d.ts index d33f447a2e..caed5cf6cb 100644 --- a/types/actions-on-google/assistant-app.d.ts +++ b/types/actions-on-google/assistant-app.d.ts @@ -10,58 +10,36 @@ import { ActionPaymentTransactionConfig, Cart, GooglePaymentTransactionConfig, L * @dialogflow */ export enum StandardIntents { - /** - * App fires MAIN intent for queries like [talk to $app]. - */ + /** App fires MAIN intent for queries like [talk to $app]. */ MAIN, - /** - * App fires TEXT intent when action issues ask intent. - */ + /** App fires TEXT intent when action issues ask intent. */ TEXT, - /** - * App fires PERMISSION intent when action invokes askForPermission. - */ + /** App fires PERMISSION intent when action invokes askForPermission. */ PERMISSION, - /** - * App fires OPTION intent when user chooses from options provided. - */ + /** App fires OPTION intent when user chooses from options provided. */ OPTION, - /** - * App fires TRANSACTION_REQUIREMENTS_CHECK intent when action sets up transaction. - */ + /** App fires TRANSACTION_REQUIREMENTS_CHECK intent when action sets up transaction. */ TRANSACTION_REQUIREMENTS_CHECK, - /** - * App fires DELIVERY_ADDRESS intent when action asks for delivery address. - */ + /** App fires DELIVERY_ADDRESS intent when action asks for delivery address. */ DELIVERY_ADDRESS, - /** - * App fires TRANSACTION_DECISION intent when action asks for transaction decision. - */ + /** App fires TRANSACTION_DECISION intent when action asks for transaction decision. */ TRANSACTION_DECISION, - /** - * App fires CONFIRMATION intent when requesting affirmation from user. - */ + /** App fires CONFIRMATION intent when requesting affirmation from user. */ CONFIRMATION, - /** - * App fires DATETIME intent when requesting date/time from user. - */ + /** App fires DATETIME intent when requesting date/time from user. */ DATETIME, - /** - * App fires SIGN_IN intent when requesting sign-in from user. - */ + /** App fires SIGN_IN intent when requesting sign-in from user. */ SIGN_IN, - /** - * App fires NO_INPUT intent when user doesn't provide input. - */ + /** App fires NO_INPUT intent when user doesn't provide input. */ NO_INPUT, - /** - * App fires CANCEL intent when user exits app mid-dialog. - */ + /** App fires CANCEL intent when user exits app mid-dialog. */ CANCEL, - /** - * App fires NEW_SURFACE intent when requesting handoff to a new surface from user. - */ + /** App fires NEW_SURFACE intent when requesting handoff to a new surface from user. */ NEW_SURFACE, + /** App fires REGISTER_UPDATE intent when requesting the user to register for proactive updates. */ + REGISTER_UPDATE, + /** App receives CONFIGURE_UPDATES intent to indicate a custom REGISTER_UPDATE intent should be sent. */ + CONFIGURE_UPDATES } /** @@ -85,6 +63,10 @@ export enum SupportedPermissions { * {@link https://developers.google.com/actions/reference/conversation#Location|Location object}. */ DEVICE_COARSE_LOCATION, + /** + * Confirmation to receive proactive content at any time from the app. + */ + UPDATE } /** @@ -137,6 +119,8 @@ export enum BuiltInArgNames { * New surface value argument. */ NEW_SURFACE, + /** Update registration value argument. */ + REGISTER_UPDATE } /** @@ -144,8 +128,17 @@ export enum BuiltInArgNames { * {@link https://developers.google.com/actions/reference/conversation#Conversation|Conversation object}. * @actionssdk * @dialogflow + * @deprecated Use {@link ConversationTypes} instead. */ -export enum ConversationStages { +export type ConversationStages = ConversationTypes; + +/** + * List of possible conversation types, as defined in the + * {@link https://developers.google.com/actions/reference/conversation#Conversation|Conversation object}. + * @actionssdk + * @dialogflow + */ +export enum ConversationTypes { /** * Unspecified conversation state. */ @@ -224,6 +217,13 @@ export enum SignInStatus { ERROR } +/** + * Possible update trigger time context frequencies. + */ +export enum TimeContextFrequency { + DAILY +} + /** * User provided date/time info. */ @@ -277,6 +277,17 @@ export interface User { userName: UserName; /** Unique Oauth2 token. Only available with account linking. */ accessToken: string; + /** + * Timestamp for the last access from the user. + * Retrieve using app.getLastSeen() to get a Date object or null if never seen. + */ + lastSeen: string; + /** + * A string persistent across sessions. + * Retrieved and set using app.userStorage which allows you to store it like an JSON object + * which is abstracted for convenience by the client library. + */ + userStorage: string; } /** @@ -295,6 +306,17 @@ export interface Capability { name: string; } +/** + * Intent Argument. For incoming intents, the argument value can be retrieved + * using {@link AssistantApp#getArgument}. + */ +export interface IntentArgument { + /** Name of the argument. */ + name: string; + /** Text value of the argument. */ + textValue: string; +} + /** * The Actions on Google client library AssistantApp base class. * @@ -313,6 +335,20 @@ export class AssistantApp { */ data: object; + /** + * The data persistent across sessions in JSON format. + * It exists in the same context as getUser().userId + * + * @example + * // Actions SDK + * const app = new ActionsSdkApp({request: request, response: response}); + * app.userStorage.someProperty = 'someValue'; + * // Dialogflow + * const app = new DialogflowApp({request: request, response: response}); + * app.userStorage.someProperty = 'someValue'; + */ + userStorage: object; + /** * List of standard intents that the app provides. * @actionssdk @@ -339,8 +375,17 @@ export class AssistantApp { * {@link https://developers.google.com/actions/reference/conversation#Conversation|Conversation object}. * @actionssdk * @dialogflow + * @deprecated Use {@link ConversationTypes} instead. */ - readonly ConversationStages: typeof ConversationStages; + readonly ConversationStages: typeof ConversationTypes; + + /** + * List of possible conversation types, as defined in the + * {@link https://developers.google.com/actions/reference/conversation#Conversation|Conversation object}. + * @actionssdk + * @dialogflow + */ + readonly ConversationTypes: typeof ConversationTypes; /** * List of surface capabilities supported by the app. @@ -368,6 +413,11 @@ export class AssistantApp { */ readonly Transactions: typeof TransactionValues; + /** + * Possible update trigger time context frequencies. + */ + readonly TimeContextFrequency: typeof TimeContextFrequency; + // --------------------------------------------------------------------------- // Public APIs // --------------------------------------------------------------------------- @@ -477,7 +527,7 @@ export class AssistantApp { * @param permissions Array of permissions App supports, each of * which comes from AssistantApp.SupportedPermissions. * @param dialogState JSON object the app uses to hold dialog state that - * will be circulated back by Assistant. Used in {@link ActionsSdkAssistant}. + * will be circulated back by Assistant. Used in {@link ActionsSdkApp}. * @return A response is sent to Assistant to ask for the user's permission; for any * invalid input, we return null. * @actionssdk @@ -485,6 +535,58 @@ export class AssistantApp { */ askForPermissions(context: string, permissions: string[], dialogState?: object): express.Response | null; + /** + * Prompts the user for permission to send proactive updates at any time. + * + * @example + * const app = new DialogflowApp({request, response}); + * const REQUEST_PERMISSION_ACTION = 'request.permission'; + * const PERMISSION_REQUESTED = 'permission.requested'; + * const SHOW_IMAGE = 'show.image'; + * + * function requestPermission (app) { + * app.askForUpdatePermission('show.image', [ + * { + * name: 'image_to_show', + * textValue: 'image_type_1' + * } + * ]); + * } + * + * function checkPermission (app) { + * if (app.isPermissionGranted()) { + * app.tell(`Great, I'll send an update whenever I notice a change`); + * } else { + * // Response shows that user did not grant permission + * app.tell('Alright, just let me know whenever you need the weather!'); + * } + * } + * + * function showImage (app) { + * showPicture(app.getArgument('image_to_show')); + * } + * + * const actionMap = new Map(); + * actionMap.set(REQUEST_PERMISSION_ACTION, requestPermission); + * actionMap.set(PERMISSION_REQUESTED, checkPermission); + * actionMap.set(SHOW_IMAGE, showImage); + * app.handleRequest(actionMap); + * + * @param intent If using Dialogflow, the action name of the intent + * to be triggered when the update is received. If using Actions SDK, the + * intent name to be triggered when the update is received. + * @param intentArguments The necessary arguments + * to fulfill the intent triggered on update. These can be retrieved using + * {@link AssistantApp#getArgument}. + * @param dialogState JSON object the app uses to hold dialog state that + * will be circulated back by Assistant. Used in {@link ActionsSdkApp}. + * @return A response is sent to Assistant to ask for the user's permission; for any + * invalid input, we return null. + * @actionssdk + * @dialogflow + */ + askForUpdatePermission(intent: string, intentArguments: IntentArgument[], dialogState?: object): express.Response | null; + /** * Checks whether user is in transactable state. * @@ -520,7 +622,7 @@ export class AssistantApp { * options and order options. Optional if order has no payment or * delivery. * @param dialogState JSON object the app uses to hold dialog state that - * will be circulated back by Assistant. Used in {@link ActionsSdkAssistant}. + * will be circulated back by Assistant. Used in {@link ActionsSdkApp}. * @return HTTP response. * @actionssdk * @dialogflow @@ -562,7 +664,7 @@ export class AssistantApp { * transactionConfig Configuration for the transaction. Includes payment * options and order options. * @param dialogState JSON object the app uses to hold dialog state that - * will be circulated back by Assistant. Used in {@link ActionsSdkAssistant}. + * will be circulated back by Assistant. Used in {@link ActionsSdkApp}. * @return HTTP response * @dialogflow */ @@ -737,7 +839,7 @@ export class AssistantApp { * query for an affirmative or negative response. If undefined or null, * Google will use a generic yes/no prompt. * @param dialogState JSON object the app uses to hold dialog state that - * will be circulated back by Assistant. Used in {@link ActionsSdkAssistant}. + * will be circulated back by Assistant. Used in {@link ActionsSdkApp}. * @return HTTP response. * @actionssdk * @dialogflow @@ -782,7 +884,7 @@ export class AssistantApp { * time if not provided by user. If undefined or null, Google will use a * generic prompt. * @param dialogState JSON object the app uses to hold dialog state that - * will be circulated back by Assistant. Used in {@link ActionsSdkAssistant}. + * will be circulated back by Assistant. Used in {@link ActionsSdkApp}. * @return HTTP response. * @actionssdk * @dialogflow @@ -795,11 +897,6 @@ export class AssistantApp { * Retrieve the access token in subsequent intents using * app.getUser().accessToken. * - * Note: Currently this API requires enabling the app for Transactions APIs. - * To do this, fill out the App Info section of the Actions Console project - * and check the box indicating the use of Transactions under "Privacy and - * consent". - * * @example * const app = new DialogflowApp({ request, response }); * const WELCOME_INTENT = 'input.welcome'; @@ -824,7 +921,7 @@ export class AssistantApp { * app.handleRequest(actionMap); * * @param dialogState JSON object the app uses to hold dialog state that - * will be circulated back by Assistant. Used in {@link ActionsSdkAssistant}. + * will be circulated back by Assistant. Used in {@link ActionsSdkApp}. * @return HTTP response. * @actionssdk * @dialogflow @@ -872,13 +969,53 @@ export class AssistantApp { * @param capabilities The list of capabilities required in * the surface. * @param dialogState JSON object the app uses to hold dialog state that - * will be circulated back by Assistant. Used in {@link ActionsSdkAssistant}. + * will be circulated back by Assistant. Used in {@link ActionsSdkApp}. * @return HTTP response. * @dialogflow * @actionssdk */ askForNewSurface(context: string, notificationTitle: string, capabilities: SurfaceCapabilities[], dialogState?: object): express.Response | null; + /** + * Requests the user to register for daily updates. + * + * @example + * const app = new DialogflowApp({ request, response }); + * const WELCOME_INTENT = 'input.welcome'; + * const SHOW_IMAGE = 'show.image'; + * + * function welcomeIntent (app) { + * app.askToRegisterDailyUpdate('show.image', [ + * { + * name: 'image_to_show', + * textValue: 'image_type_1' + * } + * ]); + * } + * + * function showImage (app) { + * showPicture(app.getArgument('image_to_show')); + * } + * + * const actionMap = new Map(); + * actionMap.set(WELCOME_INTENT, welcomeIntent); + * actionMap.set(SHOW_IMAGE, showImage); + * app.handleRequest(actionMap); + * + * @param intent If using Dialogflow, the action name of the intent + * to be triggered when the update is received. If using Actions SDK, the + * intent name to be triggered when the update is received. + * @param intentArguments The necessary arguments + * to fulfill the intent triggered on update. These can be retrieved using + * {@link AssistantApp#getArgument}. + * @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 + */ + askToRegisterDailyUpdate(intent: string, intentArguments: IntentArgument[], dialogState?: object): express.Response | null; + /** * Gets the {@link User} object. * The user object contains information about the user, including @@ -945,6 +1082,18 @@ export class AssistantApp { */ getUserLocale(): string; + /** + * Get the user's last seen time as a Date object. + * Not supported in V1. + * + * @example + * const app = new DialogflowApp({request, response}); + * const lastSeen = app.getLastSeen(); + * + * @return User's last seen date or null if never seen + */ + getLastSeen(): Date | null; + /** * If granted permission to device's location in previous intent, returns device's * location (see {@link AssistantApp#askForPermissions|askForPermissions}). @@ -1225,6 +1374,16 @@ export class AssistantApp { */ isFinalReprompt(): boolean; + /** + * Returns true if user accepted update registration request. Used with + * {@link AssistantApp#askToRegisterDailyUpdate} + * + * @return True if user accepted update registration request. + * @dialogflow + * @actionssdk + */ + isUpdateRegistered(): boolean; + // --------------------------------------------------------------------------- // Response Builders // --------------------------------------------------------------------------- diff --git a/types/actions-on-google/index.d.ts b/types/actions-on-google/index.d.ts index 5f7baba3b8..378604411f 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.5 +// Type definitions for actions-on-google 1.6 // 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 1e11984551..5b6e3d7522 100644 --- a/types/actions-on-google/response-builder.d.ts +++ b/types/actions-on-google/response-builder.d.ts @@ -70,6 +70,24 @@ export interface OptionInfo { synonyms: string[]; } +export interface StructuredResponse { + orderUpdate: OrderUpdate; +} + +export interface RichResponseItemBasicCard { + basicCard: BasicCard; +} + +export interface RichResponseItemSimpleResponse { + simpleResponse: SimpleResponse; +} + +export interface RichResponseItemStructuredResponse { + structuredResponse: StructuredResponse; +} + +export type RichResponseItem = RichResponseItemBasicCard | RichResponseItemSimpleResponse | RichResponseItemStructuredResponse; + /** * Class for initializing and constructing Rich Responses with chainable interface. */ @@ -85,7 +103,7 @@ export class RichResponse { * Ordered list of either SimpleResponse objects or BasicCard objects. * First item must be SimpleResponse. There can be at most one card. */ - items: Array; + items: RichResponseItem[]; /** * Ordered list of text suggestions to display. Optional. diff --git a/types/actions-on-google/transactions.d.ts b/types/actions-on-google/transactions.d.ts index 8cc26165db..b4a4285fe9 100644 --- a/types/actions-on-google/transactions.d.ts +++ b/types/actions-on-google/transactions.d.ts @@ -25,8 +25,8 @@ export interface Price { * Order rejection info. */ export interface RejectionInfo { - /** One of Transaction.RejectionType. */ - type: RejectionType; + /** One of Transaction.ReasonType. */ + type: ReasonType; /** Reason for the order rejection. */ reason: string; } @@ -51,26 +51,16 @@ export interface CancellationInfo { * Order transit info. */ export interface TransitInfo { - /** UTC timestamp of the transit update. */ - updatedTime: { - /** Seconds since Unix epoch. */ - seconds: number; - /** Partial seconds since Unix epoch. */ - nanos?: number; - }; + /** UTC timestamp of the transit update as an RFC 3339 string. */ + updatedTime: string; } /** * Order fulfillment info. */ export interface FulfillmentInfo { - /** UTC timestamp of the fulfillment update. */ - deliveryTime: { - /** Seconds since Unix epoch. */ - seconds: number; - /** Partial seconds since Unix epoch. */ - nanos?: number; - }; + /** UTC timestamp of the fulfillment update as an RFC 3339 string. */ + deliveryTime: string; } /** @@ -140,7 +130,7 @@ export interface Location { */ export interface TransactionDecision { /** One of Transactions.ConfirmationDecision. */ - userDecision: ConfirmationDecision; + userDecision: TransactionUserDecision; checkResult: { /** One of Transactions.ResultType. */ resultType: ResultType; @@ -175,32 +165,61 @@ export interface TransactionDecision { export const TransactionValues: { /** List of transaction card networks available when paying with Google. */ readonly CardNetwork: typeof CardNetwork; + /** + * List of possible item types. + * @deprecated Use {@link TransactionValues.LineItemType} instead. + */ + readonly ItemType: typeof LineItemType; /** List of possible item types. */ - readonly ItemType: typeof ItemType; + readonly LineItemType: typeof LineItemType; /** List of price types. */ readonly PriceType: typeof PriceType; /** List of possible item types. */ readonly PaymentType: typeof PaymentType; /** List of customer information properties that can be requested. */ readonly CustomerInfoProperties: typeof CustomerInfoProperties; + /** + * List of possible order confirmation user decisions + * @deprecated Use {@link TransactionValues.TransactionUserDecision} instead. + */ + readonly ConfirmationDecision: typeof TransactionUserDecision; /** List of possible order confirmation user decisions */ - readonly ConfirmationDecision: typeof ConfirmationDecision; + readonly TransactionUserDecision: typeof TransactionUserDecision; /** List of possible order states. */ readonly OrderState: typeof OrderState; + /** + * List of possible actions to take on the order. + * @deprecated Use {@link TransactionValues.ActionType} instead. + */ + readonly OrderAction: typeof ActionType; /** List of possible actions to take on the order. */ - readonly OrderAction: typeof OrderAction; + readonly ActionType: typeof ActionType; + /** + * List of possible types of order rejection. + * @deprecated Use {@link TransactionValues.ReasonType} instead. + */ + readonly RejectionType: typeof ReasonType; /** List of possible types of order rejection. */ - readonly RejectionType: typeof RejectionType; + readonly ReasonType: typeof ReasonType; /** List of possible order state objects. */ readonly OrderStateInfo: typeof OrderStateInfo; /** List of possible order transaction requirements check result types. */ readonly ResultType: typeof ResultType; /** List of possible user decisions to give delivery address. */ - readonly DeliveryAddressDecision: typeof DeliveryAddressDecision; + readonly DeliveryAddressDecision: typeof DeliveryAddressUserDecision; + /** List of possible user decisions to give delivery address. */ + readonly DeliveryAddressUserDecision: typeof DeliveryAddressUserDecision; + /** + * List of possible order location types. + * @deprecated Use {@link TransactionValues.OrderLocationType} instead. + */ + readonly LocationType: typeof OrderLocationType; /** List of possible order location types. */ - readonly LocationType: typeof LocationType; + readonly OrderLocationType: typeof OrderLocationType; /** List of possible order time types. */ readonly TimeType: typeof TimeType; + /** List of possible tokenization types for the payment method */ + readonly PaymentMethodTokenizationType: typeof PaymentMethodTokenizationType; }; /** @@ -235,8 +254,14 @@ export enum CardNetwork { /** * List of possible item types. + * @deprecated Use {@link TransactionValues.LineItemType} instead. */ -export enum ItemType { +export type ItemType = LineItemType; + +/** + * List of possible item types. + */ +export enum LineItemType { /** * Unspecified. */ @@ -323,13 +348,24 @@ export enum PaymentType { * List of customer information properties that can be requested. */ export enum CustomerInfoProperties { + CUSTOMER_INFO_PROPERTY_UNSPECIFIED, EMAIL } /** * List of possible order confirmation user decisions + * @deprecated Use {@link TransactionValues.TransactionUserDecision} instead. */ -export enum ConfirmationDecision { +export type ConfirmationDecision = TransactionUserDecision; + +/** + * List of possible order confirmation user decisions + */ +export enum TransactionUserDecision { + /** + * Unspecified user decision. + */ + UNKNOWN_USER_DECISION, /** * Order was approved by user. */ @@ -353,6 +389,10 @@ export enum ConfirmationDecision { * List of possible order states. */ export enum OrderState { + /** + * Order was created at the integrator's system. + */ + CREATED, /** * Order was rejected. */ @@ -381,8 +421,18 @@ export enum OrderState { /** * List of possible actions to take on the order. + * @deprecated Use {@link TransactionValues.ActionType} instead. */ -export enum OrderAction { +export type OrderAction = ActionType; + +/** + * List of possible actions to take on the order. + */ +export enum ActionType { + /** + * Unknown action. + */ + UNKNOWN, /** * View details. */ @@ -418,13 +468,23 @@ export enum OrderAction { /** * Review. */ - REVIEW + REVIEW, + /** + * Customer Service. + */ + CUSTOMER_SERVICE } /** * List of possible types of order rejection. + * @deprecated Use {@link TransactionValues.ReasonType} instead. */ -export enum RejectionType { +export type RejectionType = ReasonType; + +/** + * List of possible types of order rejection. + */ +export enum ReasonType { /** * Unknown */ @@ -494,8 +554,14 @@ export enum ResultType { /** * List of possible user decisions to give delivery address. + * @deprecated Use {@link TransactionValues.DeliveryAddressUserDecision} instead. */ -export enum DeliveryAddressDecision { +export type DeliveryAddressDecision = DeliveryAddressUserDecision; + +/** + * List of possible user decisions to give delivery address. + */ +export enum DeliveryAddressUserDecision { /** * Unknown. */ @@ -512,8 +578,14 @@ export enum DeliveryAddressDecision { /** * List of possible order location types. + * @deprecated Use {@link TransactionValues.OrderLocationType} instead. */ -export enum LocationType { +export type LocationType = OrderLocationType; + +/** + * List of possible order location types. + */ +export enum OrderLocationType { /** * Unknown. */ @@ -533,7 +605,11 @@ export enum LocationType { /** * Destination of the order. */ - DESTINATION + DESTINATION, + /** + * Pick up location of the order. + */ + PICK_UP } /** @@ -558,6 +634,20 @@ export enum TimeType { RESERVATION_SLOT } +/** + * List of possible tokenization types for the payment method + */ +export enum PaymentMethodTokenizationType { + /** + * Unspecified tokenization type. + */ + UNSPECIFIED_TOKENIZATION_TYPE, + /** + * Use external payment gateway tokenization API to tokenize selected payment method. + */ + PAYMENT_GATEWAY +} + /** * Class for initializing and constructing Order with chainable interface. */ @@ -655,11 +745,11 @@ export class Order { /** * Adds an associated location to the order. Up to 2 locations can be added. * - * @param type One of TransactionValues.LocationType. + * @param type One of TransactionValues.OrderLocationType. * @param location Location to add. * @return Returns current constructed Order. */ - addLocation(type: LocationType, location: Location): Order; + addLocation(type: OrderLocationType, location: Location): Order; /** * Sets an associated time to the order. @@ -780,9 +870,9 @@ export class LineItem { image?: Image; /** - * Type of the item. One of TransactionValues.ItemType. + * Type of the item. One of TransactionValues.LineItemType. */ - type?: ItemType; + type?: LineItemType; /** * Quantity of the item. @@ -834,10 +924,10 @@ export class LineItem { /** * Set the type of the item. * - * @param type Type of the item. One of TransactionValues.ItemType. + * @param type Type of the item. One of TransactionValues.LineItemType. * @return Returns current constructed LineItem. */ - setType(type: ItemType): LineItem; + setType(type: LineItemType): LineItem; /** * Set the quantity of the item. @@ -898,9 +988,9 @@ export class OrderUpdate { lineItemUpdates: object; /** - * UTC timestamp of the order update. + * UTC timestamp of the order update as an RFC 3339 string. */ - updateTime?: object; + updateTime?: string; /** * Actionable items presented to the user to manage the order. @@ -946,7 +1036,7 @@ export class OrderUpdate { * Set the update time of the order. * * @param seconds Seconds since Unix epoch. - * @param nanos Partial time units. + * @param nanos Partial time units. It is rounded to the nearest millisecond. * @return Returns current constructed OrderUpdate. */ setUpdateTime(seconds: number, nanos?: number): OrderUpdate; @@ -974,12 +1064,12 @@ export class OrderUpdate { /** * Adds an actionable item for the user to manage the order. * - * @param type One of TransactionValues.OrderActions. + * @param type One of TransactionValues.ActionType. * @param label Button label. * @param url URL to open when button is clicked. * @return Returns current constructed OrderUpdate. */ - addOrderManagementAction(type: OrderAction, label: string, url: string): OrderUpdate; + addOrderManagementAction(type: ActionType, label: string, url: string): OrderUpdate; /** * Adds a single price update for a particular line item in the order.