graphql-composer
Version:
Create your GraphQL API using composition!
42 lines (41 loc) • 1.77 kB
TypeScript
import { GraphQLObjectType, ObjectTypeDefinitionNode } from "graphql";
import { InterfaceType, InputType, ClassType, Removable } from "../../../..";
import { GQLObjectType } from "./GQLObjectType";
export declare class ObjectType<T extends ClassType = any, ExtensionsType = any> extends GQLObjectType<GraphQLObjectType, T, ExtensionsType> {
private _interfaces;
get interfaces(): InterfaceType<any, any>[];
get definitionNode(): ObjectTypeDefinitionNode;
protected constructor(name: string);
/**
* Create a new ObjectType
*/
static create<T = any>(name: string): ObjectType<ClassType<T>>;
static create<T extends ClassType = any>(classType: T): ObjectType<T>;
static create<T = any>(inputType: InputType): ObjectType<ClassType<T>>;
static create<T = any>(objectType: ObjectType): ObjectType<ClassType<T>>;
static create<T = any>(interfaceType: InterfaceType): ObjectType<ClassType<T>>;
build(): GraphQLObjectType;
/**
* The interfaces to implement
* @param interfaces
*/
setInterfaces(...interfaces: InterfaceType[]): this;
/**
* Add some interfaces to implement
* @param interfaces the interfaces to implements
*/
addInterfaces(...interfaces: InterfaceType[]): this;
/**
* Remove some interfaces from implementation
* @param interfaces the interfaces ID's to remove
*/
removeInterfaces(...interfaces: Removable<InterfaceType>): this;
/**
* Add a suffix to the name of your type ("ObjectType" by default)
* @param suffix The suffix to add to the name
*/
suffix(suffix?: string): this;
copy(): ObjectType<T>;
convert(to: typeof InputType): InputType<T>;
convert(to: typeof InterfaceType): InterfaceType<T>;
}