/** * PlatformApiSetting 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 { PlatformApiSetting, PlatformApiSettingWithRelations, PlatformApiSettingSelect, PlatformApiSettingFilter, PlatformApiSettingOrderBy, CreatePlatformApiSettingInput, UpdatePlatformApiSettingInput, PlatformApiSettingPatch, } from '../input-types'; import { connectionFieldsMap } from '../input-types'; export class PlatformApiSettingModel { constructor(private client: OrmClient) {} findMany( args: FindManyArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformApiSettings: ConnectionResult>; }> { const { document, variables } = buildFindManyDocument( 'PlatformApiSetting', 'platformApiSettings', 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, }, 'PlatformApiSettingFilter', 'PlatformApiSettingOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformApiSetting', fieldName: 'platformApiSettings', document, variables, }); } findFirst( args: FindFirstArgs & { select: S; } & StrictSelect ): QueryBuilder<{ platformApiSetting: InferSelectResult | null; }> { const { document, variables } = buildFindFirstDocument( 'PlatformApiSetting', 'platformApiSettings', args.select, { where: args?.where, orderBy: args?.orderBy as string[] | undefined, }, 'PlatformApiSettingFilter', 'PlatformApiSettingOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformApiSetting', fieldName: 'platformApiSetting', document, variables, transform: (data: { platformApiSettings?: { nodes?: InferSelectResult[]; }; }) => ({ platformApiSetting: data.platformApiSettings?.nodes?.[0] ?? null, }), }); } findOne( args: { id: string; select: S; } & StrictSelect ): QueryBuilder<{ platformApiSetting: InferSelectResult | null; }> { const { document, variables } = buildFindManyDocument( 'PlatformApiSetting', 'platformApiSettings', args.select, { where: { id: { equalTo: args.id, }, }, first: 1, }, 'PlatformApiSettingFilter', 'PlatformApiSettingOrderBy', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'query', operationName: 'PlatformApiSetting', fieldName: 'platformApiSetting', document, variables, transform: (data: { platformApiSettings?: { nodes?: InferSelectResult[]; }; }) => ({ platformApiSetting: data.platformApiSettings?.nodes?.[0] ?? null, }), }); } create( args: CreateArgs & { select: S; } & StrictSelect ): QueryBuilder<{ createPlatformApiSetting: { platformApiSetting: InferSelectResult; }; }> { const { document, variables } = buildCreateDocument( 'PlatformApiSetting', 'createPlatformApiSetting', 'platformApiSetting', args.select, args.data, 'CreatePlatformApiSettingInput', connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformApiSetting', fieldName: 'createPlatformApiSetting', document, variables, }); } update( args: UpdateArgs< S, { id: string; }, PlatformApiSettingPatch > & { select: S; } & StrictSelect ): QueryBuilder<{ updatePlatformApiSetting: { platformApiSetting: InferSelectResult; }; }> { const { document, variables } = buildUpdateByPkDocument( 'PlatformApiSetting', 'updatePlatformApiSetting', 'platformApiSetting', args.select, args.where.id, args.data, 'UpdatePlatformApiSettingInput', 'id', 'platformApiSettingPatch', connectionFieldsMap, undefined ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformApiSetting', fieldName: 'updatePlatformApiSetting', document, variables, }); } delete( args: DeleteArgs< { id: string; }, S > & { select: S; } & StrictSelect ): QueryBuilder<{ deletePlatformApiSetting: { platformApiSetting: InferSelectResult; }; }> { const { document, variables } = buildDeleteByPkDocument( 'PlatformApiSetting', 'deletePlatformApiSetting', 'platformApiSetting', { id: args.where.id, }, 'DeletePlatformApiSettingInput', args.select, connectionFieldsMap ); return new QueryBuilder({ client: this.client, operation: 'mutation', operationName: 'PlatformApiSetting', fieldName: 'deletePlatformApiSetting', document, variables, }); } }