Struct google_mirror1::api::MenuItem[][src]

pub struct MenuItem {
    pub action: Option<String>,
    pub contextual_command: Option<String>,
    pub id: Option<String>,
    pub payload: Option<String>,
    pub remove_when_selected: Option<bool>,
    pub values: Option<Vec<MenuValue>>,
}

A custom menu item that can be presented to the user by a timeline item.

This type is not used in any activity, and only used as part of another schema.

Fields

action: Option<String>

Controls the behavior when the user picks the menu option. Allowed values are:

  • CUSTOM - Custom action set by the service. When the user selects this menuItem, the API triggers a notification to your callbackUrl with the userActions.type set to CUSTOM and the userActions.payload set to the ID of this menu item. This is the default value.
  • Built-in actions:
  • REPLY - Initiate a reply to the timeline item using the voice recording UI. The creator attribute must be set in the timeline item for this menu to be available.
  • REPLY_ALL - Same behavior as REPLY. The original timeline item’s recipients will be added to the reply item.
  • DELETE - Delete the timeline item.
  • SHARE - Share the timeline item with the available contacts.
  • READ_ALOUD - Read the timeline item’s speakableText aloud; if this field is not set, read the text field; if none of those fields are set, this menu item is ignored.
  • GET_MEDIA_INPUT - Allow users to provide media payloads to Glassware from a menu item (currently, only transcribed text from voice input is supported). Subscribe to notifications when users invoke this menu item to receive the timeline item ID. Retrieve the media from the timeline item in the payload property.
  • VOICE_CALL - Initiate a phone call using the timeline item’s creator.phoneNumber attribute as recipient.
  • NAVIGATE - Navigate to the timeline item’s location.
  • TOGGLE_PINNED - Toggle the isPinned state of the timeline item.
  • OPEN_URI - Open the payload of the menu item in the browser.
  • PLAY_VIDEO - Open the payload of the menu item in the Glass video player.
  • SEND_MESSAGE - Initiate sending a message to the timeline item’s creator:
  • If the creator.phoneNumber is set and Glass is connected to an Android phone, the message is an SMS.
  • Otherwise, if the creator.email is set, the message is an email.
contextual_command: Option<String>

The ContextualMenus.Command associated with this MenuItem (e.g. READ_ALOUD). The voice label for this command will be displayed in the voice menu and the touch label will be displayed in the touch menu. Note that the default menu value’s display name will be overriden if you specify this property. Values that do not correspond to a ContextualMenus.Command name will be ignored.

id: Option<String>

The ID for this menu item. This is generated by the application and is treated as an opaque token.

payload: Option<String>

A generic payload whose meaning changes depending on this MenuItem’s action.

  • When the action is OPEN_URI, the payload is the URL of the website to view.
  • When the action is PLAY_VIDEO, the payload is the streaming URL of the video
  • When the action is GET_MEDIA_INPUT, the payload is the text transcription of a user’s speech input
remove_when_selected: Option<bool>

If set to true on a CUSTOM menu item, that item will be removed from the menu after it is selected.

values: Option<Vec<MenuValue>>

For CUSTOM items, a list of values controlling the appearance of the menu item in each of its states. A value for the DEFAULT state must be provided. If the PENDING or CONFIRMED states are missing, they will not be shown.

Trait Implementations

impl Clone for MenuItem[src]

impl Debug for MenuItem[src]

impl Default for MenuItem[src]

impl<'de> Deserialize<'de> for MenuItem[src]

impl Part for MenuItem[src]

impl Serialize for MenuItem[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.