332 lines
11 KiB
Swift
332 lines
11 KiB
Swift
//
|
|
// NotificationsAPI.swift
|
|
//
|
|
// Generated by swagger-codegen
|
|
// https://github.com/swagger-api/swagger-codegen
|
|
//
|
|
|
|
import Foundation
|
|
import Alamofire
|
|
|
|
|
|
open class NotificationsAPI {
|
|
/**
|
|
Sends a notification to all admins.
|
|
|
|
- parameter body: (body) The notification request.
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func createAdminNotification(body: NotificationsAdminBody, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
createAdminNotificationWithRequestBuilder(body: body).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Sends a notification to all admins.
|
|
- POST /Notifications/Admin
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter body: (body) The notification request.
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func createAdminNotificationWithRequestBuilder(body: NotificationsAdminBody) -> RequestBuilder<Void> {
|
|
let path = "/Notifications/Admin"
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
|
let url = URLComponents(string: URLString)
|
|
|
|
|
|
let requestBuilder: RequestBuilder<Void>.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
|
|
|
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true)
|
|
}
|
|
/**
|
|
Gets notification services.
|
|
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func getNotificationServices(completion: @escaping ((_ data: [NameIdPair]?,_ error: Error?) -> Void)) {
|
|
getNotificationServicesWithRequestBuilder().execute { (response, error) -> Void in
|
|
completion(response?.body, error)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Gets notification services.
|
|
- GET /Notifications/Services
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- examples: [{contentType=application/json, example=[ {
|
|
"Id" : "Id",
|
|
"Name" : "Name"
|
|
}, {
|
|
"Id" : "Id",
|
|
"Name" : "Name"
|
|
} ]}]
|
|
|
|
- returns: RequestBuilder<[NameIdPair]>
|
|
*/
|
|
open class func getNotificationServicesWithRequestBuilder() -> RequestBuilder<[NameIdPair]> {
|
|
let path = "/Notifications/Services"
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
let url = URLComponents(string: URLString)
|
|
|
|
|
|
let requestBuilder: RequestBuilder<[NameIdPair]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()
|
|
|
|
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Gets notification types.
|
|
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func getNotificationTypes(completion: @escaping ((_ data: [NotificationTypeInfo]?,_ error: Error?) -> Void)) {
|
|
getNotificationTypesWithRequestBuilder().execute { (response, error) -> Void in
|
|
completion(response?.body, error)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Gets notification types.
|
|
- GET /Notifications/Types
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- examples: [{contentType=application/json, example=[ {
|
|
"Type" : "Type",
|
|
"Category" : "Category",
|
|
"IsBasedOnUserEvent" : true,
|
|
"Enabled" : true,
|
|
"Name" : "Name"
|
|
}, {
|
|
"Type" : "Type",
|
|
"Category" : "Category",
|
|
"IsBasedOnUserEvent" : true,
|
|
"Enabled" : true,
|
|
"Name" : "Name"
|
|
} ]}]
|
|
|
|
- returns: RequestBuilder<[NotificationTypeInfo]>
|
|
*/
|
|
open class func getNotificationTypesWithRequestBuilder() -> RequestBuilder<[NotificationTypeInfo]> {
|
|
let path = "/Notifications/Types"
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
let url = URLComponents(string: URLString)
|
|
|
|
|
|
let requestBuilder: RequestBuilder<[NotificationTypeInfo]>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()
|
|
|
|
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Gets a user's notifications.
|
|
|
|
- parameter userId: (path)
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func getNotifications(userId: String, completion: @escaping ((_ data: NotificationResultDto?,_ error: Error?) -> Void)) {
|
|
getNotificationsWithRequestBuilder(userId: userId).execute { (response, error) -> Void in
|
|
completion(response?.body, error)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Gets a user's notifications.
|
|
- GET /Notifications/{userId}
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- examples: [{contentType=application/json, example={
|
|
"TotalRecordCount" : 0,
|
|
"Notifications" : [ {
|
|
"Description" : "Description",
|
|
"UserId" : "UserId",
|
|
"Level" : "",
|
|
"Id" : "Id",
|
|
"IsRead" : true,
|
|
"Date" : "2000-01-23T04:56:07.000+00:00",
|
|
"Url" : "Url",
|
|
"Name" : "Name"
|
|
}, {
|
|
"Description" : "Description",
|
|
"UserId" : "UserId",
|
|
"Level" : "",
|
|
"Id" : "Id",
|
|
"IsRead" : true,
|
|
"Date" : "2000-01-23T04:56:07.000+00:00",
|
|
"Url" : "Url",
|
|
"Name" : "Name"
|
|
} ]
|
|
}}]
|
|
- parameter userId: (path)
|
|
|
|
- returns: RequestBuilder<NotificationResultDto>
|
|
*/
|
|
open class func getNotificationsWithRequestBuilder(userId: String) -> RequestBuilder<NotificationResultDto> {
|
|
var path = "/Notifications/{userId}"
|
|
let userIdPreEscape = "\(userId)"
|
|
let userIdPostEscape = userIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{userId}", with: userIdPostEscape, options: .literal, range: nil)
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
let url = URLComponents(string: URLString)
|
|
|
|
|
|
let requestBuilder: RequestBuilder<NotificationResultDto>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()
|
|
|
|
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Gets a user's notification summary.
|
|
|
|
- parameter userId: (path)
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func getNotificationsSummary(userId: String, completion: @escaping ((_ data: NotificationsSummaryDto?,_ error: Error?) -> Void)) {
|
|
getNotificationsSummaryWithRequestBuilder(userId: userId).execute { (response, error) -> Void in
|
|
completion(response?.body, error)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Gets a user's notification summary.
|
|
- GET /Notifications/{userId}/Summary
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- examples: [{contentType=application/json, example={
|
|
"MaxUnreadNotificationLevel" : "",
|
|
"UnreadCount" : 0
|
|
}}]
|
|
- parameter userId: (path)
|
|
|
|
- returns: RequestBuilder<NotificationsSummaryDto>
|
|
*/
|
|
open class func getNotificationsSummaryWithRequestBuilder(userId: String) -> RequestBuilder<NotificationsSummaryDto> {
|
|
var path = "/Notifications/{userId}/Summary"
|
|
let userIdPreEscape = "\(userId)"
|
|
let userIdPostEscape = userIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{userId}", with: userIdPostEscape, options: .literal, range: nil)
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
let url = URLComponents(string: URLString)
|
|
|
|
|
|
let requestBuilder: RequestBuilder<NotificationsSummaryDto>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()
|
|
|
|
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Sets notifications as read.
|
|
|
|
- parameter userId: (path)
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func setRead(userId: String, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
setReadWithRequestBuilder(userId: userId).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Sets notifications as read.
|
|
- POST /Notifications/{userId}/Read
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter userId: (path)
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func setReadWithRequestBuilder(userId: String) -> RequestBuilder<Void> {
|
|
var path = "/Notifications/{userId}/Read"
|
|
let userIdPreEscape = "\(userId)"
|
|
let userIdPostEscape = userIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{userId}", with: userIdPostEscape, options: .literal, range: nil)
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
let url = URLComponents(string: URLString)
|
|
|
|
|
|
let requestBuilder: RequestBuilder<Void>.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
|
|
|
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
/**
|
|
Sets notifications as unread.
|
|
|
|
- parameter userId: (path)
|
|
- parameter completion: completion handler to receive the data and the error objects
|
|
*/
|
|
open class func setUnread(userId: String, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
|
setUnreadWithRequestBuilder(userId: userId).execute { (response, error) -> Void in
|
|
if error == nil {
|
|
completion((), error)
|
|
} else {
|
|
completion(nil, error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
Sets notifications as unread.
|
|
- POST /Notifications/{userId}/Unread
|
|
-
|
|
|
|
- API Key:
|
|
- type: apiKey X-Emby-Authorization
|
|
- name: CustomAuthentication
|
|
- parameter userId: (path)
|
|
|
|
- returns: RequestBuilder<Void>
|
|
*/
|
|
open class func setUnreadWithRequestBuilder(userId: String) -> RequestBuilder<Void> {
|
|
var path = "/Notifications/{userId}/Unread"
|
|
let userIdPreEscape = "\(userId)"
|
|
let userIdPostEscape = userIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
|
path = path.replacingOccurrences(of: "{userId}", with: userIdPostEscape, options: .literal, range: nil)
|
|
let URLString = SwaggerClientAPI.basePath + path
|
|
let parameters: [String:Any]? = nil
|
|
let url = URLComponents(string: URLString)
|
|
|
|
|
|
let requestBuilder: RequestBuilder<Void>.Type = SwaggerClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
|
|
|
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
|
}
|
|
}
|