graphql-composer
Version:
Create your GraphQL API using composition!
39 lines (38 loc) • 1.97 kB
TypeScript
import { GraphQLField, GraphQLInputField } from "graphql";
import { FieldType, InputFieldType, RequiredType } from "../..";
import { GQLElement } from "../../classes/GQLElement";
import { NullableType } from "../modifiers/Nullable";
export declare abstract class GQLField<BuiltType = any, NameType = string, ExtensionsType = any> extends GQLElement<BuiltType, NameType, ExtensionsType> {
protected _type: FieldType | InputFieldType;
protected _deprecationReason: string;
protected _description: string;
get type(): StringConstructor | BooleanConstructor | NumberConstructor | DateConstructor | import("graphql").GraphQLScalarType | import("../..").GQLObjectType<any, any, any> | import("../..").EnumType<any, any> | import("../..").UnionType<any> | FieldType[] | import("../..").ClassType<any> | RequiredType<FieldType> | NullableType<FieldType> | import("../..").InputType<any, any> | import("../..").EnumType<any, any> | InputFieldType[] | import("../..").ClassType<any> | RequiredType<InputFieldType> | NullableType<InputFieldType>;
get description(): string;
get deprecationReason(): string;
constructor(name: NameType & string, type: FieldType | InputFieldType);
abstract build(): GraphQLField<any, any, any> | GraphQLInputField;
abstract copy(): GQLField<any, any, any>;
/**
* Set the field type
* @param type the type of your field
*/
setType(type: FieldType | InputFieldType): this;
/**
* Set the description of the field
* @param deprecationReason The deprecation reason
*/
setDescription(description: string): this;
/**
* Set the deprecation reason of the field
* @param deprecationReason The deprecation reason
*/
setDeprecationReason(deprecationReason: string): this;
/**
* Convert your field type into a nullable type
*/
nullable(): this;
/**
* Convert your field type into a not nullable type
*/
required(): this;
}