export type StreamConfigurationConfig = {streamType: string, storageDirExists: boolean, keyDir: string, createStorageDir: boolean, liveStreamPacketizer: Array, serverName: string, storageDir: string, saveFieldList?: Array | undefined, version: string, httpRandomizeMediaName: boolean}; export type AdvertisedCandidate = {ipAddress: string, port: number, transport: string, type: string}; export type WebRTCConfig = {udpBindAddress: string, enablePlay: boolean, preferredCodecsAudio: string, preferredCodecsVideo: string, enableQuery: boolean, debugLog: boolean, serverName: string, saveFieldList?: Array | undefined, iceCandidateIpAddresses: string, version: string, enablePublish: boolean, advertisedCandidates: Array, advertisedCandidatesTimestamp: number, enableDataChannels: boolean, enableIceCandidateHarvesting: boolean, enableRemb: boolean, enableSimulcast: boolean, enableTransportCC: boolean, enableWebRTC: boolean, enableWebSocket: boolean, firMessageInterval: number, firMessageScheme: string, idleTimeout: number, nackDelayMs: number, nackEnable: boolean, pliInterval: number, renditionDowngradeDebounceMs: number, renditionDowngradeMarginPercent: number, renditionInitialRendition: string, renditionSelector: string, renditionSwitchRequestKeyframe: boolean, renditionUpgradeMarginPercent: number, rtxCacheSize: number, rtxEnable: boolean, stunServer: string, turnRelay: string, turnRelayPassword: string, turnRelayTrustStore: string, turnRelayTrustStorePassword: string, turnRelayTrustStoreType: string, turnRelayUsername: string, whepBearerToken: string, whipBearerToken: string}; export type ShortObject = {id: string, href: string}; export type TranscoderTemplatesConfig = {vhostName: string, templates: Array, serverName: string, saveFieldList?: Array | undefined, version: string}; export type TranscoderAppConfig = {profileDir: string, licensed: boolean, templates: TranscoderTemplatesConfig, available: boolean, serverName: string, templateDir: string, version: string, createTemplateDir: boolean, licenses: number, liveStreamTranscoder: string, templatesInUse: string, licensesInUse: number, saveFieldList?: Array | undefined}; 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 ModuleConfig = {name: string, serverName: string, description: string, saveFieldList?: Array | undefined, version: string, class: string, order: number}; export type ModulesConfig = {moduleList: Array, serverName: string, saveFieldList?: Array | undefined, version: string}; export type SecurityConfig = {playMaximumConnections: number, publishBlockDuplicateStreamNames: boolean, publishIPWhiteList: string, playAuthenticationMethod: string, serverName: string, clientStreamWriteAccess: string, playIPWhiteList: string, publishRequirePassword: boolean, playIPBlackList: string, version: string, secureTokenVersion: number, publishPasswordFile: string, publishValidEncoders: string, secureTokenQueryParametersPrefix: string, secureTokenUseTEAForRTMP: boolean, publishAuthenticationMethod: string, secureTokenHashAlgorithm: string, publishIPBlackList: string, playRequireSecureConnection: boolean, secureTokenOriginSharedSecret: string, saveFieldList?: Array | undefined, secureTokenIncludeClientIPInHash: boolean, publishRTMPSecureURL: string, secureTokenSharedSecret: string}; export type DVRConfig = {windowDuration: number, dvrMediaCacheEnabled: boolean, dvrEnable: boolean, startRecordingOnStartup: boolean, serverName: string, store: string, version: string, recorders: string, dvrOnlyStreaming: boolean, httpRandomizeMediaName: boolean, licenseType: string, dvrEncryptionSharedSecret: string, inUse: boolean, archiveStrategy: string, storageDir: string, saveFieldList?: Array | undefined}; export type ApplicationConfig = {httpOptimizeFileReads: boolean, captionLiveIngestType: string, streamConfig: StreamConfigurationConfig, serverName: string, description: string, closedCaptionLiveOutput608Enabled: boolean, webRTCConfig: WebRTCConfig, mediaCacheSourceList: Array, repeaterOriginURL: string, clientStreamReadAccess: string, appType: string, pingTimeout: number, vodTimedTextProviders: Array, saveFieldList?: Array | undefined, mediaReaderRandomAccessReaderClass: string, mediaReaderBufferSeekIO: boolean, httpStreamers: Array, httpCORSHeadersEnabled: boolean, closedCaptionLiveOutput708Enabled: boolean, avSyncMethod: string, transcoderConfig: TranscoderAppConfig, clientStreamWriteAccess: string, repeaterQueryString: string, drmConfig: DRMConfig, version: string, modules: ModulesConfig, srtListenerAuthenticationMode: string, maxRTCPWaitTime: number, securityConfig: SecurityConfig, dvrConfig: DVRConfig, applicationTimeout: number, name: string}; export type CreateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameArgs = {serverName: string, vhostName: string, appName: string, body: ApplicationConfig}; export type CreateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameOptions = {baseUrl?: string | undefined, basicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Create app * * POST /v2/servers/{serverName}/vhosts/{vhostName}/applications/{appName} */ export const createApiV2ServersServerNameVhostsVhostNameApplicationsAppName = async (args: CreateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameArgs, options?: CreateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameOptions) => { 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))}${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 };