graphql-composer
Version:
Create your GraphQL API using composition!
43 lines (42 loc) • 1.56 kB
TypeScript
import { Arg, ClassType, StringKeyOf, InstanceOf, InputType, InputFieldType, Removable } from "../../..";
import { GQLBasicType } from "./GQLBasicType";
export declare class Args<T extends ClassType = any, ExtensionsType = any> extends GQLBasicType<any, any, ExtensionsType> {
protected _classType?: T;
private _args;
get classType(): T;
get args(): Arg<StringKeyOf<InstanceOf<T>>, any>[];
protected constructor(classTypeOrInputType?: T | InputType);
/**
* Create a new Args type
*/
static create<T extends ClassType = any>(classType: T): Args<T>;
static create<T = any>(name: StringKeyOf<T>, type: InputFieldType): Args<ClassType<T>>;
static create<T = any>(inputType: InputType): Args<ClassType<T>>;
static create<T = any>(): Args<ClassType<T>>;
/**
* Set the arguments list of the type
* @param args The arguments list
*/
setArgs(...args: Arg<StringKeyOf<InstanceOf<T>>>[]): this;
/**
* Add some arguments in the type
* @param name The argument name
* @param type The argument type
*/
addArgs(...args: Arg<StringKeyOf<InstanceOf<T>>>[]): this;
/**
* Remove some arguments in the type
* @param args The argument IDs
*/
removeArgs(...args: Removable<Arg<StringKeyOf<InstanceOf<T>>>>): this;
/**
* Add a suffix to the name ("Args" by default)
* @param suffix The suffix to add @default "Args"
*/
suffix(suffix?: string): void;
build(): any;
/**
* Copy the args type
*/
copy(): Args<T>;
}