/* tslint:disable */ /* eslint-disable */ /** * Jellyfin API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 10.8.9 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import * as runtime from '../runtime'; import type { CreateAdminNotificationRequest, NameIdPair, NotificationResultDto, NotificationTypeInfo, NotificationsSummaryDto, } from '../models'; import { CreateAdminNotificationRequestFromJSON, CreateAdminNotificationRequestToJSON, NameIdPairFromJSON, NameIdPairToJSON, NotificationResultDtoFromJSON, NotificationResultDtoToJSON, NotificationTypeInfoFromJSON, NotificationTypeInfoToJSON, NotificationsSummaryDtoFromJSON, NotificationsSummaryDtoToJSON, } from '../models'; export interface CreateAdminNotificationOperationRequest { createAdminNotificationRequest: CreateAdminNotificationRequest; } export interface GetNotificationsRequest { userId: string; } export interface GetNotificationsSummaryRequest { userId: string; } export interface SetReadRequest { userId: string; } export interface SetUnreadRequest { userId: string; } /** * */ export class NotificationsApi extends runtime.BaseAPI { /** * Sends a notification to all admins. */ async createAdminNotificationRaw(requestParameters: CreateAdminNotificationOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.createAdminNotificationRequest === null || requestParameters.createAdminNotificationRequest === undefined) { throw new runtime.RequiredError('createAdminNotificationRequest','Required parameter requestParameters.createAdminNotificationRequest was null or undefined when calling createAdminNotification.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication } const response = await this.request({ path: `/Notifications/Admin`, method: 'POST', headers: headerParameters, query: queryParameters, body: CreateAdminNotificationRequestToJSON(requestParameters.createAdminNotificationRequest), }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Sends a notification to all admins. */ async createAdminNotification(requestParameters: CreateAdminNotificationOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.createAdminNotificationRaw(requestParameters, initOverrides); } /** * Gets notification services. */ async getNotificationServicesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication } const response = await this.request({ path: `/Notifications/Services`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(NameIdPairFromJSON)); } /** * Gets notification services. */ async getNotificationServices(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const response = await this.getNotificationServicesRaw(initOverrides); return await response.value(); } /** * Gets notification types. */ async getNotificationTypesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication } const response = await this.request({ path: `/Notifications/Types`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(NotificationTypeInfoFromJSON)); } /** * Gets notification types. */ async getNotificationTypes(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const response = await this.getNotificationTypesRaw(initOverrides); return await response.value(); } /** * Gets a user\'s notifications. */ async getNotificationsRaw(requestParameters: GetNotificationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.userId === null || requestParameters.userId === undefined) { throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling getNotifications.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication } const response = await this.request({ path: `/Notifications/{userId}`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => NotificationResultDtoFromJSON(jsonValue)); } /** * Gets a user\'s notifications. */ async getNotifications(requestParameters: GetNotificationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getNotificationsRaw(requestParameters, initOverrides); return await response.value(); } /** * Gets a user\'s notification summary. */ async getNotificationsSummaryRaw(requestParameters: GetNotificationsSummaryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.userId === null || requestParameters.userId === undefined) { throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling getNotificationsSummary.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication } const response = await this.request({ path: `/Notifications/{userId}/Summary`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => NotificationsSummaryDtoFromJSON(jsonValue)); } /** * Gets a user\'s notification summary. */ async getNotificationsSummary(requestParameters: GetNotificationsSummaryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getNotificationsSummaryRaw(requestParameters, initOverrides); return await response.value(); } /** * Sets notifications as read. */ async setReadRaw(requestParameters: SetReadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.userId === null || requestParameters.userId === undefined) { throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling setRead.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication } const response = await this.request({ path: `/Notifications/{userId}/Read`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))), method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Sets notifications as read. */ async setRead(requestParameters: SetReadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.setReadRaw(requestParameters, initOverrides); } /** * Sets notifications as unread. */ async setUnreadRaw(requestParameters: SetUnreadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.userId === null || requestParameters.userId === undefined) { throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling setUnread.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // CustomAuthentication authentication } const response = await this.request({ path: `/Notifications/{userId}/Unread`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))), method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Sets notifications as unread. */ async setUnread(requestParameters: SetUnreadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.setUnreadRaw(requestParameters, initOverrides); } }