Lint fixes

This commit is contained in:
Joel Hegg 2017-10-20 20:56:20 -04:00
parent 33aebc55ca
commit 82a2d24434
6 changed files with 96 additions and 108 deletions

View File

@ -7,20 +7,20 @@ import { Carousel, List, RichResponse, SimpleResponse } from './response-builder
// Actions SDK support
// ---------------------------------------------------------------------------
declare type ActionsSdkAppOptions = {
export interface ActionsSdkAppOptions {
/** Express HTTP request object. */
request: express.Request;
/** Express HTTP response object. */
response: express.Response;
/** Function callback when session starts. */
sessionStarted?: () => any;
};
sessionStarted?(): any;
}
/**
* This is the class that handles the conversation API directly from Assistant,
* providing implementation for all the methods available in the API.
*/
declare class ActionsSdkApp extends AssistantApp {
export class ActionsSdkApp extends AssistantApp {
/**
* Constructor for ActionsSdkApp object.
* To be used in the Actions SDK HTTP endpoint logic.
@ -388,5 +388,4 @@ declare class ActionsSdkApp extends AssistantApp {
* @actionssdk
*/
buildInputPrompt(isSsml: boolean, initialPrompt: string, noInputs?: string[]): object;
}

View File

@ -2,7 +2,7 @@ import * as express from 'express';
import { BasicCard, Carousel, List, OptionItem, RichResponse } from './response-builder';
import { ActionPaymentTransactionConfig, Cart, GooglePaymentTransactionConfig, LineItem,
Order, OrderUpdate, TransactionDecision, TransactionValues } from './transactions';
Location, Order, OrderUpdate, TransactionDecision, TransactionValues } from './transactions';
/**
* List of standard intents that the app provides.
@ -10,7 +10,7 @@ import { ActionPaymentTransactionConfig, Cart, GooglePaymentTransactionConfig, L
* @actionssdk
* @dialogflow
*/
declare enum StandardIntents {
export enum StandardIntents {
/**
* App fires MAIN intent for queries like [talk to $app].
*/
@ -71,7 +71,7 @@ declare enum StandardIntents {
* @actionssdk
* @dialogflow
*/
declare enum SupportedPermissions {
export enum SupportedPermissions {
/**
* The user's name as defined in the
* {@link https://developers.google.com/actions/reference/conversation#UserProfile|UserProfile object}
@ -95,7 +95,7 @@ declare enum SupportedPermissions {
* @actionssdk
* @dialogflow
*/
declare enum BuiltInArgNames {
export enum BuiltInArgNames {
/**
* Permission granted argument.
*/
@ -149,7 +149,7 @@ declare enum BuiltInArgNames {
* @actionssdk
* @dialogflow
*/
declare enum ConversationStages {
export enum ConversationStages {
/**
* Unspecified conversation state.
*/
@ -170,7 +170,7 @@ declare enum ConversationStages {
* @actionssdk
* @dialogflow
*/
declare enum SurfaceCapabilities {
export enum SurfaceCapabilities {
/**
* The ability to output audio.
*/
@ -187,7 +187,7 @@ declare enum SurfaceCapabilities {
* @actionssdk
* @dialogflow
*/
declare enum InputTypes {
export enum InputTypes {
/**
* Unspecified.
*/
@ -212,7 +212,7 @@ declare enum InputTypes {
* @actionssdk
* @dialogflow
*/
declare enum SignInStatus {
export enum SignInStatus {
/**
* Unknown status.
*/
@ -234,7 +234,7 @@ declare enum SignInStatus {
/**
* User provided date/time info.
*/
declare type DateTime = {
export interface DateTime {
date: {
year: number;
month: number;
@ -246,24 +246,24 @@ declare type DateTime = {
seconds: number;
nanos: number;
};
};
}
/**
* User's permissioned name info.
*/
declare type UserName = {
export interface UserName {
/** User's display name. */
displayName: string;
/** User's given name. */
givenName: string;
/** User's family name. */
familyName: string;
};
}
/**
* User's permissioned device location.
*/
declare type DeviceLocation = {
export interface DeviceLocation {
/** {latitude, longitude}. Requested with SupportedPermissions.DEVICE_PRECISE_LOCATION. */
coordinates: object;
/** Full, formatted street address. Requested with SupportedPermissions.DEVICE_PRECISE_LOCATION. */
@ -272,35 +272,35 @@ declare type DeviceLocation = {
zipCode: string;
/** Device city. Requested with SupportedPermissions.DEVICE_COARSE_LOCATION. */
city: string;
};
}
/**
* User object.
*/
declare type User = {
export interface User {
/** Random string ID for Google user. */
userId: string;
/** User name information. Null if not requested with {@link AssistantApp#askForPermission|askForPermission(SupportedPermissions.NAME)}. */
userName: UserName;
/** Unique Oauth2 token. Only available with account linking. */
accessToken: string;
};
}
/**
* Actions on Google Surface.
*/
declare type Surface = {
export interface Surface {
/** Capabilities of the surface. */
capabilities: Capability[];
};
}
/**
* Surface capability.
*/
declare type Capability = {
export interface Capability {
/** Name of the capability. */
name: string;
};
}
/**
* The Actions on Google client library AssistantApp base class.
@ -309,7 +309,7 @@ declare type Capability = {
* protocol from Assistant. It also exports the 'State' class as a helper to represent states by
* name.
*/
declare class AssistantApp {
export class AssistantApp {
/**
* The session state.
*/
@ -1329,5 +1329,4 @@ declare class AssistantApp {
* @return {OrderUpdate} Constructed OrderUpdate.
*/
buildOrderUpdate(orderId: string, isGoogleOrderId: boolean): OrderUpdate;
}

View File

@ -10,7 +10,7 @@ import { Carousel, List, RichResponse, SimpleResponse } from './response-builder
/**
* Dialogflow {@link https://dialogflow.com/docs/concept-contexts|Context}.
*/
declare type Context = {
export interface Context {
/** Full name of the context. */
name: string;
/**
@ -20,9 +20,9 @@ declare type Context = {
parameters: object;
/** Remaining number of intents */
lifespan: number;
};
}
declare type DialogflowAppOptions = {
export interface DialogflowAppOptions {
/** Express HTTP request object. */
request: express.Request;
/** Express HTTP response object. */
@ -32,13 +32,13 @@ declare type DialogflowAppOptions = {
* Only called if webhook is enabled for welcome/triggering intents, and
* called from Web Simulator or Google Home device (i.e., not Dialogflow simulator).
*/
sessionStarted?: () => any;
};
sessionStarted?(): any;
}
/**
* This is the class that handles the communication with Dialogflow's fulfillment API.
*/
declare class DialogflowApp extends AssistantApp {
export class DialogflowApp extends AssistantApp {
/**
* Constructor for DialogflowApp object.
* To be used in the Dialogflow fulfillment webhook logic.
@ -569,5 +569,4 @@ declare class DialogflowApp extends AssistantApp {
* @dialogflow
*/
getRawInput(): string;
}

View File

@ -1,4 +1,4 @@
// Type definitions for actions-on-google 1.5.1
// Type definitions for actions-on-google 1.5
// 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

View File

@ -7,36 +7,36 @@ import { OrderUpdate } from './transactions';
/**
* Simple Response type.
*/
declare type SimpleResponse = {
export interface SimpleResponse {
/** Speech to be spoken to user. SSML allowed. */
speech: string;
/** Optional text to be shown to user */
displayText?: string;
};
}
/**
* Suggestions to show with response.
*/
declare type Suggestion = {
export interface Suggestion {
/** Text of the suggestion. */
title: string;
};
}
/**
* Link Out Suggestion. Used in rich response as a suggestion chip which, when
* selected, links out to external URL.
*/
declare type LinkOutSuggestion = {
export interface LinkOutSuggestion {
/** Text shown on the suggestion chip. */
title: string;
/** String URL to open. */
url: string;
};
}
/**
* Image type shown on visual elements.
*/
declare type Image = {
export interface Image {
/** Image source URL. */
url: string;
/** Text to replace for image for accessibility. */
@ -45,12 +45,12 @@ declare type Image = {
width: number;
/** Height of the image. */
height: number;
};
}
/**
* Basic Card Button. Shown below basic cards. Open a URL when selected.
*/
declare type Button = {
export interface Button {
/** Text shown on the button. */
title: string;
/** Action to take when selected. */
@ -58,22 +58,22 @@ declare type Button = {
/** String URL to open. */
url: string;
};
};
}
/**
* Option info. Provides unique identifier for a given OptionItem.
*/
declare type OptionInfo = {
export interface OptionInfo {
/** Unique string ID for this option. */
key: string;
/** Synonyms that can be used by the user to indicate this option if they do not use the key. */
synonyms: string[];
};
}
/**
* Class for initializing and constructing Rich Responses with chainable interface.
*/
declare class RichResponse {
export class RichResponse {
/**
* Constructor for RichResponse. Accepts optional RichResponse to clone.
*
@ -85,7 +85,7 @@ declare class RichResponse {
* Ordered list of either SimpleResponse objects or BasicCard objects.
* First item must be SimpleResponse. There can be at most one card.
*/
items: (SimpleResponse | BasicCard)[];
items: Array<SimpleResponse | BasicCard>;
/**
* Ordered list of text suggestions to display. Optional.
@ -148,13 +148,12 @@ declare class RichResponse {
* @return {RichResponse} Returns current constructed RichResponse.
*/
addOrderUpdate(orderUpdate: OrderUpdate): RichResponse;
}
/**
* Class for initializing and constructing Basic Cards with chainable interface.
*/
declare class BasicCard {
export class BasicCard {
/**
* Constructor for BasicCard. Accepts optional BasicCard to clone.
*
@ -231,13 +230,12 @@ declare class BasicCard {
* @return {BasicCard} Returns current constructed BasicCard.
*/
addButton(text: string, url: string): BasicCard;
}
/**
* Class for initializing and constructing Lists with chainable interface.
*/
declare class List {
export class List {
/**
* Constructor for List. Accepts optional List to clone, string title, or
* list of items to copy.
@ -273,13 +271,12 @@ declare class List {
* @return {List} Returns current constructed List.
*/
addItems(optionItems: OptionItem | OptionItem[]): List;
}
/**
* Class for initializing and constructing Carousel with chainable interface.
*/
declare class Carousel {
export class Carousel {
/**
* Constructor for Carousel. Accepts optional Carousel to clone or list of
* items to copy.
@ -301,13 +298,12 @@ declare class Carousel {
* @return {Carousel} Returns current constructed Carousel.
*/
addItems(optionItems: OptionItem | OptionItem[]): Carousel;
}
/**
* Class for initializing and constructing Option Items with chainable interface.
*/
declare class OptionItem {
export class OptionItem {
/**
* Constructor for OptionItem. Accepts optional OptionItem to clone.
*
@ -380,7 +376,6 @@ declare class OptionItem {
* @return {OptionItem} Returns current constructed OptionItem.
*/
addSynonyms(synonyms: string | string[]): OptionItem;
}
/**
@ -388,4 +383,4 @@ declare class OptionItem {
* @param {string} text Text to check.
* @return {boolean} True if text contains SSML, false otherwise.
*/
declare function isSsml(text: string): boolean;
export function isSsml(text: string): boolean;

View File

@ -8,7 +8,7 @@ import { Image } from './response-builder';
/**
* Price type.
*/
declare type Price = {
export interface Price {
/** One of Transaction.PriceType. */
type: PriceType;
amount: {
@ -19,38 +19,38 @@ declare type Price = {
/** Partial unit count of price. */
nanos?: number;
};
};
}
/**
* Order rejection info.
*/
declare type RejectionInfo = {
export interface RejectionInfo {
/** One of Transaction.RejectionType. */
type: RejectionType;
/** Reason for the order rejection. */
reason: string;
};
}
/**
* Order receipt info.
*/
declare type ReceiptInfo = {
export interface ReceiptInfo {
/** Action provided order ID. Used when the order has been received by the integrator. */
confirmedActionOrderId: string;
};
}
/**
* Order cancellation info.
*/
declare type CancellationInfo = {
export interface CancellationInfo {
/** Reason for the cancellation. */
reason: string;
};
}
/**
* Order transit info.
*/
declare type TransitInfo = {
export interface TransitInfo {
/** UTC timestamp of the transit update. */
updatedTime: {
/** Seconds since Unix epoch. */
@ -58,12 +58,12 @@ declare type TransitInfo = {
/** Partial seconds since Unix epoch. */
nanos?: number;
};
};
}
/**
* Order fulfillment info.
*/
declare type FulfillmentInfo = {
export interface FulfillmentInfo {
/** UTC timestamp of the fulfillment update. */
deliveryTime: {
/** Seconds since Unix epoch. */
@ -71,21 +71,21 @@ declare type FulfillmentInfo = {
/** Partial seconds since Unix epoch. */
nanos?: number;
};
};
}
/**
* Order return info.
*/
declare type ReturnInfo = {
export interface ReturnInfo {
/** Reason for the return. */
reason: string;
};
}
/**
* Transaction config for transactions not involving a Google provided
* payment instrument.
*/
declare type ActionPaymentTransactionConfig = {
export interface ActionPaymentTransactionConfig {
/** True if delivery address is required for the transaction. */
deliveryAddressRequired: boolean;
/** One of Transactions.PaymentType. */
@ -93,13 +93,13 @@ declare type ActionPaymentTransactionConfig = {
/** The name of the instrument displayed on receipt. For example, for card payment, could be "VISA-1234". */
displayName: string;
customerInfoOptions?: CustomerInfoOptions;
};
}
/**
* Transaction config for transactions involving a Google provided payment
* instrument.
*/
declare type GooglePaymentTransactionConfig = {
export interface GooglePaymentTransactionConfig {
/** True if delivery address is required for the transaction. */
deliveryAddressRequired: boolean;
/** Tokenization parameters provided by payment gateway. */
@ -109,19 +109,19 @@ declare type GooglePaymentTransactionConfig = {
/** True if prepaid cards are not allowed for transaction. */
prepaidCardDisallowed: boolean;
customerInfoOptions?: CustomerInfoOptions;
};
}
/**
* Customer information requested as part of the transaction
*/
declare type CustomerInfoOptions = {
export interface CustomerInfoOptions {
customerInfoProperties: string[];
};
}
/**
* Generic Location type.
*/
declare type Location = {
export interface Location {
postalAddress: {
regionCode: string;
languageCode: string;
@ -133,12 +133,12 @@ declare type Location = {
};
phoneNumber: string;
notes: string;
};
}
/**
* Decision and order information returned when calling getTransactionDecision().
*/
declare type TransactionDecision = {
export interface TransactionDecision {
/** One of Transactions.ConfirmationDecision. */
userDecision: ConfirmationDecision;
checkResult: {
@ -167,12 +167,12 @@ declare type TransactionDecision = {
* Will appear if userDecision is Transactions.DELIVERY_ADDRESS_UPDATED.
*/
deliveryAddress: Location;
};
}
/**
* Values related to supporting transactions
*/
declare const TransactionValues: {
export const TransactionValues: {
/** List of transaction card networks available when paying with Google. */
readonly CardNetwork: typeof CardNetwork;
/** List of possible item types. */
@ -207,7 +207,7 @@ declare const TransactionValues: {
* List of transaction card networks available when paying with Google.
* @enum {string}
*/
declare enum CardNetwork {
export enum CardNetwork {
/**
* Unspecified.
*/
@ -238,7 +238,7 @@ declare enum CardNetwork {
* List of possible item types.
* @enum {string}
*/
declare enum ItemType {
export enum ItemType {
/**
* Unspecified.
*/
@ -277,7 +277,7 @@ declare enum ItemType {
* List of price types.
* @enum {string}
*/
declare enum PriceType {
export enum PriceType {
/**
* Unknown.
*/
@ -296,7 +296,7 @@ declare enum PriceType {
* List of possible item types.
* @enum {string}
*/
declare enum PaymentType {
export enum PaymentType {
/**
* Unspecified.
*/
@ -327,7 +327,7 @@ declare enum PaymentType {
* List of customer information properties that can be requested.
* @enum {string}
*/
declare enum CustomerInfoProperties {
export enum CustomerInfoProperties {
EMAIL
}
@ -335,7 +335,7 @@ declare enum CustomerInfoProperties {
* List of possible order confirmation user decisions
* @enum {string}
*/
declare enum ConfirmationDecision {
export enum ConfirmationDecision {
/**
* Order was approved by user.
*/
@ -359,7 +359,7 @@ declare enum ConfirmationDecision {
* List of possible order states.
* @enum {string}
*/
declare enum OrderState {
export enum OrderState {
/**
* Order was rejected.
*/
@ -390,7 +390,7 @@ declare enum OrderState {
* List of possible actions to take on the order.
* @enum {string}
*/
declare enum OrderAction {
export enum OrderAction {
/**
* View details.
*/
@ -433,7 +433,7 @@ declare enum OrderAction {
* List of possible types of order rejection.
* @enum {string}
*/
declare enum RejectionType {
export enum RejectionType {
/**
* Unknown
*/
@ -448,7 +448,7 @@ declare enum RejectionType {
* List of possible order state objects.
* @enum {string}
*/
declare enum OrderStateInfo {
export enum OrderStateInfo {
/**
* Information about order rejection. Used with {@link RejectionInfo}.
*/
@ -479,7 +479,7 @@ declare enum OrderStateInfo {
* List of possible order transaction requirements check result types.
* @enum {string}
*/
declare enum ResultType {
export enum ResultType {
/**
* Unspecified.
*/
@ -507,7 +507,7 @@ declare enum ResultType {
* List of possible user decisions to give delivery address.
* @enum {string}
*/
declare enum DeliveryAddressDecision {
export enum DeliveryAddressDecision {
/**
* Unknown.
*/
@ -526,7 +526,7 @@ declare enum DeliveryAddressDecision {
* List of possible order location types.
* @enum {string}
*/
declare enum LocationType {
export enum LocationType {
/**
* Unknown.
*/
@ -553,7 +553,7 @@ declare enum LocationType {
* List of possible order time types.
* @enum {string}
*/
declare enum TimeType {
export enum TimeType {
/**
* Unknown.
*/
@ -575,7 +575,7 @@ declare enum TimeType {
/**
* Class for initializing and constructing Order with chainable interface.
*/
declare class Order {
export class Order {
/**
* Constructor for Order.
*
@ -685,13 +685,12 @@ declare class Order {
* @return {Order} Returns current constructed Order.
*/
setTime(type: TimeType, time: string): Order;
}
/**
* Class for initializing and constructing Cart with chainable interface.
*/
declare class Cart {
export class Cart {
/**
* Constructor for Cart.
*
@ -756,13 +755,12 @@ declare class Cart {
* @return {Cart} Returns current constructed Cart.
*/
addOtherItems(items: LineItem | LineItem[]): Cart;
}
/**
* Class for initializing and constructing LineItem with chainable interface.
*/
declare class LineItem {
export class LineItem {
/**
* Constructor for LineItem.
*
@ -789,7 +787,7 @@ declare class LineItem {
/**
* Sublines for current item. Only valid if item type is REGULAR.
*/
subLines?: (string | LineItem)[];
subLines?: Array<string | LineItem>;
/**
* Image of the item.
@ -824,7 +822,7 @@ declare class LineItem {
* @param {string|LineItem|Array<string|LineItem>} items Sublines to add.
* @return {LineItem} Returns current constructed LineItem.
*/
addSublines(items: string | LineItem | (string | LineItem)[]): LineItem;
addSublines(items: string | LineItem | Array<string | LineItem>): LineItem;
/**
* Sets the image for this item.
@ -880,13 +878,12 @@ declare class LineItem {
* @return {LineItem} Returns current constructed LineItem.
*/
setOfferId(offerId: string): LineItem;
}
/**
* Class for initializing and constructing OrderUpdate with chainable interface.
*/
declare class OrderUpdate {
export class OrderUpdate {
/**
* Constructor for OrderUpdate.
*
@ -1039,5 +1036,4 @@ declare class OrderUpdate {
* @return {OrderUpdate} Returns current constructed OrderUpdate.
*/
setInfo(type: string, data: object): OrderUpdate;
}