mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 08:11:10 +00:00
Wires book reader consumption reporting and resume
This commit is contained in:
1 parent
bfa7b190b2
commit
8011c532a1
28 files changed
+1037
-167
No files matched your search
@@ -0,0 +1,28 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Enums.MediaConsumption;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.DTO.MediaConsumption;
|
||||
|
||||
/// <summary>
|
||||
/// Data transfer object for the point at which a user can resume consuming a media item.
|
||||
/// </summary>
|
||||
/// <param name="Id">The Id of the resume point.</param>
|
||||
/// <param name="LibraryId">The Id of the media library that contains the media item.</param>
|
||||
/// <param name="MediaItemId">The Id of the media item to resume.</param>
|
||||
/// <param name="MediaKind">The kind of media that is resumed.</param>
|
||||
/// <param name="LastPosition">The position at which the media item can be resumed.</param>
|
||||
/// <param name="LastProgressFraction">The progress fraction at which the media item can be resumed.</param>
|
||||
/// <param name="LastConsumedOnUtc">The date and time when the media item was last consumed.</param>
|
||||
[DebuggerDisplay("Id: {Id}; MediaKind: {MediaKind}; MediaItemId: {MediaItemId}")]
|
||||
public sealed record ResumePointDto(
|
||||
Guid Id,
|
||||
Guid LibraryId,
|
||||
Guid MediaItemId,
|
||||
MediaKind MediaKind,
|
||||
MediaPositionDto LastPosition,
|
||||
double LastProgressFraction,
|
||||
DateTime LastConsumedOnUtc
|
||||
);
|
||||
+5
-2
@@ -10,9 +10,12 @@ namespace Lumina.Presentation.Web.Common.Requests.MediaConsumption;
|
||||
/// <param name="Position">The final position reported for the media item, if the client knows it. Optional.</param>
|
||||
/// <param name="ProgressFraction">The fraction of the media item that the client reached, between 0 and 1. Required.</param>
|
||||
/// <param name="ConsumedDurationInSeconds">The active duration consumed by the session, in seconds. Required.</param>
|
||||
[DebuggerDisplay("ProgressFraction: {ProgressFraction}; ConsumedDurationInSeconds: {ConsumedDurationInSeconds}")]
|
||||
/// <param name="ConsecutivePagesRead">The number of consecutive pages read in the session, used by page based media such as books.
|
||||
/// It must be omitted or zero for other kinds; a positive value is rejected with a forbidden error. When omitted, the count stored by the last progress report is kept. Optional.</param>
|
||||
[DebuggerDisplay("ProgressFraction: {ProgressFraction}; ConsumedDurationInSeconds: {ConsumedDurationInSeconds}; ConsecutivePagesRead: {ConsecutivePagesRead}")]
|
||||
public sealed record CompleteConsumptionRequest(
|
||||
MediaPositionRequest? Position,
|
||||
double? ProgressFraction,
|
||||
double? ConsumedDurationInSeconds
|
||||
double? ConsumedDurationInSeconds,
|
||||
int? ConsecutivePagesRead = null
|
||||
);
|
||||
+2
-1
@@ -10,7 +10,8 @@ namespace Lumina.Presentation.Web.Common.Requests.MediaConsumption;
|
||||
/// <param name="Position">The last position reported for the media item, if the client knows it. Optional.</param>
|
||||
/// <param name="ProgressFraction">The fraction of the media item that the client reached, between 0 and 1. Required.</param>
|
||||
/// <param name="ConsumedDurationInSeconds">The active duration consumed by the session, in seconds. Required.</param>
|
||||
/// <param name="ConsecutivePagesRead">The number of consecutive pages read in the current session, used by page based media such as books and ignored for other kinds. Defaults to 0. Optional.</param>
|
||||
/// <param name="ConsecutivePagesRead">The number of consecutive pages read in the current session, used by page based media such as books.
|
||||
/// It must be zero for other kinds; a positive value is rejected with a forbidden error. Defaults to 0. Optional.</param>
|
||||
[DebuggerDisplay("ProgressFraction: {ProgressFraction}; ConsumedDurationInSeconds: {ConsumedDurationInSeconds}; ConsecutivePagesRead: {ConsecutivePagesRead}")]
|
||||
public sealed record ReportConsumptionProgressRequest(
|
||||
MediaPositionRequest? Position,
|
||||
|
||||
+5
-2
@@ -10,9 +10,12 @@ namespace Lumina.Presentation.Web.Common.Requests.MediaConsumption;
|
||||
/// <param name="Position">The final position reported for the media item, if the client knows it. Optional.</param>
|
||||
/// <param name="ProgressFraction">The fraction of the media item that the client reached, between 0 and 1. Required.</param>
|
||||
/// <param name="ConsumedDurationInSeconds">The active duration consumed by the session, in seconds. Required.</param>
|
||||
[DebuggerDisplay("ProgressFraction: {ProgressFraction}; ConsumedDurationInSeconds: {ConsumedDurationInSeconds}")]
|
||||
/// <param name="ConsecutivePagesRead">The number of consecutive pages read in the session, used by page based media such as books.
|
||||
/// It must be omitted or zero for other kinds; a positive value is rejected with a forbidden error. When omitted, the count stored by the last progress report is kept. Optional.</param>
|
||||
[DebuggerDisplay("ProgressFraction: {ProgressFraction}; ConsumedDurationInSeconds: {ConsumedDurationInSeconds}; ConsecutivePagesRead: {ConsecutivePagesRead}")]
|
||||
public sealed record StopConsumptionRequest(
|
||||
MediaPositionRequest? Position,
|
||||
double? ProgressFraction,
|
||||
double? ConsumedDurationInSeconds
|
||||
double? ConsumedDurationInSeconds,
|
||||
int? ConsecutivePagesRead = null
|
||||
);
|
||||
@@ -6,7 +6,7 @@ namespace Lumina.Presentation.Web.Common.Routes;
|
||||
public static partial class ApiRoutes
|
||||
{
|
||||
/// <summary>
|
||||
/// Routes for the media consumption lifecycle endpoints of the remote API.
|
||||
/// Routes for the media consumption lifecycle and resume point endpoints of the remote API.
|
||||
/// </summary>
|
||||
public static class MediaConsumption
|
||||
{
|
||||
@@ -14,5 +14,6 @@ public static partial class ApiRoutes
|
||||
public const string REPORT_CONSUMPTION_PROGRESS = "users/me/consumption-records/{recordId}/progress";
|
||||
public const string COMPLETE_CONSUMPTION = "users/me/consumption-records/{recordId}/complete";
|
||||
public const string STOP_CONSUMPTION = "users/me/consumption-records/{recordId}/stop";
|
||||
public const string GET_RESUME_POINT = "users/me/media-resume-points/{mediaKind}/{mediaItemId}";
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ namespace Lumina.Presentation.Web.Common.Routes;
|
||||
public static partial class WebRoutes
|
||||
{
|
||||
/// <summary>
|
||||
/// Routes for the media consumption lifecycle actions the browser clients report to, proxied to the remote API.
|
||||
/// Routes for the media consumption lifecycle actions and resume points the browser clients report to, proxied to the remote API.
|
||||
/// </summary>
|
||||
public static class MediaConsumption
|
||||
{
|
||||
@@ -14,5 +14,6 @@ public static partial class WebRoutes
|
||||
public const string REPORT_CONSUMPTION_PROGRESS = "{culture}/media-consumption/api-report-consumption-progress/{recordId}";
|
||||
public const string COMPLETE_CONSUMPTION = "{culture}/media-consumption/api-complete-consumption/{recordId}";
|
||||
public const string STOP_CONSUMPTION = "{culture}/media-consumption/api-stop-consumption/{recordId}";
|
||||
public const string GET_RESUME_POINT = "{culture}/media-consumption/api-get-resume-point/{mediaKind}/{mediaItemId}";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user