/** * PlatformAgent 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 { PlatformAgent, PlatformAgentWithRelations, PlatformAgentSelect, PlatformAgentFilter, PlatformAgentOrderBy, CreatePlatformAgentInput, UpdatePlatformAgentInput, PlatformAgentPatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class PlatformAgentModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformAgents: ConnectionResult>; }> { const { document, variables } = buildFindManyDocument( 'PlatformAgent', 'platformAgents', 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, }, 'PlatformAgentFilter', 'PlatformAgentOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformAgent', fieldName: 'platformAgents', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformAgent: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'PlatformAgent', 'platformAgents', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'PlatformAgentFilter', 'PlatformAgentOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformAgent', fieldName: 'platformAgent', document, variables, transform: (data: { platformAgents?: { nodes?: InferSelectResult[]; }; }) => ({ platformAgent: data.platformAgents?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ platformAgent: InferSelectResult | null; }> { const { document, variables } = buildFindManyDocument( 'PlatformAgent', 'platformAgents', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'PlatformAgentFilter', 'PlatformAgentOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformAgent', fieldName: 'platformAgent', document, variables, transform: (data: { platformAgents?: { nodes?: InferSelectResult[]; }; }) => ({ platformAgent: data.platformAgents?.nodes?.[0] ?? null, }), }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createPlatformAgent: { platformAgent: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'PlatformAgent', 'createPlatformAgent', 'platformAgent', args.select, args.data, 'CreatePlatformAgentInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformAgent', fieldName: 'createPlatformAgent', document, variables, }); } update( args: UpdateArgs< S, { id: string; }, PlatformAgentPatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updatePlatformAgent: { platformAgent: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'PlatformAgent', 'updatePlatformAgent', 'platformAgent', args.select, args.where.id, args.data, 'UpdatePlatformAgentInput', 'id', 'platformAgentPatch', connectionFieldsMap, undefined ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformAgent', fieldName: 'updatePlatformAgent', document, variables, }); } delete( args: DeleteArgs< { id: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deletePlatformAgent: { platformAgent: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'PlatformAgent', 'deletePlatformAgent', 'platformAgent', { id: args.where.id, }, 'DeletePlatformAgentInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformAgent', fieldName: 'deletePlatformAgent', document, variables, }); } }