class GraphqlType
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.AppSync.GraphqlType |
Java | software.amazon.awscdk.services.appsync.GraphqlType |
Python | aws_cdk.aws_appsync.GraphqlType |
TypeScript (source) | @aws-cdk/aws-appsync ยป GraphqlType |
Implements
IField
The GraphQL Types in AppSync's GraphQL.
GraphQL Types are the building blocks for object types, queries, mutations, etc. They are types like String, Int, Id or even Object Types you create.
i.e. String
, String!
, [String]
, [String!]
, [String]!
GraphQL Types are used to define the entirety of schema.
Example
declare const api: appsync.GraphqlApi;
declare const dummyRequest: appsync.MappingTemplate;
declare const dummyResponse: appsync.MappingTemplate;
const info = new appsync.ObjectType('Info', {
definition: {
node: new appsync.ResolvableField({
returnType: appsync.GraphqlType.string(),
args: {
id: appsync.GraphqlType.string(),
},
dataSource: api.addNoneDataSource('none'),
requestMappingTemplate: dummyRequest,
responseMappingTemplate: dummyResponse,
}),
},
});
Initializer (protected)
super(type: Type, options?: GraphqlTypeOptions)
Parameters
- type
Type
- options
Graphql
Type Options
Properties
Name | Type | Description |
---|---|---|
is | boolean | property determining if this attribute is a list i.e. if true, attribute would be [Type] . |
is | boolean | property determining if this attribute is non-nullable i.e. if true, attribute would be Type! and this attribute must always have a value. |
is | boolean | property determining if this attribute is a non-nullable list i.e. if true, attribute would be [ Type ]! and this attribute's list must always have a value. |
type | Type | the type of attribute. |
intermediate | IIntermediate | the intermediate type linked to this attribute (i.e. an interface or an object). |
isList
Type:
boolean
property determining if this attribute is a list i.e. if true, attribute would be [Type]
.
isRequired
Type:
boolean
property determining if this attribute is non-nullable i.e. if true, attribute would be Type!
and this attribute must always have a value.
isRequiredList
Type:
boolean
property determining if this attribute is a non-nullable list i.e. if true, attribute would be [ Type ]!
and this attribute's list must always have a value.
type
Type:
Type
the type of attribute.
intermediateType?
Type:
IIntermediate
(optional, default: no intermediate type)
the intermediate type linked to this attribute (i.e. an interface or an object).
Methods
Name | Description |
---|---|
args | Generate the arguments for this field. |
directives | Generate the directives for this field. |
to | Generate the string for this attribute. |
static aws | AWSDate scalar type represents a valid extended ISO 8601 Date string. |
static aws | AWSDateTime scalar type represents a valid extended ISO 8601 DateTime string. |
static aws | AWSEmail scalar type represents an email address string (i.e.username@example.com ). |
static aws | AWSIPAddress scalar type respresents a valid IPv4 of IPv6 address string. |
static aws | AWSJson scalar type represents a JSON string. |
static aws | AWSPhone scalar type represents a valid phone number. Phone numbers maybe be whitespace delimited or hyphenated. |
static aws | AWSTime scalar type represents a valid extended ISO 8601 Time string. |
static aws | AWSTimestamp scalar type represents the number of seconds since 1970-01-01T00:00Z . |
static aws | AWSURL scalar type represetns a valid URL string. |
static boolean(options?) | Boolean scalar type is a boolean value: true or false. |
static float(options?) | Float scalar type is a signed double-precision fractional value. |
static id(options?) | ID scalar type is a unique identifier. ID type is serialized similar to String . |
static int(options?) | Int scalar type is a signed non-fractional numerical value. |
static intermediate(options?) | an intermediate type to be added as an attribute (i.e. an interface or an object type). |
static string(options?) | String scalar type is a free-form human-readable text. |
ToString()
argspublic argsToString(): string
Returns
string
Generate the arguments for this field.
ToString(_modes?)
directivespublic directivesToString(_modes?: AuthorizationType[]): string
Parameters
- _modes
Authorization
Type []
Returns
string
Generate the directives for this field.
String()
topublic toString(): string
Returns
string
Generate the string for this attribute.
Date(options?)
static awspublic static awsDate(options?: BaseTypeOptions): GraphqlType
Parameters
- options
Base
โ the options to configure this attribute - isList - isRequired - isRequiredList.Type Options
Returns
AWSDate
scalar type represents a valid extended ISO 8601 Date
string.
In other words, accepts date strings in the form of YYYY-MM-DD
. It accepts time zone offsets.
DateTime(options?)
static awspublic static awsDateTime(options?: BaseTypeOptions): GraphqlType
Parameters
- options
Base
โ the options to configure this attribute - isList - isRequired - isRequiredList.Type Options
Returns
AWSDateTime
scalar type represents a valid extended ISO 8601 DateTime
string.
In other words, accepts date strings in the form of YYYY-MM-DDThh:mm:ss.sssZ
. It accepts time zone offsets.
Email(options?)
static awspublic static awsEmail(options?: BaseTypeOptions): GraphqlType
Parameters
- options
Base
โ the options to configure this attribute - isList - isRequired - isRequiredList.Type Options
Returns
AWSEmail
scalar type represents an email address string (i.e.username@example.com
).
IpAddress(options?)
static awspublic static awsIpAddress(options?: BaseTypeOptions): GraphqlType
Parameters
- options
Base
โ the options to configure this attribute - isList - isRequired - isRequiredList.Type Options
Returns
AWSIPAddress
scalar type respresents a valid IPv4
of IPv6
address string.
Json(options?)
static awspublic static awsJson(options?: BaseTypeOptions): GraphqlType
Parameters
- options
Base
โ the options to configure this attribute - isList - isRequired - isRequiredList.Type Options
Returns
AWSJson
scalar type represents a JSON string.
Phone(options?)
static awspublic static awsPhone(options?: BaseTypeOptions): GraphqlType
Parameters
- options
Base
โ the options to configure this attribute - isList - isRequired - isRequiredList.Type Options
Returns
AWSPhone
scalar type represents a valid phone number. Phone numbers maybe be whitespace delimited or hyphenated.
The number can specify a country code at the beginning, but is not required for US phone numbers.
Time(options?)
static awspublic static awsTime(options?: BaseTypeOptions): GraphqlType
Parameters
- options
Base
โ the options to configure this attribute - isList - isRequired - isRequiredList.Type Options
Returns
AWSTime
scalar type represents a valid extended ISO 8601 Time
string.
In other words, accepts date strings in the form of hh:mm:ss.sss
. It accepts time zone offsets.
Timestamp(options?)
static awspublic static awsTimestamp(options?: BaseTypeOptions): GraphqlType
Parameters
- options
Base
โ the options to configure this attribute - isList - isRequired - isRequiredList.Type Options
Returns
AWSTimestamp
scalar type represents the number of seconds since 1970-01-01T00:00Z
.
Timestamps are serialized and deserialized as numbers.
Url(options?)
static awspublic static awsUrl(options?: BaseTypeOptions): GraphqlType
Parameters
- options
Base
โ the options to configure this attribute - isList - isRequired - isRequiredList.Type Options
Returns
AWSURL
scalar type represetns a valid URL string.
URLs wihtout schemes or contain double slashes are considered invalid.
static boolean(options?)
public static boolean(options?: BaseTypeOptions): GraphqlType
Parameters
- options
Base
โ the options to configure this attribute - isList - isRequired - isRequiredList.Type Options
Returns
Boolean
scalar type is a boolean value: true or false.
static float(options?)
public static float(options?: BaseTypeOptions): GraphqlType
Parameters
- options
Base
โ the options to configure this attribute - isList - isRequired - isRequiredList.Type Options
Returns
Float
scalar type is a signed double-precision fractional value.
static id(options?)
public static id(options?: BaseTypeOptions): GraphqlType
Parameters
- options
Base
โ the options to configure this attribute - isList - isRequired - isRequiredList.Type Options
Returns
ID
scalar type is a unique identifier. ID
type is serialized similar to String
.
Often used as a key for a cache and not intended to be human-readable.
static int(options?)
public static int(options?: BaseTypeOptions): GraphqlType
Parameters
- options
Base
โ the options to configure this attribute - isList - isRequired - isRequiredList.Type Options
Returns
Int
scalar type is a signed non-fractional numerical value.
static intermediate(options?)
public static intermediate(options?: GraphqlTypeOptions): GraphqlType
Parameters
- options
Graphql
โ the options to configure this attribute - isList - isRequired - isRequiredList - intermediateType.Type Options
Returns
an intermediate type to be added as an attribute (i.e. an interface or an object type).
static string(options?)
public static string(options?: BaseTypeOptions): GraphqlType
Parameters
- options
Base
โ the options to configure this attribute - isList - isRequired - isRequiredList.Type Options
Returns
String
scalar type is a free-form human-readable text.