Files
Umbraco-CMS/src/Umbraco.Core/Services/IScriptService.cs
Kenn Jacobsen e4f9f98f2d File system endpoints redo (#15521)
* First stab at a massive remake of file system based endpoints

* Do not prefix system paths with directory separator char

* Ensure correct and consistent response types

* Fix partial view snippets endpoints

* Clean up IO (path) operations

* Update OpenAPI JSON to match new endpoints

* Return 201 when renaming file system resources

* Add "IsFolder" to file system item endpoints

* Replace "parentPath" with a "parent" object for file system creation endpoints

* Update OpenAPI JSON

* Rewrite snippets

* Regenerate OpenAPI JSON after forward merge

* Remove stylesheet overview endpoint

* Regenerate OpenAPI JSON after forward merge

* add server-file-system module to importmap

* Expose generated resource identifier in 201 responses

---------

Co-authored-by: Mads Rasmussen <madsr@hey.com>
2024-01-22 08:20:45 +01:00

42 lines
2.2 KiB
C#

using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Services.OperationStatus;
namespace Umbraco.Cms.Core.Services;
public interface IScriptService : IBasicFileService<IScript>
{
/// <summary>
/// Creates a new script.
/// </summary>
/// <param name="createModel"><see cref="ScriptCreateModel"/> containing the information about the script being created.</param>
/// <param name="userKey">The key of the user performing the operation.</param>
/// <returns>An attempt indicating if the operation was a success as well as a more detailed <see cref="ScriptOperationStatus"/>.</returns>
Task<Attempt<IScript?, ScriptOperationStatus>> CreateAsync(ScriptCreateModel createModel, Guid userKey);
/// <summary>
/// Updates an existing script.
/// </summary>
/// <param name="path">The path of the script to update.</param>
/// <param name="updateModel">A <see cref="ScriptUpdateModel"/> with the changes.</param>
/// <param name="userKey">The key of the user performing the operation.</param>
/// <returns>An attempt indicating if the operation was a success as well as a more detailed <see cref="ScriptOperationStatus"/>.</returns>
Task<Attempt<IScript?, ScriptOperationStatus>> UpdateAsync(string path, ScriptUpdateModel updateModel, Guid userKey);
/// <summary>
/// Deletes a Script.
/// </summary>
/// <param name="path">The path of the script to delete.</param>
/// <param name="userKey">The key of the user performing the operation.</param>
/// <returns>An operation status.</returns>
Task<ScriptOperationStatus> DeleteAsync(string path, Guid userKey);
/// <summary>
/// Renames a script.
/// </summary>
/// <param name="path">The path of the script to rename.</param>
/// <param name="renameModel">A <see cref="ScriptRenameModel"/> with the changes.</param>
/// <param name="userKey">The key of the user performing the operation.</param>
/// <returns>An attempt indicating if the operation was a success as well as a more detailed <see cref="ScriptOperationStatus"/>.</returns>
Task<Attempt<IScript?, ScriptOperationStatus>> RenameAsync(string path, ScriptRenameModel renameModel, Guid userKey);
}