blob: 1ecfbe10e6ab5f546cdf36d4b90e0f8946c20452 [file] [log] [blame]
// Copyright 2017 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.modular;
using fuchsia.mem;
/// The Intent struct is a runtime descriptor for an abstract action to be initiated
/// in Fuchsia. For details please see docs/intent.md.
type Intent = resource struct {
/// The name of the action represented by this Intent.
///
/// This is nullable for backwards compatibility.
// TODO(fxbug.dev/15983): Make action non-nullable.
action string:<MAX, optional>;
/// An explicit handler for the Intent. Specified as the component URL of the
/// module.
handler string:<MAX, optional>;
/// NON-FUNCTIONAL: `parameters` is no longer supported but must remain for ABI compatibility.
parameters vector<IntentParameter>:<MAX, optional>;
};
/// NON-FUNCTIONAL: `IntentParameter` is no longer supported but must remain for ABI compatibility.
/// A struct representing a parameter that is passed to the handler of an Intent's
/// Action.
type IntentParameter = resource struct {
/// The name of the parameter. The handler (i.e. selected mod) will be provided
/// with the data for this parameter under a link called `name`.
name string:<MAX, optional>;
/// The data that will be passed to the intent handler.
data IntentParameterData;
};
/// NON-FUNCTIONAL: `IntentParameterData` is no longer supported but must remain defined for
/// `IntentParameter`'s ABI compatibility.
type IntentParameterData = strict resource union {
/// Set this if you already have an Entity reference at runtime.
/// Entity.getTypes() will be used to set the constraints for this noun during
/// resolution.
1: entity_reference string:MAX;
/// Set this if you have structured JSON data. Values typically are a JSON
/// object with a "@type" attribute and other associated data. TODO(thatguy):
/// We need to decide if we want to keep this in place, or deprecate this
/// eventually and move entirely to using Entity references.
///
/// DEPRECATED: Use `entity_reference`.
2: json fuchsia.mem.Buffer;
/// Set this if you want to explicitly define this noun's allowed types. This
/// is also useful in the cases where the noun has a 'direction' of type
/// 'output', and you wish to set the allowable output types from the Module
/// (see docs/modular/manifests/action_template.md for a definition of
/// 'direction').
///
/// Only one entry in `entity_type` must match the constraint specified by
/// the Module for the constraint to be considered satisfied.
3: entity_type vector<string:MAX>:MAX;
};