blob: 3ff51be38c1a5b78858078110611acb11ae1fefb [file] [log] [blame]
/// Copyright 2018 The Feed Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto2";
package search.now.ui.action;
option optimize_for=LITE_RUNTIME;
import "src/main/proto/search/now/ui/action/feed_action_payload.proto";
import "src/main/proto/search/now/wire/feed/action_payload.proto";
import "src/main/proto/search/now/wire/feed/content_id.proto";
import "src/main/proto/search/now/wire/feed/data_operation.proto";
option java_package = "com.google.search.now.ui.action";
option java_outer_classname = "FeedActionProto";
// Specification of an action to be taken within the feed.
message FeedAction {
extend FeedActionPayload {
optional FeedAction feed_action_extension = 192348469;
}
// The metadata, which is used by the client to update the client UI in
// real-time.
optional FeedActionMetadata metadata = 1;
reserved 2; // deprecated fields
}
// Metadata needed by the host to handle the action.
// Next Id: 9
message FeedActionMetadata {
// The type of action, used by the host to perform any custom logic needed for
// a specific type of action.
enum Type {
UNKNOWN = 0;
OPEN_URL = 1;
OPEN_URL_INCOGNITO = 2;
OPEN_URL_NEW_WINDOW = 3;
OPEN_CONTEXT_MENU = 4;
// Dismiss retained on the client and sent with requests. This information
// should not be persisted to server-side storage as this experience is
// intended for signed-out users or ones with WAA disabled.
DISMISS_LOCAL = 5;
// Dismiss logged on the server for signed-in users with WAA enabled.
DISMISS = 11;
// Note that the data required to download content is not on the action, but
// rather the content. This is intentionally done to avoid sending multiple
// copies of the same data, which could potentially be multiple long
// strings.
DOWNLOAD = 6;
OPEN_URL_NEW_TAB = 7;
LEARN_MORE = 8;
VIEW_ELEMENT = 12;
HIDE_ELEMENT = 13;
SHOW_TOOLTIP = 14;
NOT_INTERESTED_IN = 15;
SEE_SUGGESTED_SITES = 16;
reserved 9, 10; // Deprecated
}
optional Type type = 1;
oneof data {
// The data needed by the client to open the url for any OPEN_URL action
// including OPEN_URL_INCOGNITO and OPEN_URL_NEW_WINDOW.
OpenUrlData open_url_data = 2;
// The data needed by the Stream to open a context menu.
OpenContextMenuData open_context_menu_data = 3;
// The data needed by the Stream to perform a dismiss.
DismissData dismiss_data = 4;
// The data needed by the Stream to handle the not interested action.
NotInterestedInData not_interested_in_data = 6;
// The data needed by the Stream to render a tooltip.
TooltipData tooltip_data = 8;
}
// The type of element this action is bounded on.
enum ElementType {
UNKNOWN_ELEMENT_TYPE = 0;
CARD_LARGE_IMAGE = 1;
CARD_SMALL_IMAGE = 2;
INTEREST_HEADER = 3;
TOOLTIP = 4;
}
// Used by the host to perform Basic logging for views and clicks.
// This should be an ElementType.getNumber() but since proto lite doesn't
// handle when it gets added to, we need it to be an int instead of an enum
optional int32 element_type_value = 9;
reserved 5, 7;
}
// Data needed by the host to handle an OPEN_URL action.
message OpenUrlData {
// The Url to open.
optional string url = 1;
// If populated, the client will attempt to recod all pending actions before
// opening the url. Once this finishes, the client will attach to the url its
// latest frequency token as the value of this query param.
optional string consistency_token_query_param_name = 2;
}
// Data needed by Stream to open a context menu.
message OpenContextMenuData {
repeated LabelledFeedActionData context_menu_data = 1;
}
// Data needed by Stream to perform a dismiss.
message DismissData {
// The ContentId needed by the server to suppress reshowing the dismissed
// content. This will usually be the ContentId of the card which holds the
// content, not the ContentId of the content itself.
optional search.now.wire.feed.ContentId content_id = 1;
// The DataOperations which are needed to actually perform the dismiss on the
// client. This is typically a singleton list of a remove operation on the
// Cluster that the content belongs to.
repeated search.now.wire.feed.DataOperation data_operations = 2;
// Data used by the client to show a confirmation message with option to undo.
// This confirmation and undo option will only appear if the UndoAction is
// present and the client can handle this capability.
optional UndoAction undo_action = 3;
// Roundtripped server data on a per-action level.
optional search.now.wire.feed.ActionPayload payload = 4;
}
// Data needed by the client to handle the not interested action.
message NotInterestedInData {
// Data used by the client to show a confirmation message with option to undo.
// This confirmation and undo option will only appear if the UndoAction is
// present and the client can handle this capability.
optional UndoAction undo_action = 1;
// The data needed by Stream to preform the dismiss.
repeated search.now.wire.feed.DataOperation data_operations = 2;
// Roundtripped server data on a per-action level.
optional search.now.wire.feed.ActionPayload payload = 3;
enum RecordedInterestType {
UNKNOWN_INTEREST_TYPE = 0;
TOPIC = 1;
SOURCE = 2;
}
// The type of NotInterested Action that was performed.
// This should be an RecordedInterestType.getNumber() but since proto lite
// doesn't handle when it gets added to, we need it to be an int instead of
// an enum
optional int32 interest_type_value = 5;
reserved 4;
}
// Data used by the client to show a confirmation message with an action to
// reverse it.
message UndoAction {
// The string shown to the user that confirms the action was just taken.
optional string confirmation_label = 1;
// The string that labels that option to reverse the action. Defaults to
// "Undo" if not sent.
optional string undo_label = 2;
}
// The data needed by the Stream to render a tooltip.
message TooltipData {
optional string label = 1;
optional string accessibility_label = 2;
enum FeatureName {
// No tooltip will render if the FeatureName is UNKNOWN.
UNKNOWN = 0;
CARD_MENU = 1;
}
optional FeatureName feature_name = 3;
// The infromation for where to offset the arrow from the referenced view.
optional Insets insets = 4;
}
// The information for where to offset the tooltip arrow from the referenced
// view. The host will decide if the tooltip is above or below the view and this
// inset data changes the y coordinate of the tooltip arrow. For example, if top
// inset is 5 and the tooltip is shown above the view, then the tooltip will
// have its point of the arrow horizontally centered 5 dp below the top of the
// referenced view. If bottom inset is 5 and the tooltip is shown below the
// view, then the tooltip will have its point of the arrow horizontally centered
// 5 dp above the bottom of the referenced view. If no inset is set then the
// tooltip will show either directly above/below the referenced view.
message Insets {
optional int32 top = 1;
optional int32 bottom = 2;
}
// FeedActionMetadata with a label to show in a context menu.
message LabelledFeedActionData {
optional string label = 1;
optional FeedActionPayload feed_action_payload = 2;
}