/** * PlatformResourceInstallation 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 { PlatformResourceInstallation, PlatformResourceInstallationWithRelations, PlatformResourceInstallationSelect, PlatformResourceInstallationFilter, PlatformResourceInstallationOrderBy, CreatePlatformResourceInstallationInput, UpdatePlatformResourceInstallationInput, PlatformResourceInstallationPatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class PlatformResourceInstallationModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs< S, PlatformResourceInstallationFilter, PlatformResourceInstallationOrderBy > & { select: S; } & StrictSelect ): QueryBuilder<{ platformResourceInstallations: ConnectionResult< InferSelectResult >; }> { const { document, variables } = buildFindManyDocument( 'PlatformResourceInstallation', 'platformResourceInstallations', 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, }, 'PlatformResourceInstallationFilter', 'PlatformResourceInstallationOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformResourceInstallation', fieldName: 'platformResourceInstallations', document, variables, }); } findFirst( args: FindFirstArgs< S, PlatformResourceInstallationFilter, PlatformResourceInstallationOrderBy > & { select: S; } & StrictSelect ): QueryBuilder<{ platformResourceInstallation: InferSelectResult< PlatformResourceInstallationWithRelations, S > | null; }> { const { document, variables } = buildFindFirstDocument( 'PlatformResourceInstallation', 'platformResourceInstallations', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'PlatformResourceInstallationFilter', 'PlatformResourceInstallationOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformResourceInstallation', fieldName: 'platformResourceInstallation', document, variables, transform: (data: { platformResourceInstallations?: { nodes?: InferSelectResult[]; }; }) => ({ platformResourceInstallation: data.platformResourceInstallations?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ platformResourceInstallation: InferSelectResult< PlatformResourceInstallationWithRelations, S > | null; }> { const { document, variables } = buildFindManyDocument( 'PlatformResourceInstallation', 'platformResourceInstallations', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'PlatformResourceInstallationFilter', 'PlatformResourceInstallationOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformResourceInstallation', fieldName: 'platformResourceInstallation', document, variables, transform: (data: { platformResourceInstallations?: { nodes?: InferSelectResult[]; }; }) => ({ platformResourceInstallation: data.platformResourceInstallations?.nodes?.[0] ?? null, }), }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createPlatformResourceInstallation: { platformResourceInstallation: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'PlatformResourceInstallation', 'createPlatformResourceInstallation', 'platformResourceInstallation', args.select, args.data, 'CreatePlatformResourceInstallationInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformResourceInstallation', fieldName: 'createPlatformResourceInstallation', document, variables, }); } update( args: UpdateArgs< S, { id: string; }, PlatformResourceInstallationPatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updatePlatformResourceInstallation: { platformResourceInstallation: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'PlatformResourceInstallation', 'updatePlatformResourceInstallation', 'platformResourceInstallation', args.select, args.where.id, args.data, 'UpdatePlatformResourceInstallationInput', 'id', 'platformResourceInstallationPatch', connectionFieldsMap, undefined ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformResourceInstallation', fieldName: 'updatePlatformResourceInstallation', document, variables, }); } delete( args: DeleteArgs< { id: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deletePlatformResourceInstallation: { platformResourceInstallation: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'PlatformResourceInstallation', 'deletePlatformResourceInstallation', 'platformResourceInstallation', { id: args.where.id, }, 'DeletePlatformResourceInstallationInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformResourceInstallation', fieldName: 'deletePlatformResourceInstallation', document, variables, }); } }