/** * PlatformApiSchema 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 { PlatformApiSchema, PlatformApiSchemaWithRelations, PlatformApiSchemaSelect, PlatformApiSchemaFilter, PlatformApiSchemaOrderBy, CreatePlatformApiSchemaInput, UpdatePlatformApiSchemaInput, PlatformApiSchemaPatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class PlatformApiSchemaModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformApiSchemas: ConnectionResult>; }> { const { document, variables } = buildFindManyDocument( 'PlatformApiSchema', 'platformApiSchemas', 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, }, 'PlatformApiSchemaFilter', 'PlatformApiSchemaOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformApiSchema', fieldName: 'platformApiSchemas', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformApiSchema: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'PlatformApiSchema', 'platformApiSchemas', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'PlatformApiSchemaFilter', 'PlatformApiSchemaOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformApiSchema', fieldName: 'platformApiSchema', document, variables, transform: (data: { platformApiSchemas?: { nodes?: InferSelectResult[]; }; }) => ({ platformApiSchema: data.platformApiSchemas?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ platformApiSchema: InferSelectResult | null; }> { const { document, variables } = buildFindManyDocument( 'PlatformApiSchema', 'platformApiSchemas', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'PlatformApiSchemaFilter', 'PlatformApiSchemaOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformApiSchema', fieldName: 'platformApiSchema', document, variables, transform: (data: { platformApiSchemas?: { nodes?: InferSelectResult[]; }; }) => ({ platformApiSchema: data.platformApiSchemas?.nodes?.[0] ?? null, }), }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createPlatformApiSchema: { platformApiSchema: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'PlatformApiSchema', 'createPlatformApiSchema', 'platformApiSchema', args.select, args.data, 'CreatePlatformApiSchemaInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformApiSchema', fieldName: 'createPlatformApiSchema', document, variables, }); } update( args: UpdateArgs< S, { id: string; }, PlatformApiSchemaPatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updatePlatformApiSchema: { platformApiSchema: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'PlatformApiSchema', 'updatePlatformApiSchema', 'platformApiSchema', args.select, args.where.id, args.data, 'UpdatePlatformApiSchemaInput', 'id', 'platformApiSchemaPatch', connectionFieldsMap, undefined ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformApiSchema', fieldName: 'updatePlatformApiSchema', document, variables, }); } delete( args: DeleteArgs< { id: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deletePlatformApiSchema: { platformApiSchema: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'PlatformApiSchema', 'deletePlatformApiSchema', 'platformApiSchema', { id: args.where.id, }, 'DeletePlatformApiSchemaInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformApiSchema', fieldName: 'deletePlatformApiSchema', document, variables, }); } }