UNPKG

@umbraco/headless-client

Version:
48 lines (47 loc) 1.63 kB
import { Client } from '../../Client'; import { MediaDeliveryChildrenOptions } from '../../RequestOptions/index'; import { Media } from '../../Responses/Media'; /** * MediaDeliveryClient is used to access the Media part of the Content Delivery API. * @public * * @example * The {@link MediaDeliveryClient} must be accessed through {@link Client}. * * ```typescript * import { Client } from '@umbraco/headless-client' * * const client = new Client({ * projectAlias: '<your-project-alias>', * apiKey: '<your-api-key>', * language: '<iso-code>', * }) * * const mediaClient = client.delivery.media * ``` */ export declare class MediaDeliveryClient { private readonly client; /** @internal */ constructor(client: Client); private readonly makeRequest; /** * Fetch all Media at the root. * * @returns a `Promise` that resolves to an array of {@link Media}. */ root<T extends Media>(): Promise<unknown>; /** * Fetch a single Media item by its id. * @param id - GUID id of the Media item. * @returns a `Promise` that resolves to a {@link Media} if found, otherwise `undefined`. */ byId<T extends Media>(id: string): Promise<unknown>; /** * Fetch children for a Media item. * @param id - GUID id of the Media item. * @param options - Request options. See {@link MediaDeliveryChildrenOptions}. * @returns a `Promise` that resolves to a {@link PagedResponse} of {@link Media} if found, otherwise `undefined`. */ children<T extends Media>(id: string, options?: MediaDeliveryChildrenOptions): Promise<unknown>; }