class InterfaceType
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.AppSync.InterfaceType |
Java | software.amazon.awscdk.services.appsync.InterfaceType |
Python | aws_cdk.aws_appsync.InterfaceType |
TypeScript (source) | @aws-cdk/aws-appsync » InterfaceType |
Implements
IIntermediate
Interface Types are abstract types that includes a certain set of fields that other types must include if they implement the interface.
Example
const node = new appsync.InterfaceType('Node', {
definition: {
id: appsync.GraphqlType.string({ isRequired: true }),
},
});
const demo = new appsync.ObjectType('Demo', {
interfaceTypes: [ node ],
definition: {
version: appsync.GraphqlType.string({ isRequired: true }),
},
});
Initializer
new InterfaceType(name: string, props: IntermediateTypeOptions)
Parameters
- name
string - props
IntermediateType Options
Properties
| Name | Type | Description |
|---|---|---|
| definition | { [string]: IField } | the attributes of this type. |
| name | string | the name of this type. |
| directives? | Directive[] | the directives for this object type. |
| modes? | Authorization[] | the authorization modes for this intermediate type. |
definition
Type:
{ [string]: IField }
the attributes of this type.
name
Type:
string
the name of this type.
directives?
Type:
Directive[]
(optional, default: no directives)
the directives for this object type.
modes?
Type:
Authorization[]
(optional)
the authorization modes for this intermediate type.
Methods
| Name | Description |
|---|---|
| add | Add a field to this Interface Type. |
| attribute(options?) | Create a GraphQL Type representing this Intermediate Type. |
| to | Generate the string of this object type. |
addField(options)
public addField(options: AddFieldOptions): void
Parameters
- options
Add— the options to add a field.Field Options
Add a field to this Interface Type.
Interface Types must have both fieldName and field options.
attribute(options?)
public attribute(options?: BaseTypeOptions): GraphqlType
Parameters
- options
Base— the options to configure this attribute.Type Options
Returns
Create a GraphQL Type representing this Intermediate Type.
toString()
public toString(): string
Returns
string
Generate the string of this object type.

.NET
Java
Python
TypeScript (