/** * PlatformAgentTask model for ORM client * @generated by @constructive-io/graphql-codegen * DO NOT EDIT - changes will be overwritten */ import { OrmClient } from '../client'; import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildFindOneDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder'; import type { ConnectionResult, FindManyArgs, FindFirstArgs, CreateArgs, UpdateArgs, DeleteArgs, InferSelectResult, StrictSelect, } from '../select-types'; import type { PlatformAgentTask, PlatformAgentTaskWithRelations, PlatformAgentTaskSelect, PlatformAgentTaskFilter, PlatformAgentTaskOrderBy, CreatePlatformAgentTaskInput, UpdatePlatformAgentTaskInput, PlatformAgentTaskPatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class PlatformAgentTaskModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformAgentTasks: ConnectionResult>; }> { const { document, variables } = buildFindManyDocument( 'PlatformAgentTask', 'platformAgentTasks', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, first: args?.first, last: args?.last, after: args?.after, before: args?.before, offset: args?.offset, }, 'PlatformAgentTaskFilter', 'PlatformAgentTaskOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformAgentTask', fieldName: 'platformAgentTasks', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformAgentTask: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'PlatformAgentTask', 'platformAgentTasks', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'PlatformAgentTaskFilter', 'PlatformAgentTaskOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformAgentTask', fieldName: 'platformAgentTask', document, variables, transform: (data: { platformAgentTasks?: { nodes?: InferSelectResult[]; }; }) => ({ platformAgentTask: data.platformAgentTasks?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ platformAgentTask: InferSelectResult | null; }> { const { document, variables } = buildFindManyDocument( 'PlatformAgentTask', 'platformAgentTasks', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'PlatformAgentTaskFilter', 'PlatformAgentTaskOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformAgentTask', fieldName: 'platformAgentTask', document, variables, transform: (data: { platformAgentTasks?: { nodes?: InferSelectResult[]; }; }) => ({ platformAgentTask: data.platformAgentTasks?.nodes?.[0] ?? null, }), }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createPlatformAgentTask: { platformAgentTask: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'PlatformAgentTask', 'createPlatformAgentTask', 'platformAgentTask', args.select, args.data, 'CreatePlatformAgentTaskInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformAgentTask', fieldName: 'createPlatformAgentTask', document, variables, }); } update( args: UpdateArgs< S, { id: string; }, PlatformAgentTaskPatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updatePlatformAgentTask: { platformAgentTask: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'PlatformAgentTask', 'updatePlatformAgentTask', 'platformAgentTask', args.select, args.where.id, args.data, 'UpdatePlatformAgentTaskInput', 'id', 'platformAgentTaskPatch', connectionFieldsMap, undefined ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformAgentTask', fieldName: 'updatePlatformAgentTask', document, variables, }); } delete( args: DeleteArgs< { id: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deletePlatformAgentTask: { platformAgentTask: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'PlatformAgentTask', 'deletePlatformAgentTask', 'platformAgentTask', { id: args.where.id, }, 'DeletePlatformAgentTaskInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformAgentTask', fieldName: 'deletePlatformAgentTask', document, variables, }); } }