Merge pull request #5477 from sbwalker/dev
consolidate Service interface and implementation classes
This commit is contained in:
@ -8,6 +8,46 @@ using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve and store <see cref="Alias"/> information.
|
||||
/// </summary>
|
||||
public interface IAliasService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all aliases in the system
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<Alias>> GetAliasesAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Get a single alias
|
||||
/// </summary>
|
||||
/// <param name="aliasId">The <see cref="Oqtane.Models.Alias"/> ID, not to be confused with a <see cref="Oqtane.Models.Site"/> ID</param>
|
||||
/// <returns></returns>
|
||||
Task<Alias> GetAliasAsync(int aliasId);
|
||||
|
||||
/// <summary>
|
||||
/// Save another <see cref="Oqtane.Models.Alias"/> in the DB. It must already contain all the information incl. <see cref="Oqtane.Models.Tenant"/> it belongs to.
|
||||
/// </summary>
|
||||
/// <param name="alias">An <see cref="Oqtane.Models.Alias"/> to add.</param>
|
||||
/// <returns></returns>
|
||||
Task<Alias> AddAliasAsync(Alias alias);
|
||||
|
||||
/// <summary>
|
||||
/// Update an <see cref="Oqtane.Models.Alias"/> in the DB. Make sure the object is correctly filled, as it must update an existing record.
|
||||
/// </summary>
|
||||
/// <param name="alias">The <see cref="Oqtane.Models.Alias"/> to update.</param>
|
||||
/// <returns></returns>
|
||||
Task<Alias> UpdateAliasAsync(Alias alias);
|
||||
|
||||
/// <summary>
|
||||
/// Remove an <see cref="Oqtane.Models.Alias"/> from the DB.
|
||||
/// </summary>
|
||||
/// <param name="aliasId">The Alias ID, not to be confused with a Site ID.</param>
|
||||
/// <returns></returns>
|
||||
Task DeleteAliasAsync(int aliasId);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IAliasService" />
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class AliasService : ServiceBase, IAliasService
|
||||
|
@ -1,13 +1,46 @@
|
||||
using Oqtane.Models;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System;
|
||||
using Oqtane.Documentation;
|
||||
using Oqtane.Shared;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve cookie consent information.
|
||||
/// </summary>
|
||||
public interface ICookieConsentService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get cookie consent bar actioned status
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<bool> IsActionedAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Get cookie consent status
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<bool> CanTrackAsync(bool optOut);
|
||||
|
||||
/// <summary>
|
||||
/// create actioned cookie
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<string> CreateActionedCookieAsync();
|
||||
|
||||
/// <summary>
|
||||
/// create consent cookie
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<string> CreateConsentCookieAsync();
|
||||
|
||||
/// <summary>
|
||||
/// widhdraw consent cookie
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<string> WithdrawConsentCookieAsync();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ICookieConsentService" />
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class CookieConsentService : ServiceBase, ICookieConsentService
|
||||
|
@ -8,6 +8,18 @@ using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve <see cref="Database"/> information.
|
||||
/// </summary>
|
||||
public interface IDatabaseService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of databases
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<Database>> GetDatabasesAsync();
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class DatabaseService : ServiceBase, IDatabaseService
|
||||
{
|
||||
|
@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
@ -10,6 +9,103 @@ using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to get / create / upload / download files.
|
||||
/// </summary>
|
||||
public interface IFileService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all <see cref="File"/>s in the specified Folder
|
||||
/// </summary>
|
||||
/// <param name="folderId">The folder ID</param>
|
||||
/// <returns></returns>
|
||||
Task<List<File>> GetFilesAsync(int folderId);
|
||||
|
||||
/// <summary>
|
||||
/// Get all <see cref="File"/>s in the specified folder.
|
||||
/// </summary>
|
||||
/// <param name="folder">
|
||||
/// The folder path relative to where the files are stored.
|
||||
/// TODO: todoc verify exactly from where the folder path must start
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
Task<List<File>> GetFilesAsync(string folder);
|
||||
|
||||
/// <summary>
|
||||
/// Get one <see cref="File"/>
|
||||
/// </summary>
|
||||
/// <param name="fileId"></param>
|
||||
/// <returns></returns>
|
||||
Task<File> GetFileAsync(int fileId);
|
||||
|
||||
/// <summary>
|
||||
/// Get a <see cref="File"/> based on the <see cref="Folder"/> and file name.
|
||||
/// </summary>
|
||||
/// <param name="folderId">Reference to the <see cref="Folder"/></param>
|
||||
/// <param name="name">name of the file
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
Task<File> GetFileAsync(int folderId, string name);
|
||||
|
||||
/// <summary>
|
||||
/// Add / store a <see cref="File"/> record.
|
||||
/// This does not contain the file contents.
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
Task<File> AddFileAsync(File file);
|
||||
|
||||
/// <summary>
|
||||
/// Update a <see cref="File"/> record.
|
||||
/// Use this for rename a file or change some attributes.
|
||||
/// This does not contain the file contents.
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
Task<File> UpdateFileAsync(File file);
|
||||
|
||||
/// <summary>
|
||||
/// Delete a <see cref="File"/>
|
||||
/// </summary>
|
||||
/// <param name="fileId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteFileAsync(int fileId);
|
||||
|
||||
/// <summary>
|
||||
/// Upload a file from a URL to a <see cref="Folder"/>
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="folderId"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
Task<File> UploadFileAsync(string url, int folderId, string name);
|
||||
|
||||
/// <summary>
|
||||
/// Get / download a file (the body).
|
||||
/// </summary>
|
||||
/// <param name="fileId">Reference to a <see cref="File"/></param>
|
||||
/// <returns>The bytes of the file</returns>
|
||||
Task<byte[]> DownloadFileAsync(int fileId);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve a list of files from a <see cref="Site"/> and <see cref="Folder"/>
|
||||
/// </summary>
|
||||
/// <param name="siteId">Reference to the <see cref="Site"/></param>
|
||||
/// <param name="folderPath">Path of the folder
|
||||
/// TODO: todoc verify exactly from where the folder path must start
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
Task<List<File>> GetFilesAsync(int siteId, string folderPath);
|
||||
|
||||
/// <summary>
|
||||
/// Unzips the contents of a zip file
|
||||
/// </summary>
|
||||
/// <param name="fileId">Reference to the <see cref="File"/></param>
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
Task UnzipFileAsync(int fileId);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class FileService : ServiceBase, IFileService
|
||||
{
|
||||
|
@ -9,6 +9,58 @@ using Oqtane.Documentation;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to get / create / modify <see cref="Folder"/> objects.
|
||||
/// </summary>
|
||||
public interface IFolderService
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieve root folders of a <see cref="Site"/>
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Folder>> GetFoldersAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the information of one <see cref="Folder"/>
|
||||
/// </summary>
|
||||
/// <param name="folderId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Folder> GetFolderAsync(int folderId);
|
||||
|
||||
/// <summary>
|
||||
/// Create one Folder using a <see cref="Folder"/> object.
|
||||
/// </summary>
|
||||
/// <param name="folder"></param>
|
||||
/// <returns></returns>
|
||||
Task<Folder> AddFolderAsync(Folder folder);
|
||||
|
||||
/// <summary>
|
||||
/// Update the information about a <see cref="Folder"/>
|
||||
/// Use this to rename the folder etc.
|
||||
/// </summary>
|
||||
/// <param name="folder"></param>
|
||||
/// <returns></returns>
|
||||
Task<Folder> UpdateFolderAsync(Folder folder);
|
||||
|
||||
/// <summary>
|
||||
/// Delete a <see cref="Folder"/>
|
||||
/// </summary>
|
||||
/// <param name="folderId">Reference to a <see cref="Folder"/></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteFolderAsync(int folderId);
|
||||
|
||||
/// <summary>
|
||||
/// Get a <see cref="Folder"/> of a <see cref="Site"/> based on the path.
|
||||
/// </summary>
|
||||
/// <param name="siteId">Reference to the <see cref="Site"/></param>
|
||||
/// <param name="folderPath">Path of the folder
|
||||
/// TODO: todoc verify exactly from where the folder path must start
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
Task<Folder> GetFolderAsync(int siteId, [NotNull] string folderPath);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class FolderService : ServiceBase, IFolderService
|
||||
{
|
||||
|
@ -10,6 +10,38 @@ using System.Linq;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage (install master database / upgrade version / etc.) the installation
|
||||
/// </summary>
|
||||
public interface IInstallationService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a status/message object with the current installation state
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<Installation> IsInstalled();
|
||||
|
||||
/// <summary>
|
||||
/// Starts the installation process
|
||||
/// </summary>
|
||||
/// <param name="config">connectionString, database type, alias etc.</param>
|
||||
/// <returns>internal status/message object</returns>
|
||||
Task<Installation> Install(InstallConfig config);
|
||||
|
||||
/// <summary>
|
||||
/// Starts the upgrade process
|
||||
/// </summary>
|
||||
/// <param name="backup">indicates if files should be backed up during upgrade</param>
|
||||
/// <returns>internal status/message object</returns>
|
||||
Task<Installation> Upgrade(bool backup);
|
||||
|
||||
/// <summary>
|
||||
/// Restarts the installation
|
||||
/// </summary>
|
||||
/// <returns>internal status/message object</returns>
|
||||
Task RestartAsync();
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class InstallationService : ServiceBase, IInstallationService
|
||||
{
|
||||
|
@ -1,47 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve and store <see cref="Alias"/> information.
|
||||
/// </summary>
|
||||
public interface IAliasService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all aliases in the system
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<Alias>> GetAliasesAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Get a single alias
|
||||
/// </summary>
|
||||
/// <param name="aliasId">The <see cref="Oqtane.Models.Alias"/> ID, not to be confused with a <see cref="Oqtane.Models.Site"/> ID</param>
|
||||
/// <returns></returns>
|
||||
Task<Alias> GetAliasAsync(int aliasId);
|
||||
|
||||
/// <summary>
|
||||
/// Save another <see cref="Oqtane.Models.Alias"/> in the DB. It must already contain all the information incl. <see cref="Oqtane.Models.Tenant"/> it belongs to.
|
||||
/// </summary>
|
||||
/// <param name="alias">An <see cref="Oqtane.Models.Alias"/> to add.</param>
|
||||
/// <returns></returns>
|
||||
Task<Alias> AddAliasAsync(Alias alias);
|
||||
|
||||
/// <summary>
|
||||
/// Update an <see cref="Oqtane.Models.Alias"/> in the DB. Make sure the object is correctly filled, as it must update an existing record.
|
||||
/// </summary>
|
||||
/// <param name="alias">The <see cref="Oqtane.Models.Alias"/> to update.</param>
|
||||
/// <returns></returns>
|
||||
Task<Alias> UpdateAliasAsync(Alias alias);
|
||||
|
||||
/// <summary>
|
||||
/// Remove an <see cref="Oqtane.Models.Alias"/> from the DB.
|
||||
/// </summary>
|
||||
/// <param name="aliasId">The Alias ID, not to be confused with a Site ID.</param>
|
||||
/// <returns></returns>
|
||||
Task DeleteAliasAsync(int aliasId);
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve cookie consent information.
|
||||
/// </summary>
|
||||
public interface ICookieConsentService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get cookie consent bar actioned status
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<bool> IsActionedAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Get cookie consent status
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<bool> CanTrackAsync(bool optOut);
|
||||
|
||||
/// <summary>
|
||||
/// create actioned cookie
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<string> CreateActionedCookieAsync();
|
||||
|
||||
/// <summary>
|
||||
/// create consent cookie
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<string> CreateConsentCookieAsync();
|
||||
|
||||
/// <summary>
|
||||
/// widhdraw consent cookie
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<string> WithdrawConsentCookieAsync();
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve <see cref="Database"/> information.
|
||||
/// </summary>
|
||||
public interface IDatabaseService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of databases
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<Database>> GetDatabasesAsync();
|
||||
}
|
||||
}
|
@ -1,104 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to get / create / upload / download files.
|
||||
/// </summary>
|
||||
public interface IFileService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all <see cref="File"/>s in the specified Folder
|
||||
/// </summary>
|
||||
/// <param name="folderId">The folder ID</param>
|
||||
/// <returns></returns>
|
||||
Task<List<File>> GetFilesAsync(int folderId);
|
||||
|
||||
/// <summary>
|
||||
/// Get all <see cref="File"/>s in the specified folder.
|
||||
/// </summary>
|
||||
/// <param name="folder">
|
||||
/// The folder path relative to where the files are stored.
|
||||
/// TODO: todoc verify exactly from where the folder path must start
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
Task<List<File>> GetFilesAsync(string folder);
|
||||
|
||||
/// <summary>
|
||||
/// Get one <see cref="File"/>
|
||||
/// </summary>
|
||||
/// <param name="fileId"></param>
|
||||
/// <returns></returns>
|
||||
Task<File> GetFileAsync(int fileId);
|
||||
|
||||
/// <summary>
|
||||
/// Get a <see cref="File"/> based on the <see cref="Folder"/> and file name.
|
||||
/// </summary>
|
||||
/// <param name="folderId">Reference to the <see cref="Folder"/></param>
|
||||
/// <param name="name">name of the file
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
Task<File> GetFileAsync(int folderId, string name);
|
||||
|
||||
/// <summary>
|
||||
/// Add / store a <see cref="File"/> record.
|
||||
/// This does not contain the file contents.
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
Task<File> AddFileAsync(File file);
|
||||
|
||||
/// <summary>
|
||||
/// Update a <see cref="File"/> record.
|
||||
/// Use this for rename a file or change some attributes.
|
||||
/// This does not contain the file contents.
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
Task<File> UpdateFileAsync(File file);
|
||||
|
||||
/// <summary>
|
||||
/// Delete a <see cref="File"/>
|
||||
/// </summary>
|
||||
/// <param name="fileId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteFileAsync(int fileId);
|
||||
|
||||
/// <summary>
|
||||
/// Upload a file from a URL to a <see cref="Folder"/>
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="folderId"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
Task<File> UploadFileAsync(string url, int folderId, string name);
|
||||
|
||||
/// <summary>
|
||||
/// Get / download a file (the body).
|
||||
/// </summary>
|
||||
/// <param name="fileId">Reference to a <see cref="File"/></param>
|
||||
/// <returns>The bytes of the file</returns>
|
||||
Task<byte[]> DownloadFileAsync(int fileId);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve a list of files from a <see cref="Site"/> and <see cref="Folder"/>
|
||||
/// </summary>
|
||||
/// <param name="siteId">Reference to the <see cref="Site"/></param>
|
||||
/// <param name="folderPath">Path of the folder
|
||||
/// TODO: todoc verify exactly from where the folder path must start
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
Task<List<File>> GetFilesAsync(int siteId, string folderPath);
|
||||
|
||||
/// <summary>
|
||||
/// Unzips the contents of a zip file
|
||||
/// </summary>
|
||||
/// <param name="fileId">Reference to the <see cref="File"/></param>
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
Task UnzipFileAsync(int fileId);
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to get / create / modify <see cref="Folder"/> objects.
|
||||
/// </summary>
|
||||
public interface IFolderService
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieve root folders of a <see cref="Site"/>
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Folder>> GetFoldersAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the information of one <see cref="Folder"/>
|
||||
/// </summary>
|
||||
/// <param name="folderId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Folder> GetFolderAsync(int folderId);
|
||||
|
||||
/// <summary>
|
||||
/// Create one Folder using a <see cref="Folder"/> object.
|
||||
/// </summary>
|
||||
/// <param name="folder"></param>
|
||||
/// <returns></returns>
|
||||
Task<Folder> AddFolderAsync(Folder folder);
|
||||
|
||||
/// <summary>
|
||||
/// Update the information about a <see cref="Folder"/>
|
||||
/// Use this to rename the folder etc.
|
||||
/// </summary>
|
||||
/// <param name="folder"></param>
|
||||
/// <returns></returns>
|
||||
Task<Folder> UpdateFolderAsync(Folder folder);
|
||||
|
||||
/// <summary>
|
||||
/// Delete a <see cref="Folder"/>
|
||||
/// </summary>
|
||||
/// <param name="folderId">Reference to a <see cref="Folder"/></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteFolderAsync(int folderId);
|
||||
|
||||
/// <summary>
|
||||
/// Get a <see cref="Folder"/> of a <see cref="Site"/> based on the path.
|
||||
/// </summary>
|
||||
/// <param name="siteId">Reference to the <see cref="Site"/></param>
|
||||
/// <param name="folderPath">Path of the folder
|
||||
/// TODO: todoc verify exactly from where the folder path must start
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
Task<Folder> GetFolderAsync(int siteId, [NotNull]string folderPath);
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Threading.Tasks;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Service to manage (install master database / upgrade version / etc.) the installation
|
||||
/// </summary>
|
||||
public interface IInstallationService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a status/message object with the current installation state
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<Installation> IsInstalled();
|
||||
|
||||
/// <summary>
|
||||
/// Starts the installation process
|
||||
/// </summary>
|
||||
/// <param name="config">connectionString, database type, alias etc.</param>
|
||||
/// <returns>internal status/message object</returns>
|
||||
Task<Installation> Install(InstallConfig config);
|
||||
|
||||
/// <summary>
|
||||
/// Starts the upgrade process
|
||||
/// </summary>
|
||||
/// <param name="backup">indicates if files should be backed up during upgrade</param>
|
||||
/// <returns>internal status/message object</returns>
|
||||
Task<Installation> Upgrade(bool backup);
|
||||
|
||||
/// <summary>
|
||||
/// Restarts the installation
|
||||
/// </summary>
|
||||
/// <returns>internal status/message object</returns>
|
||||
Task RestartAsync();
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to read the job schedule log
|
||||
/// </summary>
|
||||
public interface IJobLogService
|
||||
{
|
||||
/// <summary>
|
||||
/// Return a list of <see cref="JobLog"/> entries
|
||||
/// </summary>
|
||||
/// <param name="jobId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<JobLog>> GetJobLogsAsync(int jobId);
|
||||
|
||||
/// <summary>
|
||||
/// Return a <see cref="JobLog"/> entry for the given Id
|
||||
/// </summary>
|
||||
/// <param name="jobLogId"></param>
|
||||
/// <returns></returns>
|
||||
Task<JobLog> GetJobLogAsync(int jobLogId);
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Service to manage jobs (<see cref="Job"/>)
|
||||
/// </summary>
|
||||
public interface IJobService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of all jobs
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<Job>> GetJobsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Return a specific job
|
||||
/// </summary>
|
||||
/// <param name="jobId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Job> GetJobAsync(int jobId);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new job
|
||||
/// </summary>
|
||||
/// <param name="job"></param>
|
||||
/// <returns></returns>
|
||||
Task<Job> AddJobAsync(Job job);
|
||||
|
||||
/// <summary>
|
||||
/// Updates an existing job
|
||||
/// </summary>
|
||||
/// <param name="job"></param>
|
||||
/// <returns></returns>
|
||||
Task<Job> UpdateJobAsync(Job job);
|
||||
|
||||
/// <summary>
|
||||
/// Delete an existing job
|
||||
/// </summary>
|
||||
/// <param name="jobId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteJobAsync(int jobId);
|
||||
|
||||
/// <summary>
|
||||
/// Starts the given job
|
||||
/// </summary>
|
||||
/// <param name="jobId"></param>
|
||||
/// <returns></returns>
|
||||
Task StartJobAsync(int jobId);
|
||||
|
||||
/// <summary>
|
||||
/// Stops the given job
|
||||
/// </summary>
|
||||
/// <param name="jobId"></param>
|
||||
/// <returns></returns>
|
||||
Task StopJobAsync(int jobId);
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Service to manage <see cref="Language"/> entries
|
||||
/// </summary>
|
||||
public interface ILanguageService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of all available languages for the given <see cref="Site"/>
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Language>> GetLanguagesAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of all available languages for the given <see cref="Site" /> and package
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="packageName"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Language>> GetLanguagesAsync(int siteId, string packageName);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the given language
|
||||
/// </summary>
|
||||
/// <param name="languageId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Language> GetLanguageAsync(int languageId);
|
||||
|
||||
/// <summary>
|
||||
/// Adds the given language
|
||||
/// </summary>
|
||||
/// <param name="language"></param>
|
||||
/// <returns></returns>
|
||||
Task<Language> AddLanguageAsync(Language language);
|
||||
|
||||
/// <summary>
|
||||
/// Edits the given language
|
||||
/// </summary>
|
||||
/// <param name="language"></param>
|
||||
/// <returns></returns>
|
||||
Task EditLanguageAsync(Language language);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the given language
|
||||
/// </summary>
|
||||
/// <param name="languageId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteLanguageAsync(int languageId);
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to set localization cookie
|
||||
/// </summary>
|
||||
public interface ILocalizationCookieService
|
||||
{
|
||||
/// <summary>
|
||||
/// Set the localization cookie
|
||||
/// </summary>
|
||||
/// <param name="culture"></param>
|
||||
/// <returns></returns>
|
||||
Task SetLocalizationCookieAsync(string culture);
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve localizations (<see cref="Culture"/>)
|
||||
/// </summary>
|
||||
public interface ILocalizationService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a collection of supported cultures
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<Culture>> GetCulturesAsync(bool installed);
|
||||
}
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Oqtane.Enums;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve and store <see cref="Log"/> entries
|
||||
/// </summary>
|
||||
public interface ILogService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of log entires for the given params
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="level"></param>
|
||||
/// <param name="function"></param>
|
||||
/// <param name="rows"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Log>> GetLogsAsync(int siteId, string level, string function, int rows);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific log entry for the given id
|
||||
/// </summary>
|
||||
/// <param name="logId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Log> GetLogAsync(int logId);
|
||||
|
||||
/// <summary>
|
||||
/// Clear the entire logs of the given site.
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteLogsAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new log entry
|
||||
/// </summary>
|
||||
/// <param name="pageId"></param>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="category"></param>
|
||||
/// <param name="feature"></param>
|
||||
/// <param name="function"></param>
|
||||
/// <param name="level"></param>
|
||||
/// <param name="exception"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
Task Log(int? pageId, int? moduleId, int? userId, string category, string feature, LogFunction function, LogLevel level, Exception exception, string message, params object[] args);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new log entry
|
||||
/// </summary>
|
||||
/// <param name="alias"></param>
|
||||
/// <param name="pageId"></param>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="category"></param>
|
||||
/// <param name="feature"></param>
|
||||
/// <param name="function"></param>
|
||||
/// <param name="level"></param>
|
||||
/// <param name="exception"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
Task Log(Alias alias, int? pageId, int? moduleId, int? userId, string category, string feature, LogFunction function, LogLevel level, Exception exception, string message, params object[] args);
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Service to manage a <see cref="ModuleDefinition"/>
|
||||
/// </summary>
|
||||
public interface IModuleDefinitionService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of module definitions for the given site
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<ModuleDefinition>> GetModuleDefinitionsAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific module definition
|
||||
/// </summary>
|
||||
/// <param name="moduleDefinitionId"></param>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<ModuleDefinition> GetModuleDefinitionAsync(int moduleDefinitionId, int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a existing module definition
|
||||
/// </summary>
|
||||
/// <param name="moduleDefinition"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateModuleDefinitionAsync(ModuleDefinition moduleDefinition);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a module definition
|
||||
/// </summary>
|
||||
/// <param name="moduleDefinitionId"></param>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteModuleDefinitionAsync(int moduleDefinitionId, int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new module definition
|
||||
/// </summary>
|
||||
/// <param name="moduleDefinition"></param>
|
||||
/// <returns></returns>
|
||||
Task<ModuleDefinition> CreateModuleDefinitionAsync(ModuleDefinition moduleDefinition);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of module definition templates
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<Template>> GetModuleDefinitionTemplatesAsync();
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve and store modules (<see cref="Module"/>)
|
||||
/// </summary>
|
||||
public interface IModuleService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of modules for the given site
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Module>> GetModulesAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific module
|
||||
/// </summary>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Module> GetModuleAsync(int moduleId);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new module
|
||||
/// </summary>
|
||||
/// <param name="module"></param>
|
||||
/// <returns></returns>
|
||||
Task<Module> AddModuleAsync(Module module);
|
||||
|
||||
/// <summary>
|
||||
/// Updates an existing module
|
||||
/// </summary>
|
||||
/// <param name="module"></param>
|
||||
/// <returns></returns>
|
||||
Task<Module> UpdateModuleAsync(Module module);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a module
|
||||
/// </summary>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteModuleAsync(int moduleId);
|
||||
|
||||
/// <summary>
|
||||
/// Imports a module
|
||||
/// </summary>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <param name="content">module in JSON format</param>
|
||||
/// <returns></returns>
|
||||
Task<bool> ImportModuleAsync(int moduleId, int pageId, string content);
|
||||
|
||||
/// <summary>
|
||||
/// Exports a given module
|
||||
/// </summary>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <param name="pageId"></param>
|
||||
/// <returns>module content in JSON format</returns>
|
||||
Task<string> ExportModuleAsync(int moduleId, int pageId);
|
||||
|
||||
/// <summary>
|
||||
/// Exports a given module
|
||||
/// </summary>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <param name="pageId"></param>
|
||||
/// <param name="folderId"></param>
|
||||
/// <param name="filename"></param>
|
||||
/// <returns>file id</returns>
|
||||
Task<int> ExportModuleAsync(int moduleId, int pageId, int folderId, string filename);
|
||||
}
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to store and retrieve notifications (<see cref="Notification"/>)
|
||||
/// </summary>
|
||||
public interface INotificationService
|
||||
{
|
||||
/// <summary>
|
||||
/// Return a list of notifications
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="direction"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Notification>> GetNotificationsAsync(int siteId, string direction, int userId);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="direction"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="count"></param>
|
||||
/// <param name="isRead"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Notification>> GetNotificationsAsync(int siteId, string direction, int userId, int count, bool isRead);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="direction"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="isRead"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> GetNotificationCountAsync(int siteId, string direction, int userId, bool isRead);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific notifications
|
||||
/// </summary>
|
||||
/// <param name="notificationId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Notification> GetNotificationAsync(int notificationId);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new notification
|
||||
/// </summary>
|
||||
/// <param name="notification"></param>
|
||||
/// <returns></returns>
|
||||
Task<Notification> AddNotificationAsync(Notification notification);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a existing notification
|
||||
/// </summary>
|
||||
/// <param name="notification"></param>
|
||||
/// <returns></returns>
|
||||
Task<Notification> UpdateNotificationAsync(Notification notification);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a notification
|
||||
/// </summary>
|
||||
/// <param name="notificationId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteNotificationAsync(int notificationId);
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage cache
|
||||
/// </summary>
|
||||
public interface IOutputCacheService
|
||||
{
|
||||
/// <summary>
|
||||
/// Evicts the output cache for a specific tag
|
||||
/// </summary>
|
||||
/// <param name="tag"></param>
|
||||
/// <returns></returns>
|
||||
Task EvictByTag(string tag);
|
||||
}
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Service to manage packages (<see cref="Package"/>)
|
||||
/// </summary>
|
||||
public interface IPackageService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of packages matching the given parameters
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Package>> GetPackagesAsync(string type);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of packages matching the given parameters
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="search"></param>
|
||||
/// <param name="price"></param>
|
||||
/// <param name="package"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Package>> GetPackagesAsync(string type, string search, string price, string package);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of packages matching the given parameters
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="search"></param>
|
||||
/// <param name="price"></param>
|
||||
/// <param name="package"></param>
|
||||
/// <param name="sort"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Package>> GetPackagesAsync(string type, string search, string price, string package, string sort);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of packages based on installationid
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<Package>> GetPackageUpdatesAsync(string type);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific package
|
||||
/// </summary>
|
||||
/// <param name="packageId"></param>
|
||||
/// <param name="version"></param>
|
||||
/// <returns></returns>
|
||||
Task<Package> GetPackageAsync(string packageId, string version, bool download);
|
||||
|
||||
/// <summary>
|
||||
/// Downloads a specific package as .nupkg file
|
||||
/// </summary>
|
||||
/// <param name="packageId"></param>
|
||||
/// <param name="version"></param>
|
||||
/// <param name="folder"></param>
|
||||
/// <returns></returns>
|
||||
Task DownloadPackageAsync(string packageId, string version);
|
||||
|
||||
/// <summary>
|
||||
/// Installs all packages located in //TODO: 2dm where?
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task InstallPackagesAsync();
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to store and retrieve a <see cref="PageModule"/>
|
||||
/// </summary>
|
||||
public interface IPageModuleService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific page module
|
||||
/// </summary>
|
||||
/// <param name="pageModuleId"></param>
|
||||
/// <returns></returns>
|
||||
Task<PageModule> GetPageModuleAsync(int pageModuleId);
|
||||
|
||||
/// <summary>
|
||||
/// Return a specific page module
|
||||
/// </summary>
|
||||
/// <param name="pageId"></param>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <returns></returns>
|
||||
Task<PageModule> GetPageModuleAsync(int pageId, int moduleId);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new page module
|
||||
/// </summary>
|
||||
/// <param name="pageModule"></param>
|
||||
/// <returns></returns>
|
||||
Task<PageModule> AddPageModuleAsync(PageModule pageModule);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a existing page module
|
||||
/// </summary>
|
||||
/// <param name="pageModule"></param>
|
||||
/// <returns></returns>
|
||||
Task<PageModule> UpdatePageModuleAsync(PageModule pageModule);
|
||||
|
||||
/// <summary>
|
||||
/// Updates order of all page modules in the given pane
|
||||
/// </summary>
|
||||
/// <param name="pageId"></param>
|
||||
/// <param name="pane"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdatePageModuleOrderAsync(int pageId, string pane);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a page module
|
||||
/// </summary>
|
||||
/// <param name="pageModuleId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeletePageModuleAsync(int pageModuleId);
|
||||
}
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Services to store and retrieve a <see cref="Page"/>
|
||||
/// </summary>
|
||||
public interface IPageService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of pages
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Page>> GetPagesAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific page
|
||||
/// </summary>
|
||||
/// <param name="pageId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Page> GetPageAsync(int pageId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific page by its defined path
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Page> GetPageAsync(string path, int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new page
|
||||
/// </summary>
|
||||
/// <param name="page"></param>
|
||||
/// <returns></returns>
|
||||
Task<Page> AddPageAsync(Page page);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new page
|
||||
/// </summary>
|
||||
/// <param name="page"></param>
|
||||
/// <returns></returns>
|
||||
Task<Page> AddPageAsync(int pageId, int userId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a existing page
|
||||
/// </summary>
|
||||
/// <param name="page"></param>
|
||||
/// <returns></returns>
|
||||
Task<Page> UpdatePageAsync(Page page);
|
||||
|
||||
/// <summary>
|
||||
/// Updates order of all page modules in the given parent
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="pageId"></param>
|
||||
/// <param name="parentId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdatePageOrderAsync(int siteId, int pageId, int? parentId);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a page
|
||||
/// </summary>
|
||||
/// <param name="pageId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeletePageAsync(int pageId);
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to store and retrieve <see cref="Profile"/> entries
|
||||
/// </summary>
|
||||
public interface IProfileService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of profile entries
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Profile>> GetProfilesAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific profile entry
|
||||
/// </summary>
|
||||
/// <param name="profileId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Profile> GetProfileAsync(int profileId);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new profile entry
|
||||
/// </summary>
|
||||
/// <param name="profile"></param>
|
||||
/// <returns></returns>
|
||||
Task<Profile> AddProfileAsync(Profile profile);
|
||||
|
||||
/// <summary>
|
||||
/// Updates an existing profile entry
|
||||
/// </summary>
|
||||
/// <param name="profile"></param>
|
||||
/// <returns></returns>
|
||||
Task<Profile> UpdateProfileAsync(Profile profile);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a profile entry
|
||||
/// </summary>
|
||||
/// <param name="profileId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteProfileAsync(int profileId);
|
||||
}
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage <see cref="Role"/>s on a <see cref="Site"/>
|
||||
/// </summary>
|
||||
public interface IRoleService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all <see cref="Role"/>s of this <see cref="Site"/>.
|
||||
///
|
||||
/// Will exclude global roles which are for all sites. To get those as well, use the overload <see cref="GetRolesAsync(int, bool)"/>
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID-reference of a <see cref="Site"/></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Role>> GetRolesAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Get roles of the <see cref="Site"/> and optionally include global Roles.
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID-reference to a <see cref="Site"/></param>
|
||||
/// <param name="includeGlobalRoles">True if it should also include global roles. False will return the same data as just calling <see cref="GetRolesAsync(int)"/></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Role>> GetRolesAsync(int siteId, bool includeGlobalRoles);
|
||||
|
||||
/// <summary>
|
||||
/// Get one specific <see cref="Role"/>
|
||||
/// </summary>
|
||||
/// <param name="roleId">ID-reference of a <see cref="Role"/></param>
|
||||
/// <returns></returns>
|
||||
Task<Role> GetRoleAsync(int roleId);
|
||||
|
||||
/// <summary>
|
||||
/// Add / save a new <see cref="Role"/> to the database.
|
||||
/// </summary>
|
||||
/// <param name="role"></param>
|
||||
/// <returns></returns>
|
||||
Task<Role> AddRoleAsync(Role role);
|
||||
|
||||
/// <summary>
|
||||
/// Update a <see cref="Role"/> in the database.
|
||||
/// </summary>
|
||||
/// <param name="role"></param>
|
||||
/// <returns></returns>
|
||||
Task<Role> UpdateRoleAsync(Role role);
|
||||
|
||||
/// <summary>
|
||||
/// Delete / mark-as-deleted a <see cref="Role"/> in the database.
|
||||
/// </summary>
|
||||
/// <param name="roleId">ID-reference of a <see cref="Role"/></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteRoleAsync(int roleId);
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Oqtane.Documentation;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
[PrivateApi("Mark SearchResults classes as private, since it's not very useful in the public docs")]
|
||||
public interface ISearchResultsService
|
||||
{
|
||||
Task<SearchResults> GetSearchResultsAsync(SearchQuery searchQuery);
|
||||
}
|
||||
}
|
@ -1,269 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage <see cref="Setting"/>s
|
||||
/// </summary>
|
||||
public interface ISettingService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all tenant settings
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetTenantSettingsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Updates a tenant setting
|
||||
/// </summary>
|
||||
/// <param name="tenantSettings"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateTenantSettingsAsync(Dictionary<string, string> tenantSettings);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all site settings for the given site
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetSiteSettingsAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a site setting
|
||||
/// </summary>
|
||||
/// <param name="siteSettings"></param>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateSiteSettingsAsync(Dictionary<string, string> siteSettings, int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Clears site option cache
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task ClearSiteSettingsCacheAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all page settings for the given page
|
||||
/// </summary>
|
||||
/// <param name="pageId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetPageSettingsAsync(int pageId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a page setting
|
||||
/// </summary>
|
||||
/// <param name="pageSettings"></param>
|
||||
/// <param name="pageId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdatePageSettingsAsync(Dictionary<string, string> pageSettings, int pageId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all page module settings for the given page module
|
||||
/// </summary>
|
||||
/// <param name="pageModuleId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetPageModuleSettingsAsync(int pageModuleId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a page module setting
|
||||
/// </summary>
|
||||
/// <param name="pageModuleSettings"></param>
|
||||
/// <param name="pageModuleId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdatePageModuleSettingsAsync(Dictionary<string, string> pageModuleSettings, int pageModuleId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all module settings for the given module
|
||||
/// </summary>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetModuleSettingsAsync(int moduleId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a module setting
|
||||
/// </summary>
|
||||
/// <param name="moduleSettings"></param>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateModuleSettingsAsync(Dictionary<string, string> moduleSettings, int moduleId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all module settings for the given module
|
||||
/// </summary>
|
||||
/// <param name="moduleDefinitionId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetModuleDefinitionSettingsAsync(int moduleDefinitionId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a module setting
|
||||
/// </summary>
|
||||
/// <param name="moduleDefinitionSettings"></param>
|
||||
/// <param name="moduleDefinitionId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateModuleDefinitionSettingsAsync(Dictionary<string, string> moduleDefinitionSettings, int moduleDefinitionId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all user settings for the given user
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetUserSettingsAsync(int userId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a user setting
|
||||
/// </summary>
|
||||
/// <param name="userSettings"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateUserSettingsAsync(Dictionary<string, string> userSettings, int userId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all folder settings for the given folder
|
||||
/// </summary>
|
||||
/// <param name="folderId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetFolderSettingsAsync(int folderId);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates a folder setting
|
||||
/// </summary>
|
||||
/// <param name="folderSettings"></param>
|
||||
/// <param name="folderId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateFolderSettingsAsync(Dictionary<string, string> folderSettings, int folderId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all tenant settings
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetHostSettingsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Updates a host setting
|
||||
/// </summary>
|
||||
/// <param name="hostSettings"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateHostSettingsAsync(Dictionary<string, string> hostSettings);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all settings for the given visitor
|
||||
/// </summary>
|
||||
/// <param name="visitorId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetVisitorSettingsAsync(int visitorId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a visitor setting
|
||||
/// </summary>
|
||||
/// <param name="visitorSettings"></param>
|
||||
/// <param name="visitorId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateVisitorSettingsAsync(Dictionary<string, string> visitorSettings, int visitorId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all settings for the given entityName
|
||||
/// </summary>
|
||||
/// <param name="pageId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetSettingsAsync(string entityName, int entityId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates settings for a given entityName and Id
|
||||
/// </summary>
|
||||
/// <param name="settings"></param>
|
||||
/// <param name="entityName"></param>
|
||||
/// <param name="entityId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateSettingsAsync(Dictionary<string, string> settings, string entityName, int entityId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates setting for a given entityName and Id
|
||||
/// </summary>
|
||||
/// <param name="entityName"></param>
|
||||
/// <param name="entityId"></param>
|
||||
/// <param name="settingName"></param>
|
||||
/// <param name="settingValue"></param>
|
||||
/// <param name="isPrivate"></param>
|
||||
/// <returns></returns>
|
||||
Task AddOrUpdateSettingAsync(string entityName, int entityId, string settingName, string settingValue, bool isPrivate);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific setting
|
||||
/// </summary>
|
||||
/// <param name="entityName"></param>
|
||||
/// <param name="entityId"></param>
|
||||
/// <param name="settingName"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteSettingAsync(string entityName, int entityId, string settingName);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific setting
|
||||
/// </summary>
|
||||
/// <param name="entityName"></param>
|
||||
/// <param name="entityId"></param>
|
||||
/// <param name="settingName"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Setting>> GetSettingsAsync(string entityName, int entityId, string settingName);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific setting
|
||||
/// </summary>
|
||||
/// <param name="settingId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Setting> GetSettingAsync(string entityName, int settingId);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new setting
|
||||
/// </summary>
|
||||
/// <param name="setting"></param>
|
||||
/// <returns></returns>
|
||||
Task<Setting> AddSettingAsync(Setting setting);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a existing setting
|
||||
/// </summary>
|
||||
/// <param name="setting"></param>
|
||||
/// <returns></returns>
|
||||
Task<Setting> UpdateSettingAsync(Setting setting);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a setting
|
||||
/// </summary>
|
||||
/// <param name="settingId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteSettingAsync(string entityName, int settingId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of the given settingName (key) from the given key-value dictionary
|
||||
/// </summary>
|
||||
/// <param name="settings"></param>
|
||||
/// <param name="settingName"></param>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <returns></returns>
|
||||
string GetSetting(Dictionary<string, string> settings, string settingName, string defaultValue);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the value of the given settingName (key) in the given key-value dictionary
|
||||
/// </summary>
|
||||
/// <param name="settings"></param>
|
||||
/// <param name="settingName"></param>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <returns></returns>
|
||||
Dictionary<string, string> SetSetting(Dictionary<string, string> settings, string settingName, string settingValue);
|
||||
|
||||
Dictionary<string, string> SetSetting(Dictionary<string, string> settings, string settingName, string settingValue, bool isPrivate);
|
||||
|
||||
Dictionary<string, string> MergeSettings(Dictionary<string, string> baseSettings, Dictionary<string, string> overwriteSettings);
|
||||
|
||||
|
||||
[Obsolete("GetSettingAsync(int settingId) is deprecated. Use GetSettingAsync(string entityName, int settingId) instead.", false)]
|
||||
Task<Setting> GetSettingAsync(int settingId);
|
||||
|
||||
[Obsolete("DeleteSettingAsync(int settingId) is deprecated. Use DeleteSettingAsync(string entityName, int settingId) instead.", false)]
|
||||
Task DeleteSettingAsync(int settingId);
|
||||
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
using Oqtane.Documentation;
|
||||
using Oqtane.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to store and retrieve <see cref="Site"/> entries
|
||||
/// </summary>
|
||||
public interface ISiteService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of sites
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<Site>> GetSitesAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific site
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Site> GetSiteAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new site
|
||||
/// </summary>
|
||||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
Task<Site> AddSiteAsync(Site site);
|
||||
|
||||
/// <summary>
|
||||
/// Updates an existing site
|
||||
/// </summary>
|
||||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
Task<Site> UpdateSiteAsync(Site site);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a site
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteSiteAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of modules
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="pageId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Module>> GetModulesAsync(int siteId, int pageId);
|
||||
|
||||
[PrivateApi]
|
||||
[Obsolete("This method is deprecated.", false)]
|
||||
void SetAlias(Alias alias);
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve <see cref="SiteTemplate"/> entries
|
||||
/// </summary>
|
||||
public interface ISiteTemplateService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of site templates
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<SiteTemplate>> GetSiteTemplatesAsync();
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to execute a <see cref="SqlQuery"/> against the backend database
|
||||
/// </summary>
|
||||
public interface ISqlService
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes a sql query and returns its result
|
||||
/// </summary>
|
||||
/// <param name="sqlquery"></param>
|
||||
/// <returns></returns>
|
||||
Task<SqlQuery> ExecuteQueryAsync(SqlQuery sqlquery);
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve <see cref="Sync"/> information.
|
||||
/// </summary>
|
||||
public interface ISyncService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get sync events
|
||||
/// </summary>
|
||||
/// <param name="lastSyncDate"></param>
|
||||
/// <returns></returns>
|
||||
Task<Sync> GetSyncEventsAsync(DateTime lastSyncDate);
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve and update system information.
|
||||
/// </summary>
|
||||
public interface ISystemService
|
||||
{
|
||||
/// <summary>
|
||||
/// returns a key-value dictionary with the current system configuration information
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, object>> GetSystemInfoAsync();
|
||||
|
||||
/// <summary>
|
||||
/// returns a key-value dictionary with the current system information - "environment" or "configuration"
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, object>> GetSystemInfoAsync(string type);
|
||||
|
||||
/// <summary>
|
||||
/// returns a config value
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<object> GetSystemInfoAsync(string settingKey, object defaultValue);
|
||||
|
||||
/// <summary>
|
||||
/// Updates system information
|
||||
/// </summary>
|
||||
/// <param name="settings"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateSystemInfoAsync(Dictionary<string, object> settings);
|
||||
|
||||
/// <summary>
|
||||
/// returns a key-value dictionary with default system icons
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetIconsAsync();
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage <see cref="Tenant"/>s on the Oqtane installation.
|
||||
/// </summary>
|
||||
public interface ITenantService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all <see cref="Tenant"/>s
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<Tenant>> GetTenantsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Get one specific <see cref="Tenant"/>
|
||||
/// </summary>
|
||||
/// <param name="tenantId">ID-reference of the <see cref="Tenant"/></param>
|
||||
/// <returns></returns>
|
||||
Task<Tenant> GetTenantAsync(int tenantId);
|
||||
}
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage <see cref="Theme"/> entries
|
||||
/// </summary>
|
||||
public interface IThemeService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of available themes
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<Theme>> GetThemesAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific theme
|
||||
/// </summary>
|
||||
/// <param name="themeId"></param>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Theme> GetThemeAsync(int themeId, int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a theme <see cref="ThemeControl"/>s containing a specific theme control type
|
||||
/// </summary>
|
||||
/// <param name="themes"></param>
|
||||
/// <param name="themeControlType"></param>
|
||||
/// <returns></returns>
|
||||
Theme GetTheme(List<Theme> themes, string themeControlType);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of <see cref="ThemeControl"/>s from the given themes
|
||||
/// </summary>
|
||||
/// <param name="themes"></param>
|
||||
/// <returns></returns>
|
||||
List<ThemeControl> GetThemeControls(List<Theme> themes);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of <see cref="ThemeControl"/>s for a theme containing a specific theme control type
|
||||
/// </summary>
|
||||
/// <param name="themes"></param>
|
||||
/// <param name="themeControlType"></param>
|
||||
/// <returns></returns>
|
||||
List<ThemeControl> GetThemeControls(List<Theme> themes, string themeControlType);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of containers (<see cref="ThemeControl"/>) for a theme containing a specific theme control type
|
||||
/// </summary>
|
||||
/// <param name="themes"></param>
|
||||
/// <param name="themeControlType"></param>
|
||||
/// <returns></returns>
|
||||
List<ThemeControl> GetContainerControls(List<Theme> themes, string themeControlType);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a existing theme
|
||||
/// </summary>
|
||||
/// <param name="theme"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateThemeAsync(Theme theme);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a theme
|
||||
/// </summary>
|
||||
/// <param name="themeName"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteThemeAsync(string themeName);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new theme
|
||||
/// </summary>
|
||||
/// <param name="theme"></param>
|
||||
/// <returns></returns>
|
||||
Task<Theme> CreateThemeAsync(Theme theme);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of theme templates (<see cref="Template"/>)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<Template>> GetThemeTemplatesAsync();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of layouts (<see cref="ThemeControl"/>) from the given themes with a matching theme name
|
||||
/// </summary>
|
||||
/// <param name="themes"></param>
|
||||
/// <param name="themeName"></param>
|
||||
/// <returns></returns>
|
||||
List<ThemeControl> GetLayoutControls(List<Theme> themes, string themeName);
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve <see cref="TimeZone"/> entries
|
||||
/// </summary>
|
||||
public interface ITimeZoneService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the list of time zones
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
List<TimeZone> GetTimeZones();
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage <see cref="UrlMapping"/>s on a <see cref="Site"/>
|
||||
/// </summary>
|
||||
public interface IUrlMappingService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all <see cref="UrlMapping"/>s of this <see cref="Site"/>.
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID-reference of a <see cref="Site"/></param>
|
||||
/// <returns></returns>
|
||||
Task<List<UrlMapping>> GetUrlMappingsAsync(int siteId, bool isMapped);
|
||||
|
||||
/// <summary>
|
||||
/// Get one specific <see cref="UrlMapping"/>
|
||||
/// </summary>
|
||||
/// <param name="urlMappingId">ID-reference of a <see cref="UrlMapping"/></param>
|
||||
/// <returns></returns>
|
||||
Task<UrlMapping> GetUrlMappingAsync(int urlMappingId);
|
||||
|
||||
/// <summary>
|
||||
/// Get one specific <see cref="UrlMapping"/>
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID-reference of a <see cref="Site"/></param>
|
||||
/// <param name="url">A url</param>
|
||||
/// <returns></returns>
|
||||
Task<UrlMapping> GetUrlMappingAsync(int siteId, string url);
|
||||
|
||||
/// <summary>
|
||||
/// Add / save a new <see cref="UrlMapping"/> to the database.
|
||||
/// </summary>
|
||||
/// <param name="urlMapping"></param>
|
||||
/// <returns></returns>
|
||||
Task<UrlMapping> AddUrlMappingAsync(UrlMapping urlMapping);
|
||||
|
||||
/// <summary>
|
||||
/// Update a <see cref="UrlMapping"/> in the database.
|
||||
/// </summary>
|
||||
/// <param name="urlMapping"></param>
|
||||
/// <returns></returns>
|
||||
Task<UrlMapping> UpdateUrlMappingAsync(UrlMapping urlMapping);
|
||||
|
||||
/// <summary>
|
||||
/// Delete a <see cref="UrlMapping"/> in the database.
|
||||
/// </summary>
|
||||
/// <param name="urlMappingId">ID-reference of a <see cref="UrlMapping"/></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteUrlMappingAsync(int urlMappingId);
|
||||
}
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Manage <see cref="Role"/>s assigned to a specific <see cref="User"/>
|
||||
/// </summary>
|
||||
public interface IUserRoleService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all <see cref="UserRole"/>s on a <see cref="Site"/>
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID-reference to a <see cref="Site"/></param>
|
||||
/// <returns></returns>
|
||||
Task<List<UserRole>> GetUserRolesAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Get all <see cref="UserRole"/>s on a <see cref="Site"/>
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID-reference to a <see cref="Site"/></param>
|
||||
/// <param name="userId">ID-reference to a <see cref="User"/></param>
|
||||
/// <returns></returns>
|
||||
Task<List<UserRole>> GetUserRolesAsync(int siteId, int userId);
|
||||
|
||||
/// <summary>
|
||||
/// Get all <see cref="UserRole"/>s on a <see cref="Site"/>
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID-reference to a <see cref="Site"/></param>
|
||||
/// <param name="roleName">Name reference a <see cref="Role"/></param>
|
||||
/// <returns></returns>
|
||||
Task<List<UserRole>> GetUserRolesAsync(int siteId, string roleName);
|
||||
|
||||
/// <summary>
|
||||
/// Get all <see cref="UserRole"/>s on a <see cref="Site"/>
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID-reference to a <see cref="Site"/></param>
|
||||
/// <param name="userId">ID-reference to a <see cref="User"/></param>
|
||||
/// <param name="roleName">Name reference a <see cref="Role"/></param>
|
||||
/// <returns></returns>
|
||||
Task<List<UserRole>> GetUserRolesAsync(int siteId, int userId, string roleName);
|
||||
|
||||
/// <summary>
|
||||
/// Get one specific <see cref="UserRole"/>
|
||||
/// </summary>
|
||||
/// <param name="userRoleId">ID-reference to a <see cref="UserRole"/></param>
|
||||
/// <returns></returns>
|
||||
Task<UserRole> GetUserRoleAsync(int userRoleId);
|
||||
|
||||
/// <summary>
|
||||
/// Save a new <see cref="UserRole"/>
|
||||
/// </summary>
|
||||
/// <param name="userRole"></param>
|
||||
/// <returns></returns>
|
||||
Task<UserRole> AddUserRoleAsync(UserRole userRole);
|
||||
|
||||
/// <summary>
|
||||
/// Update a <see cref="UserRole"/> in the database
|
||||
/// </summary>
|
||||
/// <param name="userRole"></param>
|
||||
/// <returns></returns>
|
||||
Task<UserRole> UpdateUserRoleAsync(UserRole userRole);
|
||||
|
||||
/// <summary>
|
||||
/// Delete a <see cref="UserRole"/> in the database
|
||||
/// </summary>
|
||||
/// <param name="userRoleId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteUserRoleAsync(int userRoleId);
|
||||
}
|
||||
}
|
@ -1,171 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Manage (get / update) user information
|
||||
/// </summary>
|
||||
public interface IUserService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get a <see cref="User"/> of a specific site
|
||||
/// </summary>
|
||||
/// <param name="userId">ID of a <see cref="User"/></param>
|
||||
/// <param name="siteId">ID of a <see cref="Site"/></param>
|
||||
/// <returns></returns>
|
||||
Task<User> GetUserAsync(int userId, int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Get a <see cref="User"/> of a specific site
|
||||
/// </summary>
|
||||
/// <param name="username">Username / login of a <see cref="User"/></param>
|
||||
/// <param name="siteId">ID of a <see cref="Site"/></param>
|
||||
/// <returns></returns>
|
||||
Task<User> GetUserAsync(string username, int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Get a <see cref="User"/> of a specific site
|
||||
/// </summary>
|
||||
/// <param name="username">Username / login of a <see cref="User"/></param>
|
||||
/// <param name="email">email address of a <see cref="User"/></param>
|
||||
/// <param name="siteId">ID of a <see cref="Site"/></param>
|
||||
/// <returns></returns>
|
||||
Task<User> GetUserAsync(string username, string email, int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Save a user to the Database.
|
||||
/// The <see cref="User"/> object contains all the information incl. what <see cref="Site"/> it belongs to.
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <returns></returns>
|
||||
Task<User> AddUserAsync(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Update an existing user in the database.
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <returns></returns>
|
||||
Task<User> UpdateUserAsync(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Delete / remove a user in the database
|
||||
/// </summary>
|
||||
/// <param name="userId">ID-reference to the <see cref="User"/></param>
|
||||
/// <param name="siteId">ID-reference to the <see cref="Site"/></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteUserAsync(int userId, int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Will login the specified <see cref="User"/>.
|
||||
///
|
||||
/// Note that this will probably not be a real User, but a user object where the `Username` and `Password` have been filled.
|
||||
/// </summary>
|
||||
/// <param name="user">A <see cref="User"/> object which should have at least the <see cref="User.Username"/> and <see cref="User.Password"/> set.</param>
|
||||
/// <param name="setCookie">Determines if the login cookie should be set (only relevant for Hybrid scenarios)</param>
|
||||
/// <param name="isPersistent">Determines if the login cookie should be persisted for a long time.</param>
|
||||
/// <returns></returns>
|
||||
Task<User> LoginUserAsync(User user, bool setCookie, bool isPersistent);
|
||||
|
||||
/// <summary>
|
||||
/// Logout a <see cref="User"/>
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <returns></returns>
|
||||
Task LogoutUserAsync(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Logout a <see cref="User"/>
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <returns></returns>
|
||||
Task LogoutUserEverywhereAsync(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Update e-mail verification status of a user.
|
||||
/// </summary>
|
||||
/// <param name="user">The <see cref="User"/> we're verifying</param>
|
||||
/// <param name="token">A Hash value in the URL which verifies this user got the e-mail (containing this token)</param>
|
||||
/// <returns></returns>
|
||||
Task<User> VerifyEmailAsync(User user, string token);
|
||||
|
||||
/// <summary>
|
||||
/// Trigger a forgot-password e-mail for this <see cref="User"/>.
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <returns></returns>
|
||||
Task ForgotPasswordAsync(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Reset the password of this <see cref="User"/>
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<User> ResetPasswordAsync(User user, string token);
|
||||
|
||||
/// <summary>
|
||||
/// Verify the two factor verification code <see cref="User"/>
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<User> VerifyTwoFactorAsync(User user, string token);
|
||||
|
||||
/// <summary>
|
||||
/// Validate identity user info.
|
||||
/// </summary>
|
||||
/// <param name="username"></param>
|
||||
/// <param name="email"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <returns></returns>
|
||||
Task<UserValidateResult> ValidateUserAsync(string username, string email, string password);
|
||||
|
||||
/// <summary>
|
||||
/// Validate a users password against the password policy
|
||||
/// </summary>
|
||||
/// <param name="password"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> ValidatePasswordAsync(string password);
|
||||
|
||||
/// <summary>
|
||||
/// Get token for current user
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<string> GetTokenAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Get personal access token for current user (administrators only)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<string> GetPersonalAccessTokenAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Link an external login with a local user account
|
||||
/// </summary>
|
||||
/// <param name="user">The <see cref="User"/> we're verifying</param>
|
||||
/// <param name="token">A Hash value in the URL which verifies this user got the e-mail (containing this token)</param>
|
||||
/// <param name="type">External Login provider type</param>
|
||||
/// <param name="key">External Login provider key</param>
|
||||
/// <param name="name">External Login provider display name</param>
|
||||
/// <returns></returns>
|
||||
Task<User> LinkUserAsync(User user, string token, string type, string key, string name);
|
||||
|
||||
/// <summary>
|
||||
/// Get password requirements for site
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID of a <see cref="Site"/></param>
|
||||
/// <returns></returns>
|
||||
Task<string> GetPasswordRequirementsAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Bulk import of users
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID of a <see cref="Site"/></param>
|
||||
/// <param name="fileId">ID of a <see cref="File"/></param>
|
||||
/// <param name="notify">Indicates if new users should be notified by email</param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> ImportUsersAsync(int siteId, int fileId, bool notify);
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
using Oqtane.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage <see cref="Visitor"/>s on a <see cref="Site"/>
|
||||
/// </summary>
|
||||
public interface IVisitorService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all <see cref="Visitor"/>s of this <see cref="Site"/>.
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID-reference of a <see cref="Site"/></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Visitor>> GetVisitorsAsync(int siteId, DateTime fromDate);
|
||||
|
||||
/// <summary>
|
||||
/// Get a specific <see cref="Visitor"/> of this <see cref="Site"/>.
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="visitorId">ID-reference of a <see cref="Visitor"/></param>
|
||||
/// <returns></returns>
|
||||
Task<Visitor> GetVisitorAsync(int visitorId);
|
||||
}
|
||||
}
|
@ -1,13 +1,32 @@
|
||||
using Oqtane.Models;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Documentation;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to read the job schedule log
|
||||
/// </summary>
|
||||
public interface IJobLogService
|
||||
{
|
||||
/// <summary>
|
||||
/// Return a list of <see cref="JobLog"/> entries
|
||||
/// </summary>
|
||||
/// <param name="jobId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<JobLog>> GetJobLogsAsync(int jobId);
|
||||
|
||||
/// <summary>
|
||||
/// Return a <see cref="JobLog"/> entry for the given Id
|
||||
/// </summary>
|
||||
/// <param name="jobLogId"></param>
|
||||
/// <returns></returns>
|
||||
Task<JobLog> GetJobLogAsync(int jobLogId);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class JobLogService : ServiceBase, IJobLogService
|
||||
{
|
||||
|
@ -8,6 +8,60 @@ using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage jobs (<see cref="Job"/>)
|
||||
/// </summary>
|
||||
public interface IJobService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of all jobs
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<Job>> GetJobsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Return a specific job
|
||||
/// </summary>
|
||||
/// <param name="jobId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Job> GetJobAsync(int jobId);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new job
|
||||
/// </summary>
|
||||
/// <param name="job"></param>
|
||||
/// <returns></returns>
|
||||
Task<Job> AddJobAsync(Job job);
|
||||
|
||||
/// <summary>
|
||||
/// Updates an existing job
|
||||
/// </summary>
|
||||
/// <param name="job"></param>
|
||||
/// <returns></returns>
|
||||
Task<Job> UpdateJobAsync(Job job);
|
||||
|
||||
/// <summary>
|
||||
/// Delete an existing job
|
||||
/// </summary>
|
||||
/// <param name="jobId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteJobAsync(int jobId);
|
||||
|
||||
/// <summary>
|
||||
/// Starts the given job
|
||||
/// </summary>
|
||||
/// <param name="jobId"></param>
|
||||
/// <returns></returns>
|
||||
Task StartJobAsync(int jobId);
|
||||
|
||||
/// <summary>
|
||||
/// Stops the given job
|
||||
/// </summary>
|
||||
/// <param name="jobId"></param>
|
||||
/// <returns></returns>
|
||||
Task StopJobAsync(int jobId);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class JobService : ServiceBase, IJobService
|
||||
{
|
||||
|
@ -7,6 +7,55 @@ using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage <see cref="Language"/> entries
|
||||
/// </summary>
|
||||
public interface ILanguageService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of all available languages for the given <see cref="Site"/>
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Language>> GetLanguagesAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of all available languages for the given <see cref="Site" /> and package
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="packageName"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Language>> GetLanguagesAsync(int siteId, string packageName);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the given language
|
||||
/// </summary>
|
||||
/// <param name="languageId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Language> GetLanguageAsync(int languageId);
|
||||
|
||||
/// <summary>
|
||||
/// Adds the given language
|
||||
/// </summary>
|
||||
/// <param name="language"></param>
|
||||
/// <returns></returns>
|
||||
Task<Language> AddLanguageAsync(Language language);
|
||||
|
||||
/// <summary>
|
||||
/// Edits the given language
|
||||
/// </summary>
|
||||
/// <param name="language"></param>
|
||||
/// <returns></returns>
|
||||
Task EditLanguageAsync(Language language);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the given language
|
||||
/// </summary>
|
||||
/// <param name="languageId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteLanguageAsync(int languageId);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class LanguageService : ServiceBase, ILanguageService
|
||||
{
|
||||
|
@ -5,6 +5,19 @@ using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to set localization cookie
|
||||
/// </summary>
|
||||
public interface ILocalizationCookieService
|
||||
{
|
||||
/// <summary>
|
||||
/// Set the localization cookie
|
||||
/// </summary>
|
||||
/// <param name="culture"></param>
|
||||
/// <returns></returns>
|
||||
Task SetLocalizationCookieAsync(string culture);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class LocalizationCookieService : ServiceBase, ILocalizationCookieService
|
||||
{
|
||||
|
@ -7,6 +7,18 @@ using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve localizations (<see cref="Culture"/>)
|
||||
/// </summary>
|
||||
public interface ILocalizationService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a collection of supported cultures
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<Culture>> GetCulturesAsync(bool installed);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class LocalizationService : ServiceBase, ILocalizationService
|
||||
{
|
||||
|
@ -11,6 +11,69 @@ using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve and store <see cref="Log"/> entries
|
||||
/// </summary>
|
||||
public interface ILogService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of log entires for the given params
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="level"></param>
|
||||
/// <param name="function"></param>
|
||||
/// <param name="rows"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Log>> GetLogsAsync(int siteId, string level, string function, int rows);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific log entry for the given id
|
||||
/// </summary>
|
||||
/// <param name="logId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Log> GetLogAsync(int logId);
|
||||
|
||||
/// <summary>
|
||||
/// Clear the entire logs of the given site.
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteLogsAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new log entry
|
||||
/// </summary>
|
||||
/// <param name="pageId"></param>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="category"></param>
|
||||
/// <param name="feature"></param>
|
||||
/// <param name="function"></param>
|
||||
/// <param name="level"></param>
|
||||
/// <param name="exception"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
Task Log(int? pageId, int? moduleId, int? userId, string category, string feature, LogFunction function, LogLevel level, Exception exception, string message, params object[] args);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new log entry
|
||||
/// </summary>
|
||||
/// <param name="alias"></param>
|
||||
/// <param name="pageId"></param>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="category"></param>
|
||||
/// <param name="feature"></param>
|
||||
/// <param name="function"></param>
|
||||
/// <param name="level"></param>
|
||||
/// <param name="exception"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
Task Log(Alias alias, int? pageId, int? moduleId, int? userId, string category, string feature, LogFunction function, LogLevel level, Exception exception, string message, params object[] args);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class LogService : ServiceBase, ILogService
|
||||
{
|
||||
|
@ -8,6 +8,55 @@ using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage a <see cref="ModuleDefinition"/>
|
||||
/// </summary>
|
||||
public interface IModuleDefinitionService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of module definitions for the given site
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<ModuleDefinition>> GetModuleDefinitionsAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific module definition
|
||||
/// </summary>
|
||||
/// <param name="moduleDefinitionId"></param>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<ModuleDefinition> GetModuleDefinitionAsync(int moduleDefinitionId, int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a existing module definition
|
||||
/// </summary>
|
||||
/// <param name="moduleDefinition"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateModuleDefinitionAsync(ModuleDefinition moduleDefinition);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a module definition
|
||||
/// </summary>
|
||||
/// <param name="moduleDefinitionId"></param>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteModuleDefinitionAsync(int moduleDefinitionId, int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new module definition
|
||||
/// </summary>
|
||||
/// <param name="moduleDefinition"></param>
|
||||
/// <returns></returns>
|
||||
Task<ModuleDefinition> CreateModuleDefinitionAsync(ModuleDefinition moduleDefinition);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of module definition templates
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<Template>> GetModuleDefinitionTemplatesAsync();
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class ModuleDefinitionService : ServiceBase, IModuleDefinitionService
|
||||
{
|
||||
|
@ -9,6 +9,73 @@ using Oqtane.Modules.Controls;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve and store modules (<see cref="Module"/>)
|
||||
/// </summary>
|
||||
public interface IModuleService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of modules for the given site
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Module>> GetModulesAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific module
|
||||
/// </summary>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Module> GetModuleAsync(int moduleId);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new module
|
||||
/// </summary>
|
||||
/// <param name="module"></param>
|
||||
/// <returns></returns>
|
||||
Task<Module> AddModuleAsync(Module module);
|
||||
|
||||
/// <summary>
|
||||
/// Updates an existing module
|
||||
/// </summary>
|
||||
/// <param name="module"></param>
|
||||
/// <returns></returns>
|
||||
Task<Module> UpdateModuleAsync(Module module);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a module
|
||||
/// </summary>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteModuleAsync(int moduleId);
|
||||
|
||||
/// <summary>
|
||||
/// Imports a module
|
||||
/// </summary>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <param name="content">module in JSON format</param>
|
||||
/// <returns></returns>
|
||||
Task<bool> ImportModuleAsync(int moduleId, int pageId, string content);
|
||||
|
||||
/// <summary>
|
||||
/// Exports a given module
|
||||
/// </summary>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <param name="pageId"></param>
|
||||
/// <returns>module content in JSON format</returns>
|
||||
Task<string> ExportModuleAsync(int moduleId, int pageId);
|
||||
|
||||
/// <summary>
|
||||
/// Exports a given module
|
||||
/// </summary>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <param name="pageId"></param>
|
||||
/// <param name="folderId"></param>
|
||||
/// <param name="filename"></param>
|
||||
/// <returns>file id</returns>
|
||||
Task<int> ExportModuleAsync(int moduleId, int pageId, int folderId, string filename);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class ModuleService : ServiceBase, IModuleService
|
||||
{
|
||||
|
@ -8,6 +8,70 @@ using Oqtane.Documentation;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to store and retrieve notifications (<see cref="Notification"/>)
|
||||
/// </summary>
|
||||
public interface INotificationService
|
||||
{
|
||||
/// <summary>
|
||||
/// Return a list of notifications
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="direction"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Notification>> GetNotificationsAsync(int siteId, string direction, int userId);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="direction"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="count"></param>
|
||||
/// <param name="isRead"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Notification>> GetNotificationsAsync(int siteId, string direction, int userId, int count, bool isRead);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="direction"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="isRead"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> GetNotificationCountAsync(int siteId, string direction, int userId, bool isRead);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific notifications
|
||||
/// </summary>
|
||||
/// <param name="notificationId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Notification> GetNotificationAsync(int notificationId);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new notification
|
||||
/// </summary>
|
||||
/// <param name="notification"></param>
|
||||
/// <returns></returns>
|
||||
Task<Notification> AddNotificationAsync(Notification notification);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a existing notification
|
||||
/// </summary>
|
||||
/// <param name="notification"></param>
|
||||
/// <returns></returns>
|
||||
Task<Notification> UpdateNotificationAsync(Notification notification);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a notification
|
||||
/// </summary>
|
||||
/// <param name="notificationId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteNotificationAsync(int notificationId);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class NotificationService : ServiceBase, INotificationService
|
||||
{
|
||||
|
@ -1,12 +1,23 @@
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Oqtane.Documentation;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage cache
|
||||
/// </summary>
|
||||
public interface IOutputCacheService
|
||||
{
|
||||
/// <summary>
|
||||
/// Evicts the output cache for a specific tag
|
||||
/// </summary>
|
||||
/// <param name="tag"></param>
|
||||
/// <returns></returns>
|
||||
Task EvictByTag(string tag);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IOutputCacheService" />
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class OutputCacheService : ServiceBase, IOutputCacheService
|
||||
|
@ -2,13 +2,75 @@ using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
using Oqtane.Documentation;
|
||||
using Oqtane.Shared;
|
||||
using System.Net;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage packages (<see cref="Package"/>)
|
||||
/// </summary>
|
||||
public interface IPackageService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of packages matching the given parameters
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Package>> GetPackagesAsync(string type);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of packages matching the given parameters
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="search"></param>
|
||||
/// <param name="price"></param>
|
||||
/// <param name="package"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Package>> GetPackagesAsync(string type, string search, string price, string package);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of packages matching the given parameters
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="search"></param>
|
||||
/// <param name="price"></param>
|
||||
/// <param name="package"></param>
|
||||
/// <param name="sort"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Package>> GetPackagesAsync(string type, string search, string price, string package, string sort);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of packages based on installationid
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<Package>> GetPackageUpdatesAsync(string type);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific package
|
||||
/// </summary>
|
||||
/// <param name="packageId"></param>
|
||||
/// <param name="version"></param>
|
||||
/// <returns></returns>
|
||||
Task<Package> GetPackageAsync(string packageId, string version, bool download);
|
||||
|
||||
/// <summary>
|
||||
/// Downloads a specific package as .nupkg file
|
||||
/// </summary>
|
||||
/// <param name="packageId"></param>
|
||||
/// <param name="version"></param>
|
||||
/// <param name="folder"></param>
|
||||
/// <returns></returns>
|
||||
Task DownloadPackageAsync(string packageId, string version);
|
||||
|
||||
/// <summary>
|
||||
/// Installs all packages located in //TODO: 2dm where?
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task InstallPackagesAsync();
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class PackageService : ServiceBase, IPackageService
|
||||
{
|
||||
|
@ -6,6 +6,57 @@ using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to store and retrieve a <see cref="PageModule"/>
|
||||
/// </summary>
|
||||
public interface IPageModuleService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific page module
|
||||
/// </summary>
|
||||
/// <param name="pageModuleId"></param>
|
||||
/// <returns></returns>
|
||||
Task<PageModule> GetPageModuleAsync(int pageModuleId);
|
||||
|
||||
/// <summary>
|
||||
/// Return a specific page module
|
||||
/// </summary>
|
||||
/// <param name="pageId"></param>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <returns></returns>
|
||||
Task<PageModule> GetPageModuleAsync(int pageId, int moduleId);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new page module
|
||||
/// </summary>
|
||||
/// <param name="pageModule"></param>
|
||||
/// <returns></returns>
|
||||
Task<PageModule> AddPageModuleAsync(PageModule pageModule);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a existing page module
|
||||
/// </summary>
|
||||
/// <param name="pageModule"></param>
|
||||
/// <returns></returns>
|
||||
Task<PageModule> UpdatePageModuleAsync(PageModule pageModule);
|
||||
|
||||
/// <summary>
|
||||
/// Updates order of all page modules in the given pane
|
||||
/// </summary>
|
||||
/// <param name="pageId"></param>
|
||||
/// <param name="pane"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdatePageModuleOrderAsync(int pageId, string pane);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a page module
|
||||
/// </summary>
|
||||
/// <param name="pageModuleId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeletePageModuleAsync(int pageModuleId);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class PageModuleService : ServiceBase, IPageModuleService
|
||||
{
|
||||
|
@ -8,6 +8,71 @@ using Oqtane.Documentation;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Services to store and retrieve a <see cref="Page"/>
|
||||
/// </summary>
|
||||
public interface IPageService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of pages
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Page>> GetPagesAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific page
|
||||
/// </summary>
|
||||
/// <param name="pageId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Page> GetPageAsync(int pageId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific page by its defined path
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Page> GetPageAsync(string path, int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new page
|
||||
/// </summary>
|
||||
/// <param name="page"></param>
|
||||
/// <returns></returns>
|
||||
Task<Page> AddPageAsync(Page page);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new page
|
||||
/// </summary>
|
||||
/// <param name="page"></param>
|
||||
/// <returns></returns>
|
||||
Task<Page> AddPageAsync(int pageId, int userId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a existing page
|
||||
/// </summary>
|
||||
/// <param name="page"></param>
|
||||
/// <returns></returns>
|
||||
Task<Page> UpdatePageAsync(Page page);
|
||||
|
||||
/// <summary>
|
||||
/// Updates order of all page modules in the given parent
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="pageId"></param>
|
||||
/// <param name="parentId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdatePageOrderAsync(int siteId, int pageId, int? parentId);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a page
|
||||
/// </summary>
|
||||
/// <param name="pageId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeletePageAsync(int pageId);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class PageService : ServiceBase, IPageService
|
||||
{
|
||||
|
@ -8,6 +8,48 @@ using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to store and retrieve <see cref="Profile"/> entries
|
||||
/// </summary>
|
||||
public interface IProfileService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of profile entries
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Profile>> GetProfilesAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific profile entry
|
||||
/// </summary>
|
||||
/// <param name="profileId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Profile> GetProfileAsync(int profileId);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new profile entry
|
||||
/// </summary>
|
||||
/// <param name="profile"></param>
|
||||
/// <returns></returns>
|
||||
Task<Profile> AddProfileAsync(Profile profile);
|
||||
|
||||
/// <summary>
|
||||
/// Updates an existing profile entry
|
||||
/// </summary>
|
||||
/// <param name="profile"></param>
|
||||
/// <returns></returns>
|
||||
Task<Profile> UpdateProfileAsync(Profile profile);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a profile entry
|
||||
/// </summary>
|
||||
/// <param name="profileId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteProfileAsync(int profileId);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class ProfileService : ServiceBase, IProfileService
|
||||
{
|
||||
|
@ -8,6 +8,57 @@ using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage <see cref="Role"/>s on a <see cref="Site"/>
|
||||
/// </summary>
|
||||
public interface IRoleService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all <see cref="Role"/>s of this <see cref="Site"/>.
|
||||
///
|
||||
/// Will exclude global roles which are for all sites. To get those as well, use the overload <see cref="GetRolesAsync(int, bool)"/>
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID-reference of a <see cref="Site"/></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Role>> GetRolesAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Get roles of the <see cref="Site"/> and optionally include global Roles.
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID-reference to a <see cref="Site"/></param>
|
||||
/// <param name="includeGlobalRoles">True if it should also include global roles. False will return the same data as just calling <see cref="GetRolesAsync(int)"/></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Role>> GetRolesAsync(int siteId, bool includeGlobalRoles);
|
||||
|
||||
/// <summary>
|
||||
/// Get one specific <see cref="Role"/>
|
||||
/// </summary>
|
||||
/// <param name="roleId">ID-reference of a <see cref="Role"/></param>
|
||||
/// <returns></returns>
|
||||
Task<Role> GetRoleAsync(int roleId);
|
||||
|
||||
/// <summary>
|
||||
/// Add / save a new <see cref="Role"/> to the database.
|
||||
/// </summary>
|
||||
/// <param name="role"></param>
|
||||
/// <returns></returns>
|
||||
Task<Role> AddRoleAsync(Role role);
|
||||
|
||||
/// <summary>
|
||||
/// Update a <see cref="Role"/> in the database.
|
||||
/// </summary>
|
||||
/// <param name="role"></param>
|
||||
/// <returns></returns>
|
||||
Task<Role> UpdateRoleAsync(Role role);
|
||||
|
||||
/// <summary>
|
||||
/// Delete / mark-as-deleted a <see cref="Role"/> in the database.
|
||||
/// </summary>
|
||||
/// <param name="roleId">ID-reference of a <see cref="Role"/></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteRoleAsync(int roleId);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class RoleService : ServiceBase, IRoleService
|
||||
{
|
||||
|
@ -1,4 +1,3 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Oqtane.Documentation;
|
||||
@ -8,6 +7,12 @@ using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
[PrivateApi("Mark SearchResults classes as private, since it's not very useful in the public docs")]
|
||||
public interface ISearchResultsService
|
||||
{
|
||||
Task<SearchResults> GetSearchResultsAsync(SearchQuery searchQuery);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class SearchResultsService : ServiceBase, ISearchResultsService, IClientService
|
||||
{
|
||||
|
@ -9,6 +9,268 @@ using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage <see cref="Setting"/>s
|
||||
/// </summary>
|
||||
public interface ISettingService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all tenant settings
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetTenantSettingsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Updates a tenant setting
|
||||
/// </summary>
|
||||
/// <param name="tenantSettings"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateTenantSettingsAsync(Dictionary<string, string> tenantSettings);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all site settings for the given site
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetSiteSettingsAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a site setting
|
||||
/// </summary>
|
||||
/// <param name="siteSettings"></param>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateSiteSettingsAsync(Dictionary<string, string> siteSettings, int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Clears site option cache
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task ClearSiteSettingsCacheAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all page settings for the given page
|
||||
/// </summary>
|
||||
/// <param name="pageId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetPageSettingsAsync(int pageId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a page setting
|
||||
/// </summary>
|
||||
/// <param name="pageSettings"></param>
|
||||
/// <param name="pageId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdatePageSettingsAsync(Dictionary<string, string> pageSettings, int pageId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all page module settings for the given page module
|
||||
/// </summary>
|
||||
/// <param name="pageModuleId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetPageModuleSettingsAsync(int pageModuleId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a page module setting
|
||||
/// </summary>
|
||||
/// <param name="pageModuleSettings"></param>
|
||||
/// <param name="pageModuleId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdatePageModuleSettingsAsync(Dictionary<string, string> pageModuleSettings, int pageModuleId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all module settings for the given module
|
||||
/// </summary>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetModuleSettingsAsync(int moduleId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a module setting
|
||||
/// </summary>
|
||||
/// <param name="moduleSettings"></param>
|
||||
/// <param name="moduleId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateModuleSettingsAsync(Dictionary<string, string> moduleSettings, int moduleId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all module settings for the given module
|
||||
/// </summary>
|
||||
/// <param name="moduleDefinitionId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetModuleDefinitionSettingsAsync(int moduleDefinitionId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a module setting
|
||||
/// </summary>
|
||||
/// <param name="moduleDefinitionSettings"></param>
|
||||
/// <param name="moduleDefinitionId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateModuleDefinitionSettingsAsync(Dictionary<string, string> moduleDefinitionSettings, int moduleDefinitionId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all user settings for the given user
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetUserSettingsAsync(int userId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a user setting
|
||||
/// </summary>
|
||||
/// <param name="userSettings"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateUserSettingsAsync(Dictionary<string, string> userSettings, int userId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all folder settings for the given folder
|
||||
/// </summary>
|
||||
/// <param name="folderId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetFolderSettingsAsync(int folderId);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates a folder setting
|
||||
/// </summary>
|
||||
/// <param name="folderSettings"></param>
|
||||
/// <param name="folderId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateFolderSettingsAsync(Dictionary<string, string> folderSettings, int folderId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all tenant settings
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetHostSettingsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Updates a host setting
|
||||
/// </summary>
|
||||
/// <param name="hostSettings"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateHostSettingsAsync(Dictionary<string, string> hostSettings);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all settings for the given visitor
|
||||
/// </summary>
|
||||
/// <param name="visitorId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetVisitorSettingsAsync(int visitorId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a visitor setting
|
||||
/// </summary>
|
||||
/// <param name="visitorSettings"></param>
|
||||
/// <param name="visitorId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateVisitorSettingsAsync(Dictionary<string, string> visitorSettings, int visitorId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all settings for the given entityName
|
||||
/// </summary>
|
||||
/// <param name="pageId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetSettingsAsync(string entityName, int entityId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates settings for a given entityName and Id
|
||||
/// </summary>
|
||||
/// <param name="settings"></param>
|
||||
/// <param name="entityName"></param>
|
||||
/// <param name="entityId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateSettingsAsync(Dictionary<string, string> settings, string entityName, int entityId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates setting for a given entityName and Id
|
||||
/// </summary>
|
||||
/// <param name="entityName"></param>
|
||||
/// <param name="entityId"></param>
|
||||
/// <param name="settingName"></param>
|
||||
/// <param name="settingValue"></param>
|
||||
/// <param name="isPrivate"></param>
|
||||
/// <returns></returns>
|
||||
Task AddOrUpdateSettingAsync(string entityName, int entityId, string settingName, string settingValue, bool isPrivate);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific setting
|
||||
/// </summary>
|
||||
/// <param name="entityName"></param>
|
||||
/// <param name="entityId"></param>
|
||||
/// <param name="settingName"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteSettingAsync(string entityName, int entityId, string settingName);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific setting
|
||||
/// </summary>
|
||||
/// <param name="entityName"></param>
|
||||
/// <param name="entityId"></param>
|
||||
/// <param name="settingName"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Setting>> GetSettingsAsync(string entityName, int entityId, string settingName);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific setting
|
||||
/// </summary>
|
||||
/// <param name="settingId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Setting> GetSettingAsync(string entityName, int settingId);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new setting
|
||||
/// </summary>
|
||||
/// <param name="setting"></param>
|
||||
/// <returns></returns>
|
||||
Task<Setting> AddSettingAsync(Setting setting);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a existing setting
|
||||
/// </summary>
|
||||
/// <param name="setting"></param>
|
||||
/// <returns></returns>
|
||||
Task<Setting> UpdateSettingAsync(Setting setting);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a setting
|
||||
/// </summary>
|
||||
/// <param name="settingId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteSettingAsync(string entityName, int settingId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of the given settingName (key) from the given key-value dictionary
|
||||
/// </summary>
|
||||
/// <param name="settings"></param>
|
||||
/// <param name="settingName"></param>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <returns></returns>
|
||||
string GetSetting(Dictionary<string, string> settings, string settingName, string defaultValue);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the value of the given settingName (key) in the given key-value dictionary
|
||||
/// </summary>
|
||||
/// <param name="settings"></param>
|
||||
/// <param name="settingName"></param>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <returns></returns>
|
||||
Dictionary<string, string> SetSetting(Dictionary<string, string> settings, string settingName, string settingValue);
|
||||
|
||||
Dictionary<string, string> SetSetting(Dictionary<string, string> settings, string settingName, string settingValue, bool isPrivate);
|
||||
|
||||
Dictionary<string, string> MergeSettings(Dictionary<string, string> baseSettings, Dictionary<string, string> overwriteSettings);
|
||||
|
||||
|
||||
[Obsolete("GetSettingAsync(int settingId) is deprecated. Use GetSettingAsync(string entityName, int settingId) instead.", false)]
|
||||
Task<Setting> GetSettingAsync(int settingId);
|
||||
|
||||
[Obsolete("DeleteSettingAsync(int settingId) is deprecated. Use DeleteSettingAsync(string entityName, int settingId) instead.", false)]
|
||||
Task DeleteSettingAsync(int settingId);
|
||||
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class SettingService : ServiceBase, ISettingService
|
||||
{
|
||||
|
@ -8,6 +8,59 @@ using Oqtane.Documentation;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to store and retrieve <see cref="Site"/> entries
|
||||
/// </summary>
|
||||
public interface ISiteService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of sites
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<Site>> GetSitesAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific site
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Site> GetSiteAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new site
|
||||
/// </summary>
|
||||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
Task<Site> AddSiteAsync(Site site);
|
||||
|
||||
/// <summary>
|
||||
/// Updates an existing site
|
||||
/// </summary>
|
||||
/// <param name="site"></param>
|
||||
/// <returns></returns>
|
||||
Task<Site> UpdateSiteAsync(Site site);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a site
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteSiteAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of modules
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="pageId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Module>> GetModulesAsync(int siteId, int pageId);
|
||||
|
||||
[PrivateApi]
|
||||
[Obsolete("This method is deprecated.", false)]
|
||||
void SetAlias(Alias alias);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class SiteService : ServiceBase, ISiteService
|
||||
{
|
||||
|
@ -8,6 +8,18 @@ using Oqtane.Documentation;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve <see cref="SiteTemplate"/> entries
|
||||
/// </summary>
|
||||
public interface ISiteTemplateService
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of site templates
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<SiteTemplate>> GetSiteTemplatesAsync();
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class SiteTemplateService : ServiceBase, ISiteTemplateService
|
||||
{
|
||||
|
@ -6,6 +6,19 @@ using Oqtane.Documentation;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to execute a <see cref="SqlQuery"/> against the backend database
|
||||
/// </summary>
|
||||
public interface ISqlService
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes a sql query and returns its result
|
||||
/// </summary>
|
||||
/// <param name="sqlquery"></param>
|
||||
/// <returns></returns>
|
||||
Task<SqlQuery> ExecuteQueryAsync(SqlQuery sqlquery);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class SqlService : ServiceBase, ISqlService
|
||||
{
|
||||
|
@ -8,6 +8,19 @@ using System.Globalization;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve <see cref="Sync"/> information.
|
||||
/// </summary>
|
||||
public interface ISyncService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get sync events
|
||||
/// </summary>
|
||||
/// <param name="lastSyncDate"></param>
|
||||
/// <returns></returns>
|
||||
Task<Sync> GetSyncEventsAsync(DateTime lastSyncDate);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ISyncService" />
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class SyncService : ServiceBase, ISyncService
|
||||
|
@ -3,10 +3,46 @@ using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Documentation;
|
||||
using Oqtane.Shared;
|
||||
using System.Net;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve and update system information.
|
||||
/// </summary>
|
||||
public interface ISystemService
|
||||
{
|
||||
/// <summary>
|
||||
/// returns a key-value dictionary with the current system configuration information
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, object>> GetSystemInfoAsync();
|
||||
|
||||
/// <summary>
|
||||
/// returns a key-value dictionary with the current system information - "environment" or "configuration"
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, object>> GetSystemInfoAsync(string type);
|
||||
|
||||
/// <summary>
|
||||
/// returns a config value
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<object> GetSystemInfoAsync(string settingKey, object defaultValue);
|
||||
|
||||
/// <summary>
|
||||
/// Updates system information
|
||||
/// </summary>
|
||||
/// <param name="settings"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateSystemInfoAsync(Dictionary<string, object> settings);
|
||||
|
||||
/// <summary>
|
||||
/// returns a key-value dictionary with default system icons
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetIconsAsync();
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class SystemService : ServiceBase, ISystemService
|
||||
{
|
||||
|
@ -8,6 +8,25 @@ using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage <see cref="Tenant"/>s on the Oqtane installation.
|
||||
/// </summary>
|
||||
public interface ITenantService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all <see cref="Tenant"/>s
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<Tenant>> GetTenantsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Get one specific <see cref="Tenant"/>
|
||||
/// </summary>
|
||||
/// <param name="tenantId">ID-reference of the <see cref="Tenant"/></param>
|
||||
/// <returns></returns>
|
||||
Task<Tenant> GetTenantAsync(int tenantId);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class TenantService : ServiceBase, ITenantService
|
||||
{
|
||||
|
@ -5,10 +5,97 @@ using System.Threading.Tasks;
|
||||
using Oqtane.Documentation;
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Shared;
|
||||
using Oqtane.UI;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage <see cref="Theme"/> entries
|
||||
/// </summary>
|
||||
public interface IThemeService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of available themes
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<Theme>> GetThemesAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific theme
|
||||
/// </summary>
|
||||
/// <param name="themeId"></param>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Theme> GetThemeAsync(int themeId, int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a theme <see cref="ThemeControl"/>s containing a specific theme control type
|
||||
/// </summary>
|
||||
/// <param name="themes"></param>
|
||||
/// <param name="themeControlType"></param>
|
||||
/// <returns></returns>
|
||||
Theme GetTheme(List<Theme> themes, string themeControlType);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of <see cref="ThemeControl"/>s from the given themes
|
||||
/// </summary>
|
||||
/// <param name="themes"></param>
|
||||
/// <returns></returns>
|
||||
List<ThemeControl> GetThemeControls(List<Theme> themes);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of <see cref="ThemeControl"/>s for a theme containing a specific theme control type
|
||||
/// </summary>
|
||||
/// <param name="themes"></param>
|
||||
/// <param name="themeControlType"></param>
|
||||
/// <returns></returns>
|
||||
List<ThemeControl> GetThemeControls(List<Theme> themes, string themeControlType);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of containers (<see cref="ThemeControl"/>) for a theme containing a specific theme control type
|
||||
/// </summary>
|
||||
/// <param name="themes"></param>
|
||||
/// <param name="themeControlType"></param>
|
||||
/// <returns></returns>
|
||||
List<ThemeControl> GetContainerControls(List<Theme> themes, string themeControlType);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a existing theme
|
||||
/// </summary>
|
||||
/// <param name="theme"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateThemeAsync(Theme theme);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a theme
|
||||
/// </summary>
|
||||
/// <param name="themeName"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteThemeAsync(string themeName);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new theme
|
||||
/// </summary>
|
||||
/// <param name="theme"></param>
|
||||
/// <returns></returns>
|
||||
Task<Theme> CreateThemeAsync(Theme theme);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of theme templates (<see cref="Template"/>)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<Template>> GetThemeTemplatesAsync();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of layouts (<see cref="ThemeControl"/>) from the given themes with a matching theme name
|
||||
/// </summary>
|
||||
/// <param name="themes"></param>
|
||||
/// <param name="themeName"></param>
|
||||
/// <returns></returns>
|
||||
List<ThemeControl> GetLayoutControls(List<Theme> themes, string themeName);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class ThemeService : ServiceBase, IThemeService
|
||||
{
|
||||
|
@ -9,6 +9,18 @@ using NodaTime.Extensions;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to retrieve <see cref="TimeZone"/> entries
|
||||
/// </summary>
|
||||
public interface ITimeZoneService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the list of time zones
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
List<Models.TimeZone> GetTimeZones();
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class TimeZoneService : ITimeZoneService
|
||||
{
|
||||
|
@ -9,6 +9,56 @@ using System.Net;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage <see cref="UrlMapping"/>s on a <see cref="Site"/>
|
||||
/// </summary>
|
||||
public interface IUrlMappingService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all <see cref="UrlMapping"/>s of this <see cref="Site"/>.
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID-reference of a <see cref="Site"/></param>
|
||||
/// <returns></returns>
|
||||
Task<List<UrlMapping>> GetUrlMappingsAsync(int siteId, bool isMapped);
|
||||
|
||||
/// <summary>
|
||||
/// Get one specific <see cref="UrlMapping"/>
|
||||
/// </summary>
|
||||
/// <param name="urlMappingId">ID-reference of a <see cref="UrlMapping"/></param>
|
||||
/// <returns></returns>
|
||||
Task<UrlMapping> GetUrlMappingAsync(int urlMappingId);
|
||||
|
||||
/// <summary>
|
||||
/// Get one specific <see cref="UrlMapping"/>
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID-reference of a <see cref="Site"/></param>
|
||||
/// <param name="url">A url</param>
|
||||
/// <returns></returns>
|
||||
Task<UrlMapping> GetUrlMappingAsync(int siteId, string url);
|
||||
|
||||
/// <summary>
|
||||
/// Add / save a new <see cref="UrlMapping"/> to the database.
|
||||
/// </summary>
|
||||
/// <param name="urlMapping"></param>
|
||||
/// <returns></returns>
|
||||
Task<UrlMapping> AddUrlMappingAsync(UrlMapping urlMapping);
|
||||
|
||||
/// <summary>
|
||||
/// Update a <see cref="UrlMapping"/> in the database.
|
||||
/// </summary>
|
||||
/// <param name="urlMapping"></param>
|
||||
/// <returns></returns>
|
||||
Task<UrlMapping> UpdateUrlMappingAsync(UrlMapping urlMapping);
|
||||
|
||||
/// <summary>
|
||||
/// Delete a <see cref="UrlMapping"/> in the database.
|
||||
/// </summary>
|
||||
/// <param name="urlMappingId">ID-reference of a <see cref="UrlMapping"/></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteUrlMappingAsync(int urlMappingId);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class UrlMappingService : ServiceBase, IUrlMappingService
|
||||
{
|
||||
|
@ -7,6 +7,72 @@ using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Manage <see cref="Role"/>s assigned to a specific <see cref="User"/>
|
||||
/// </summary>
|
||||
public interface IUserRoleService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all <see cref="UserRole"/>s on a <see cref="Site"/>
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID-reference to a <see cref="Site"/></param>
|
||||
/// <returns></returns>
|
||||
Task<List<UserRole>> GetUserRolesAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Get all <see cref="UserRole"/>s on a <see cref="Site"/>
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID-reference to a <see cref="Site"/></param>
|
||||
/// <param name="userId">ID-reference to a <see cref="User"/></param>
|
||||
/// <returns></returns>
|
||||
Task<List<UserRole>> GetUserRolesAsync(int siteId, int userId);
|
||||
|
||||
/// <summary>
|
||||
/// Get all <see cref="UserRole"/>s on a <see cref="Site"/>
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID-reference to a <see cref="Site"/></param>
|
||||
/// <param name="roleName">Name reference a <see cref="Role"/></param>
|
||||
/// <returns></returns>
|
||||
Task<List<UserRole>> GetUserRolesAsync(int siteId, string roleName);
|
||||
|
||||
/// <summary>
|
||||
/// Get all <see cref="UserRole"/>s on a <see cref="Site"/>
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID-reference to a <see cref="Site"/></param>
|
||||
/// <param name="userId">ID-reference to a <see cref="User"/></param>
|
||||
/// <param name="roleName">Name reference a <see cref="Role"/></param>
|
||||
/// <returns></returns>
|
||||
Task<List<UserRole>> GetUserRolesAsync(int siteId, int userId, string roleName);
|
||||
|
||||
/// <summary>
|
||||
/// Get one specific <see cref="UserRole"/>
|
||||
/// </summary>
|
||||
/// <param name="userRoleId">ID-reference to a <see cref="UserRole"/></param>
|
||||
/// <returns></returns>
|
||||
Task<UserRole> GetUserRoleAsync(int userRoleId);
|
||||
|
||||
/// <summary>
|
||||
/// Save a new <see cref="UserRole"/>
|
||||
/// </summary>
|
||||
/// <param name="userRole"></param>
|
||||
/// <returns></returns>
|
||||
Task<UserRole> AddUserRoleAsync(UserRole userRole);
|
||||
|
||||
/// <summary>
|
||||
/// Update a <see cref="UserRole"/> in the database
|
||||
/// </summary>
|
||||
/// <param name="userRole"></param>
|
||||
/// <returns></returns>
|
||||
Task<UserRole> UpdateUserRoleAsync(UserRole userRole);
|
||||
|
||||
/// <summary>
|
||||
/// Delete a <see cref="UserRole"/> in the database
|
||||
/// </summary>
|
||||
/// <param name="userRoleId"></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteUserRoleAsync(int userRoleId);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class UserRoleService : ServiceBase, IUserRoleService
|
||||
{
|
||||
|
@ -6,12 +6,174 @@ using Oqtane.Documentation;
|
||||
using System.Net;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using Oqtane.Modules.Admin.Roles;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Manage (get / update) user information
|
||||
/// </summary>
|
||||
public interface IUserService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get a <see cref="User"/> of a specific site
|
||||
/// </summary>
|
||||
/// <param name="userId">ID of a <see cref="User"/></param>
|
||||
/// <param name="siteId">ID of a <see cref="Site"/></param>
|
||||
/// <returns></returns>
|
||||
Task<User> GetUserAsync(int userId, int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Get a <see cref="User"/> of a specific site
|
||||
/// </summary>
|
||||
/// <param name="username">Username / login of a <see cref="User"/></param>
|
||||
/// <param name="siteId">ID of a <see cref="Site"/></param>
|
||||
/// <returns></returns>
|
||||
Task<User> GetUserAsync(string username, int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Get a <see cref="User"/> of a specific site
|
||||
/// </summary>
|
||||
/// <param name="username">Username / login of a <see cref="User"/></param>
|
||||
/// <param name="email">email address of a <see cref="User"/></param>
|
||||
/// <param name="siteId">ID of a <see cref="Site"/></param>
|
||||
/// <returns></returns>
|
||||
Task<User> GetUserAsync(string username, string email, int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Save a user to the Database.
|
||||
/// The <see cref="User"/> object contains all the information incl. what <see cref="Site"/> it belongs to.
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <returns></returns>
|
||||
Task<User> AddUserAsync(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Update an existing user in the database.
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <returns></returns>
|
||||
Task<User> UpdateUserAsync(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Delete / remove a user in the database
|
||||
/// </summary>
|
||||
/// <param name="userId">ID-reference to the <see cref="User"/></param>
|
||||
/// <param name="siteId">ID-reference to the <see cref="Site"/></param>
|
||||
/// <returns></returns>
|
||||
Task DeleteUserAsync(int userId, int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Will login the specified <see cref="User"/>.
|
||||
///
|
||||
/// Note that this will probably not be a real User, but a user object where the `Username` and `Password` have been filled.
|
||||
/// </summary>
|
||||
/// <param name="user">A <see cref="User"/> object which should have at least the <see cref="User.Username"/> and <see cref="User.Password"/> set.</param>
|
||||
/// <param name="setCookie">Determines if the login cookie should be set (only relevant for Hybrid scenarios)</param>
|
||||
/// <param name="isPersistent">Determines if the login cookie should be persisted for a long time.</param>
|
||||
/// <returns></returns>
|
||||
Task<User> LoginUserAsync(User user, bool setCookie, bool isPersistent);
|
||||
|
||||
/// <summary>
|
||||
/// Logout a <see cref="User"/>
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <returns></returns>
|
||||
Task LogoutUserAsync(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Logout a <see cref="User"/>
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <returns></returns>
|
||||
Task LogoutUserEverywhereAsync(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Update e-mail verification status of a user.
|
||||
/// </summary>
|
||||
/// <param name="user">The <see cref="User"/> we're verifying</param>
|
||||
/// <param name="token">A Hash value in the URL which verifies this user got the e-mail (containing this token)</param>
|
||||
/// <returns></returns>
|
||||
Task<User> VerifyEmailAsync(User user, string token);
|
||||
|
||||
/// <summary>
|
||||
/// Trigger a forgot-password e-mail for this <see cref="User"/>.
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <returns></returns>
|
||||
Task ForgotPasswordAsync(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Reset the password of this <see cref="User"/>
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<User> ResetPasswordAsync(User user, string token);
|
||||
|
||||
/// <summary>
|
||||
/// Verify the two factor verification code <see cref="User"/>
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<User> VerifyTwoFactorAsync(User user, string token);
|
||||
|
||||
/// <summary>
|
||||
/// Validate identity user info.
|
||||
/// </summary>
|
||||
/// <param name="username"></param>
|
||||
/// <param name="email"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <returns></returns>
|
||||
Task<UserValidateResult> ValidateUserAsync(string username, string email, string password);
|
||||
|
||||
/// <summary>
|
||||
/// Validate a users password against the password policy
|
||||
/// </summary>
|
||||
/// <param name="password"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> ValidatePasswordAsync(string password);
|
||||
|
||||
/// <summary>
|
||||
/// Get token for current user
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<string> GetTokenAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Get personal access token for current user (administrators only)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<string> GetPersonalAccessTokenAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Link an external login with a local user account
|
||||
/// </summary>
|
||||
/// <param name="user">The <see cref="User"/> we're verifying</param>
|
||||
/// <param name="token">A Hash value in the URL which verifies this user got the e-mail (containing this token)</param>
|
||||
/// <param name="type">External Login provider type</param>
|
||||
/// <param name="key">External Login provider key</param>
|
||||
/// <param name="name">External Login provider display name</param>
|
||||
/// <returns></returns>
|
||||
Task<User> LinkUserAsync(User user, string token, string type, string key, string name);
|
||||
|
||||
/// <summary>
|
||||
/// Get password requirements for site
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID of a <see cref="Site"/></param>
|
||||
/// <returns></returns>
|
||||
Task<string> GetPasswordRequirementsAsync(int siteId);
|
||||
|
||||
/// <summary>
|
||||
/// Bulk import of users
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID of a <see cref="Site"/></param>
|
||||
/// <param name="fileId">ID of a <see cref="File"/></param>
|
||||
/// <param name="notify">Indicates if new users should be notified by email</param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> ImportUsersAsync(int siteId, int fileId, bool notify);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class UserService : ServiceBase, IUserService
|
||||
{
|
||||
|
@ -10,6 +10,28 @@ using System.Globalization;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Service to manage <see cref="Visitor"/>s on a <see cref="Site"/>
|
||||
/// </summary>
|
||||
public interface IVisitorService
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all <see cref="Visitor"/>s of this <see cref="Site"/>.
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId">ID-reference of a <see cref="Site"/></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Visitor>> GetVisitorsAsync(int siteId, DateTime fromDate);
|
||||
|
||||
/// <summary>
|
||||
/// Get a specific <see cref="Visitor"/> of this <see cref="Site"/>.
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="visitorId">ID-reference of a <see cref="Visitor"/></param>
|
||||
/// <returns></returns>
|
||||
Task<Visitor> GetVisitorAsync(int visitorId);
|
||||
}
|
||||
|
||||
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
|
||||
public class VisitorService : ServiceBase, IVisitorService
|
||||
{
|
||||
|
Reference in New Issue
Block a user