export type DynamicDayOfWeek = 'Sunday' | 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday' | 'Everyday' | 'Weekday' | 'Weekend'; export type AccessSchedule = {Id: number, UserId: string, DayOfWeek: DynamicDayOfWeek, StartHour: number, EndHour: number}; export type UnratedItem = 'Movie' | 'Trailer' | 'Series' | 'Music' | 'Book' | 'LiveTvChannel' | 'LiveTvProgram' | 'ChannelContent' | 'Other'; export type SyncPlayUserAccessType = 'CreateAndJoinGroups' | 'JoinGroups' | 'None'; export type UserPolicy = {IsAdministrator?: boolean | undefined, IsHidden?: boolean | undefined, IsDisabled?: boolean | undefined, MaxParentalRating?: (number | null) | undefined, BlockedTags?: (Array | null) | undefined, EnableUserPreferenceAccess?: boolean | undefined, AccessSchedules?: (Array | null) | undefined, BlockUnratedItems?: (Array | null) | undefined, EnableRemoteControlOfOtherUsers?: boolean | undefined, EnableSharedDeviceControl?: boolean | undefined, EnableRemoteAccess?: boolean | undefined, EnableLiveTvManagement?: boolean | undefined, EnableLiveTvAccess?: boolean | undefined, EnableMediaPlayback?: boolean | undefined, EnableAudioPlaybackTranscoding?: boolean | undefined, EnableVideoPlaybackTranscoding?: boolean | undefined, EnablePlaybackRemuxing?: boolean | undefined, ForceRemoteSourceTranscoding?: boolean | undefined, EnableContentDeletion?: boolean | undefined, EnableContentDeletionFromFolders?: (Array | null) | undefined, EnableContentDownloading?: boolean | undefined, EnableSyncTranscoding?: boolean | undefined, EnableMediaConversion?: boolean | undefined, EnabledDevices?: (Array | null) | undefined, EnableAllDevices?: boolean | undefined, EnabledChannels?: (Array | null) | undefined, EnableAllChannels?: boolean | undefined, EnabledFolders?: (Array | null) | undefined, EnableAllFolders?: boolean | undefined, InvalidLoginAttemptCount?: number | undefined, LoginAttemptsBeforeLockout?: number | undefined, MaxActiveSessions?: number | undefined, EnablePublicSharing?: boolean | undefined, BlockedMediaFolders?: (Array | null) | undefined, BlockedChannels?: (Array | null) | undefined, RemoteClientBitrateLimit?: number | undefined, AuthenticationProviderId?: (string | null) | undefined, PasswordResetProviderId?: (string | null) | undefined, SyncPlayAccess?: SyncPlayUserAccessType | undefined}; export type CreateApiUsersUserIdPolicyArgs = {userId: string, body: UserPolicy}; export type CreateApiUsersUserIdPolicyOptions = {baseUrl?: string | undefined, CustomAuthentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates a user policy. * * POST /Users/{userId}/Policy */ export const createApiUsersUserIdPolicy = async (args: CreateApiUsersUserIdPolicyArgs, options?: CreateApiUsersUserIdPolicyOptions) => { 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(/\/+$/, '')}/Users/${encodeURIComponent(String(args.userId))}/Policy${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 };