Class UnionType
(experimental) Union Types are abstract types that are similar to Interface Types, but they cannot to specify any common fields between types.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.AppSync
Assembly: Amazon.CDK.AWS.AppSync.dll
Syntax (csharp)
public class UnionType : DeputyBase, IIntermediateType
Syntax (vb)
Public Class UnionType
Inherits DeputyBase
Implements IIntermediateType
Remarks
Note that fields of a union type need to be object types. In other words, you can't create a union type out of interfaces, other unions, or inputs.
Stability: Experimental
ExampleMetadata: infused
Examples
GraphqlApi api;
var string = GraphqlType.String();
var human = new ObjectType("Human", new ObjectTypeOptions { Definition = new Dictionary<string, IField> { { "name", string } } });
var droid = new ObjectType("Droid", new ObjectTypeOptions { Definition = new Dictionary<string, IField> { { "name", string } } });
var starship = new ObjectType("Starship", new ObjectTypeOptions { Definition = new Dictionary<string, IField> { { "name", string } } });
var search = new UnionType("Search", new UnionTypeOptions {
Definition = new [] { human, droid, starship }
});
api.AddType(search);
Synopsis
Constructors
UnionType(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
UnionType(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
UnionType(String, IUnionTypeOptions) |
Properties
Definition | (experimental) the attributes of this type. |
Modes | (experimental) the authorization modes supported by this intermediate type. |
Name | (experimental) the name of this type. |
Methods
AddField(IAddFieldOptions) | (experimental) Add a field to this Union Type. |
Attribute(IBaseTypeOptions) | (experimental) Create a GraphQL Type representing this Union Type. |
ToString() | (experimental) Generate the string of this Union type. |
Constructors
UnionType(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected UnionType(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
UnionType(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected UnionType(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
UnionType(String, IUnionTypeOptions)
public UnionType(string name, IUnionTypeOptions options)
Parameters
- name System.String
- options IUnionTypeOptions
Remarks
Stability: Experimental
Properties
Definition
(experimental) the attributes of this type.
public virtual IDictionary<string, IField> Definition { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, IField>
Remarks
Stability: Experimental
Modes
(experimental) the authorization modes supported by this intermediate type.
protected virtual AuthorizationType[] Modes { get; set; }
Property Value
Remarks
Stability: Experimental
Name
(experimental) the name of this type.
public virtual string Name { get; }
Property Value
System.String
Remarks
Stability: Experimental
Methods
AddField(IAddFieldOptions)
(experimental) Add a field to this Union Type.
public virtual void AddField(IAddFieldOptions options)
Parameters
- options IAddFieldOptions
the options to add a field.
Remarks
Input Types must have field options and the IField must be an Object Type.
Stability: Experimental
Attribute(IBaseTypeOptions)
(experimental) Create a GraphQL Type representing this Union Type.
public virtual GraphqlType Attribute(IBaseTypeOptions options = null)
Parameters
- options IBaseTypeOptions
the options to configure this attribute.
Returns
Remarks
Stability: Experimental
ToString()
(experimental) Generate the string of this Union type.
public override string ToString()
Returns
System.String
Remarks
Stability: Experimental