/** * PlatformAgentThread 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 { PlatformAgentThread, PlatformAgentThreadWithRelations, PlatformAgentThreadSelect, PlatformAgentThreadFilter, PlatformAgentThreadOrderBy, CreatePlatformAgentThreadInput, UpdatePlatformAgentThreadInput, PlatformAgentThreadPatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class PlatformAgentThreadModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformAgentThreads: ConnectionResult>; }> { const { document, variables } = buildFindManyDocument( 'PlatformAgentThread', 'platformAgentThreads', 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, }, 'PlatformAgentThreadFilter', 'PlatformAgentThreadOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformAgentThread', fieldName: 'platformAgentThreads', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformAgentThread: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'PlatformAgentThread', 'platformAgentThreads', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'PlatformAgentThreadFilter', 'PlatformAgentThreadOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformAgentThread', fieldName: 'platformAgentThread', document, variables, transform: (data: { platformAgentThreads?: { nodes?: InferSelectResult[]; }; }) => ({ platformAgentThread: data.platformAgentThreads?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ platformAgentThread: InferSelectResult | null; }> { const { document, variables } = buildFindManyDocument( 'PlatformAgentThread', 'platformAgentThreads', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'PlatformAgentThreadFilter', 'PlatformAgentThreadOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformAgentThread', fieldName: 'platformAgentThread', document, variables, transform: (data: { platformAgentThreads?: { nodes?: InferSelectResult[]; }; }) => ({ platformAgentThread: data.platformAgentThreads?.nodes?.[0] ?? null, }), }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createPlatformAgentThread: { platformAgentThread: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'PlatformAgentThread', 'createPlatformAgentThread', 'platformAgentThread', args.select, args.data, 'CreatePlatformAgentThreadInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformAgentThread', fieldName: 'createPlatformAgentThread', document, variables, }); } update( args: UpdateArgs< S, { id: string; }, PlatformAgentThreadPatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updatePlatformAgentThread: { platformAgentThread: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'PlatformAgentThread', 'updatePlatformAgentThread', 'platformAgentThread', args.select, args.where.id, args.data, 'UpdatePlatformAgentThreadInput', 'id', 'platformAgentThreadPatch', connectionFieldsMap, undefined ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformAgentThread', fieldName: 'updatePlatformAgentThread', document, variables, }); } delete( args: DeleteArgs< { id: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deletePlatformAgentThread: { platformAgentThread: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'PlatformAgentThread', 'deletePlatformAgentThread', 'platformAgentThread', { id: args.where.id, }, 'DeletePlatformAgentThreadInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformAgentThread', fieldName: 'deletePlatformAgentThread', document, variables, }); } }