feat(protocol): API v1 contract and typed client

DTOs for auth, users, sequences, frames, manifests, uploads, jobs,
render nodes, events and LAN discovery; TitanoClient with TOFU
certificate pinning, bearer auth, resumable SHA-256-verified chunked
uploads with retry/backoff, shared bandwidth limiter and the event
WebSocket stream.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-02 09:41:20 +00:00
1 parent 2944e6ebb5
commit 83d8cd79bd
12 files changed
+751 -11

No files matched your search

+104
View File
@@ -0,0 +1,104 @@
namespace Titano.Protocol;
/// <summary>Sequence summary for lists (BRIEF §12.2 card data).</summary>
public sealed record SequenceDto(
Guid Id,
string? Title,
string DisplayTitle,
string Folder,
string? CameraMake,
string? CameraModel,
string? Lens,
DateTime? FirstCapture,
DateTime? LastCapture,
int FrameCount,
double? MedianInterval,
long TotalBytes,
long Status,
int RenderedCount,
Guid? HeroFrameId,
IReadOnlyList<string> Tags,
int Rating,
string? Notes,
int SettingsVersion,
int FramesVersion,
int WarningCount,
Guid? OwnerUserId,
DateTimeOffset UpdatedAt);
/// <summary>A page of results with an opaque keyset cursor; null cursor = last page.</summary>
public sealed record Page<T>(IReadOnlyList<T> Items, string? NextCursor, long? Total);
/// <summary><c>POST /api/v1/sequences</c>.</summary>
public sealed record CreateSequenceRequest(string? Title, string? CameraHint);
/// <summary><c>PATCH /api/v1/sequences/{id}</c>. <see cref="ExpectedSettingsVersion"/> enables conflict detection (409).</summary>
public sealed record UpdateSequenceRequest(
string? Title,
IReadOnlyList<string>? Tags,
int? Rating,
string? Notes,
string? SettingsJson,
int? ExpectedSettingsVersion);
public sealed record FrameDto(
Guid Id,
Guid SequenceId,
int Index,
string FileName,
long Size,
string? Sha256,
DateTime? CapturedAt,
int? UtcOffsetMinutes,
double? ExposureTime,
double? FNumber,
int? Iso,
double? FocalLength,
int Orientation,
int Width,
int Height,
string Format,
long Flags);
/// <summary><c>GET /api/v1/sequences/{id}/manifest</c>: what a client needs to diff a sequence (BRIEF §14.5).</summary>
public sealed record SequenceManifest(
Guid SequenceId,
int FramesVersion,
int SettingsVersion,
string? SettingsJson,
IReadOnlyList<string> Tags,
IReadOnlyList<ManifestFrame> Frames,
IReadOnlyList<RenderDto> Renders);
public sealed record ManifestFrame(Guid Id, int Index, string FileName, long Size, string Sha256, bool HasProxy, bool HasThumb);
public sealed record RenderDto(
Guid Id,
string PresetName,
string? Codec,
int Width,
int Height,
double Fps,
double DurationSeconds,
long Bytes,
DateTimeOffset Created,
string? ProducedBy);
/// <summary>Aggregates for the archive dashboard and the admin panel.</summary>
public sealed record ArchiveStatsDto(
long Sequences,
long Photos,
long Bytes,
long FreeBytes,
long CapacityBytes,
int Cameras,
int? FirstYear,
int? LastYear,
IReadOnlyList<KeyValueCount> ByYear,
IReadOnlyList<KeyValueCount> ByMonth,
IReadOnlyList<KeyValueCount> ByCamera,
IReadOnlyList<KeyValueCount> ByFormat,
int SequencesWithoutProxies,
int UnverifiedSequences);
public sealed record KeyValueCount(string Key, long Count, long Bytes);