import { EntitiesManager } from '@src/api/managers/EntitiesManager' ; import { EntitiesCacheManager , RoleResolvable , UserResolvable } from '@src/api' ; import { PermissionOverwrite } from '@src/api/entities/overwrites/PermissionOverwrite' ; import { Client } from '@src/core' ; import { ChannelPermissionOverwritesManagerData } from '@src/api/managers/overwrites/ChannelPermissionOverwritesManagerData' ; import { Keyspaces } from '@src/constants' ; import { PermissionOverwriteResolvable } from '@src/api/entities/overwrites/interfaces/PermissionOverwriteResolvable' ; import { AnyGuildChannel } from '@src/api/entities/channel/interfaces/AnyGuildChannel' ; import { PermissionOverwriteUpsertOptions } from '@src/api/managers/overwrites/PermissionOverwriteUpsertOptions' ; import { PermissionOverwriteEditOptions } from '@src/api/managers/overwrites/PermissionOverwriteEditOptions' ; export class ChannelPermissionOverwritesManager < T extends AnyGuildChannel > extends EntitiesManager { public cache : EntitiesCacheManager < PermissionOverwrite > ; public channel : T ; constructor ( client , data ) { super ( client ) ; this . channel = data . channel ; this . cache = new EntitiesCacheManager < PermissionOverwrite > ( this . client , { keyspace : Keyspaces . CHANNEL_PERMISSIONS_OVERWRITES , storage : this . channel . id , entity : 'PermissionOverwrite' , policy : 'overwrites' } ) ; } set ( overwrites , reason ? ) { return this . client . overwrites . set < T > ( this . channel . id , overwrites , { reason , patchEntity : this . channel } ) ; } async upsert ( overwrite , options ? ) { const result = await this . client . overwrites . upsert ( this . channel . id , overwrite , options ) ; return result ? this . channel : undefined ; } async create ( overwrite , reason ? ) { const result = await this . client . overwrites . create ( this . channel . id , overwrite , reason ) ; return result ? this . channel : undefined ; } async edit ( overwrite , options ? ) { const result = await this . client . overwrites . edit ( this . channel . id , overwrite , options ) ; return result ? this . channel : undefined ; } async delete ( userOrRoleOrOverwrite , reason ? ) { const result = await this . client . overwrites . delete ( this . channel . id , userOrRoleOrOverwrite , reason ) ; return result ? this . channel : undefined ; } }