export type VerimatrixStreamMapConfig = {posCount: number, keyInterval: number, serverName: string, saveFieldList?: Array | undefined, version: string, streamName: string, resID: string, order: number}; export type VerimatrixStreamMapsConfig = {filename: string, serverName: string, saveFieldList?: Array | undefined, version: string, verimatrixStreamMaps: Array}; export type BuyDRMStreamMapConfig = {contentID: string, serverName: string, keyID: string, saveFieldList?: Array | undefined, mediaID: string, version: string, streamName: string, order: number}; export type BuyDRMStreamMapsConfig = {buyDRMStreamMaps: Array, buyDRMStreamNameMapFile: string, serverName: string, saveFieldList?: Array | undefined, version: string}; export type DRMConfig = {buyDRMProtectMpegDashStreaming: boolean, serverName: string, buyDRMProtectCupertinoStreaming: boolean, version: string, verimatrixCupertinoKeyServerPort: number, verimatrixSmoothKeyServerPort: number, verimatrixStreamMaps: VerimatrixStreamMapsConfig, verimatrixSmoothKeyServerIpAddress: string, licenseType: string, verimatrixCupertinoKeyServerIpAddress: string, buyDRMProtectSmoothStreaming: boolean, buyDRMUserKey: string, inUse: boolean, ezDRMUsername: string, verimatrixProtectSmoothStreaming: boolean, buyDRMStreamMaps: BuyDRMStreamMapsConfig, verimatrixCupertinoVODPerSessionKeys: boolean, saveFieldList?: Array | undefined, ezDRMPassword: string, verimatrixProtectCupertinoStreaming: boolean, cupertinoEncryptionAPIBased: boolean}; export type UpdateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameDrmArgs = {serverName: string, vhostName: string, appName: string, body: DRMConfig}; export type UpdateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameDrmOptions = {baseUrl?: string | undefined, basicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Update DRM * * PUT /v2/servers/{serverName}/vhosts/{vhostName}/applications/{appName}/drm */ export const updateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameDrm = async (args: UpdateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameDrmArgs, options?: UpdateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameDrmOptions) => { const {baseUrl = "http://localhost:8087", fetch: fetchFn = fetch, basicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (basicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${basicAuth.username}:${basicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/servers/${encodeURIComponent(String(args.serverName))}/vhosts/${encodeURIComponent(String(args.vhostName))}/applications/${encodeURIComponent(String(args.appName))}/drm${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };