export type HeaderMatchType = 'Equals' | 'Regex' | 'Substring'; export type HttpHeaderInfo = {Name?: (string | null) | undefined, Value?: (string | null) | undefined, Match?: HeaderMatchType | undefined}; export type DeviceIdentification = {FriendlyName?: (string | null) | undefined, ModelNumber?: (string | null) | undefined, SerialNumber?: (string | null) | undefined, ModelName?: (string | null) | undefined, ModelDescription?: (string | null) | undefined, ModelUrl?: (string | null) | undefined, Manufacturer?: (string | null) | undefined, ManufacturerUrl?: (string | null) | undefined, Headers?: (Array | null) | undefined}; export type XmlAttribute = {Name?: (string | null) | undefined, Value?: (string | null) | undefined}; export type DlnaProfileType = 'Audio' | 'Video' | 'Photo'; export type DirectPlayProfile = {Container?: (string | null) | undefined, AudioCodec?: (string | null) | undefined, VideoCodec?: (string | null) | undefined, Type?: DlnaProfileType | undefined}; export type TranscodeSeekInfo = 'Auto' | 'Bytes'; export type EncodingContext = 'Streaming' | 'Static'; export type TranscodingProfile = {Container?: (string | null) | undefined, Type?: DlnaProfileType | undefined, VideoCodec?: (string | null) | undefined, AudioCodec?: (string | null) | undefined, Protocol?: (string | null) | undefined, EstimateContentLength?: boolean | undefined, EnableMpegtsM2TsMode?: boolean | undefined, TranscodeSeekInfo?: TranscodeSeekInfo | undefined, CopyTimestamps?: boolean | undefined, Context?: EncodingContext | undefined, EnableSubtitlesInManifest?: boolean | undefined, MaxAudioChannels?: (string | null) | undefined, MinSegments?: number | undefined, SegmentLength?: number | undefined, BreakOnNonKeyFrames?: boolean | undefined}; export type ProfileConditionType = 'Equals' | 'NotEquals' | 'LessThanEqual' | 'GreaterThanEqual' | 'EqualsAny'; export type ProfileConditionValue = 'AudioChannels' | 'AudioBitrate' | 'AudioProfile' | 'Width' | 'Height' | 'Has64BitOffsets' | 'PacketLength' | 'VideoBitDepth' | 'VideoBitrate' | 'VideoFramerate' | 'VideoLevel' | 'VideoProfile' | 'VideoTimestamp' | 'IsAnamorphic' | 'RefFrames' | 'NumAudioStreams' | 'NumVideoStreams' | 'IsSecondaryAudio' | 'VideoCodecTag' | 'IsAvc' | 'IsInterlaced' | 'AudioSampleRate' | 'AudioBitDepth'; export type ProfileCondition = {Condition?: ProfileConditionType | undefined, Property?: ProfileConditionValue | undefined, Value?: (string | null) | undefined, IsRequired?: boolean | undefined}; export type ContainerProfile = {Type?: DlnaProfileType | undefined, Conditions?: (Array | null) | undefined, Container?: (string | null) | undefined}; export type CodecType = 'Video' | 'VideoAudio' | 'Audio'; export type CodecProfile = {Type?: CodecType | undefined, Conditions?: (Array | null) | undefined, ApplyConditions?: (Array | null) | undefined, Codec?: (string | null) | undefined, Container?: (string | null) | undefined}; export type ResponseProfile = {Container?: (string | null) | undefined, AudioCodec?: (string | null) | undefined, VideoCodec?: (string | null) | undefined, Type?: DlnaProfileType | undefined, OrgPn?: (string | null) | undefined, MimeType?: (string | null) | undefined, Conditions?: (Array | null) | undefined}; export type SubtitleDeliveryMethod = 'Encode' | 'Embed' | 'External' | 'Hls'; export type SubtitleProfile = {Format?: (string | null) | undefined, Method?: SubtitleDeliveryMethod | undefined, DidlMode?: (string | null) | undefined, Language?: (string | null) | undefined, Container?: (string | null) | undefined}; export type DeviceProfile = {Name?: (string | null) | undefined, Id?: (string | null) | undefined, Identification?: DeviceIdentification | undefined, FriendlyName?: (string | null) | undefined, Manufacturer?: (string | null) | undefined, ManufacturerUrl?: (string | null) | undefined, ModelName?: (string | null) | undefined, ModelDescription?: (string | null) | undefined, ModelNumber?: (string | null) | undefined, ModelUrl?: (string | null) | undefined, SerialNumber?: (string | null) | undefined, EnableAlbumArtInDidl?: boolean | undefined, EnableSingleAlbumArtLimit?: boolean | undefined, EnableSingleSubtitleLimit?: boolean | undefined, SupportedMediaTypes?: (string | null) | undefined, UserId?: (string | null) | undefined, AlbumArtPn?: (string | null) | undefined, MaxAlbumArtWidth?: number | undefined, MaxAlbumArtHeight?: number | undefined, MaxIconWidth?: (number | null) | undefined, MaxIconHeight?: (number | null) | undefined, MaxStreamingBitrate?: (number | null) | undefined, MaxStaticBitrate?: (number | null) | undefined, MusicStreamingTranscodingBitrate?: (number | null) | undefined, MaxStaticMusicBitrate?: (number | null) | undefined, SonyAggregationFlags?: (string | null) | undefined, ProtocolInfo?: (string | null) | undefined, TimelineOffsetSeconds?: number | undefined, RequiresPlainVideoItems?: boolean | undefined, RequiresPlainFolders?: boolean | undefined, EnableMSMediaReceiverRegistrar?: boolean | undefined, IgnoreTranscodeByteRangeRequests?: boolean | undefined, XmlRootAttributes?: (Array | null) | undefined, DirectPlayProfiles?: (Array | null) | undefined, TranscodingProfiles?: (Array | null) | undefined, ContainerProfiles?: (Array | null) | undefined, CodecProfiles?: (Array | null) | undefined, ResponseProfiles?: (Array | null) | undefined, SubtitleProfiles?: (Array | null) | undefined}; export type CreateApiDlnaProfilesArgs = {body: DeviceProfile}; export type CreateApiDlnaProfilesOptions = {baseUrl?: string | undefined, CustomAuthentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Creates a profile. * * POST /Dlna/Profiles */ export const createApiDlnaProfiles = async (args: CreateApiDlnaProfilesArgs, options?: CreateApiDlnaProfilesOptions) => { const {baseUrl = "http://localhost", fetch: fetchFn = fetch, CustomAuthentication} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (CustomAuthentication !== undefined) headers.set("X-Emby-Authorization", CustomAuthentication) const url = `${baseUrl.replace(/\/+$/, '')}/Dlna/Profiles${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };