AssetService

AssetService

Contains methods relating to Asset entities.

Signature

class AssetService {
  constructor(connection: TransactionalConnection, configService: ConfigService, listQueryBuilder: ListQueryBuilder, eventBus: EventBus, tagService: TagService, channelService: ChannelService, roleService: RoleService, customFieldRelationService: CustomFieldRelationService)
  findOne(ctx: RequestContext, id: ID) => Promise<Asset | undefined>;
  findAll(ctx: RequestContext, options?: AssetListOptions) => Promise<PaginatedList<Asset>>;
  async getFeaturedAsset(ctx: RequestContext, entity: T) => Promise<Asset | undefined>;
  async getEntityAssets(ctx: RequestContext, entity: T) => Promise<Asset[] | undefined>;
  async updateFeaturedAsset(ctx: RequestContext, entity: T, input: EntityAssetInput) => Promise<T>;
  async updateEntityAssets(ctx: RequestContext, entity: T, input: EntityAssetInput) => Promise<T>;
  async create(ctx: RequestContext, input: CreateAssetInput) => Promise<CreateAssetResult>;
  async update(ctx: RequestContext, input: UpdateAssetInput) => Promise<Asset>;
  async delete(ctx: RequestContext, ids: ID[], force: boolean = false, deleteFromAllChannels: boolean = false) => Promise<DeletionResponse>;
  async assignToChannel(ctx: RequestContext, input: AssignAssetsToChannelInput) => Promise<Asset[]>;
  async createFromFileStream(stream: ReadStream) => Promise<CreateAssetResult>;
  async createFromFileStream(stream: Readable, filePath: string) => Promise<CreateAssetResult>;
  async createFromFileStream(stream: ReadStream | Readable, maybeFilePath?: string) => Promise<CreateAssetResult>;
}

Members

constructor

method
type:
(connection: TransactionalConnection, configService: ConfigService, listQueryBuilder: ListQueryBuilder, eventBus: EventBus, tagService: TagService, channelService: ChannelService, roleService: RoleService, customFieldRelationService: CustomFieldRelationService) => AssetService

findOne

method
type:
(ctx: RequestContext, id: ID) => Promise<Asset | undefined>

findAll

method
type:
(ctx: RequestContext, options?: AssetListOptions) => Promise<PaginatedList<Asset>>

getFeaturedAsset

async method
type:
(ctx: RequestContext, entity: T) => Promise<Asset | undefined>

getEntityAssets

async method
type:
(ctx: RequestContext, entity: T) => Promise<Asset[] | undefined>

updateFeaturedAsset

async method
type:
(ctx: RequestContext, entity: T, input: EntityAssetInput) => Promise<T>

updateEntityAssets

async method
type:
(ctx: RequestContext, entity: T, input: EntityAssetInput) => Promise<T>

create

async method
type:
(ctx: RequestContext, input: CreateAssetInput) => Promise<CreateAssetResult>

update

async method
type:
(ctx: RequestContext, input: UpdateAssetInput) => Promise<Asset>

delete

async method
type:
(ctx: RequestContext, ids: ID[], force: boolean = false, deleteFromAllChannels: boolean = false) => Promise<DeletionResponse>

assignToChannel

async method
type:
(ctx: RequestContext, input: AssignAssetsToChannelInput) => Promise<Asset[]>

createFromFileStream

async method
type:
(stream: ReadStream) => Promise<CreateAssetResult>

createFromFileStream

async method
type:
(stream: Readable, filePath: string) => Promise<CreateAssetResult>

createFromFileStream

async method
type:
(stream: ReadStream | Readable, maybeFilePath?: string) => Promise<CreateAssetResult>