Files
MagNetFlix/docs/api_spec.md
kiskaadee 9edc5e20cf feat(contracts): create services/contracts workspace package and commit stubs
- Create services/contracts workspace package with module magnetflix.
- Reconfigure buf.gen.yaml to output stubs once into services/contracts/src.
- Remove stubs and docs/api_spec.md from .gitignore and track in Git.
- Add public seam tests in tests/test_contracts.py.

Closes #1
2026-10-31 20:48:58 -05:00

9.3 KiB
Raw Permalink Blame History

Protocol Documentation

Table of Contents

Top

magnetflix/v1/pipeline.proto

GetJobRequest

Request to fetch a specific job by ID.

Field Type Label Description
job_id string Unique job identifier.

GetJobResponse

Response containing the status of the requested job.

Field Type Label Description
job JobStatus The retrieved job details.

JobStatus

Full status information for a download job.

Field Type Label Description
job_id string Unique job ID.
imdb_id string IMDb ID.
title string Resolved movie title from TMDB (if available).
year int32 Resolved release year from TMDB (if available).
requested_by string User who requested the download.
state JobState Current state in the pipeline.
progress_pct float Download progress percentage (0.0 to 100.0).
download_rate_bytes int64 Download speed in bytes per second.
error_message string Detailed error message if the job failed.
created_at google.protobuf.Timestamp Timestamp when the job was enqueued.
updated_at google.protobuf.Timestamp Timestamp when the job status or progress was last updated.
completed_at google.protobuf.Timestamp Timestamp when terminal processing finished (COMPLETED or FAILED).

ListJobsRequest

Request to list jobs with pagination and state filtering.

Field Type Label Description
page_size int32 Maximum number of jobs to return per page (default: 20, max: 100).
page_token string Page token received from a previous ListJobsResponse next_page_token.
state_filter JobState Optional filter by job state.

ListJobsResponse

Paginated response containing a list of download jobs.

Field Type Label Description
jobs JobStatus repeated List of matching jobs for the current page.
next_page_token string Token to retrieve the next page of results, or empty if no more results.

StreamJobStatusRequest

Request to stream job updates.

Field Type Label Description
job_id string Optional job ID to filter updates for a single job; if empty, streams all active jobs.

StreamJobStatusResponse

Real-time job status event stream frame.

Field Type Label Description
job JobStatus Current job status update.

SubmitDownloadRequest

Request to submit a new movie download.

Field Type Label Description
magnet_uri string Magnet URI of the torrent to fetch.
imdb_id string IMDb ID of the movie (e.g., "tt1375666").
requested_by string Username of the user requesting the download (from Authelia Remote-User).

SubmitDownloadResponse

Response acknowledging the job submission.

Field Type Label Description
job_id string Unique identifier for the created job.
message string Human-readable message.

JobState

State enumeration of a download job lifecycle.

Name Number Description
JOB_STATE_UNSPECIFIED 0
JOB_STATE_QUEUED 1
JOB_STATE_DOWNLOADING 2
JOB_STATE_SCANNING 3
JOB_STATE_VERIFYING_METADATA 4
JOB_STATE_ORGANIZING 5
JOB_STATE_COMPLETED 6
JOB_STATE_FAILED 7

PipelineService

PipelineService coordinates movie download jobs, safety scans, and library relocation.

Method Name Request Type Response Type Description
SubmitDownload SubmitDownloadRequest SubmitDownloadResponse SubmitDownload enqueues a new movie download job. Rejects duplicate submissions if an active job for the same IMDb ID exists or if already in library.
GetJob GetJobRequest GetJobResponse GetJob retrieves the current status and metadata of a specific job.
StreamJobStatus StreamJobStatusRequest StreamJobStatusResponse stream StreamJobStatus streams real-time status updates. Semantics: Emits an immediate snapshot of matching active jobs upon connection, followed by subsequent state and progress change events.
ListJobs ListJobsRequest ListJobsResponse ListJobs returns a paginated list of download jobs.

Scalar Value Types

.proto Type Notes C++ Java Python Go C# PHP Ruby
double double double float float64 double float Float
float float float float float32 float float Float
int32 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. int32 int int int32 int integer Bignum or Fixnum (as required)
int64 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. int64 long int/long int64 long integer/string Bignum
uint32 Uses variable-length encoding. uint32 int int/long uint32 uint integer Bignum or Fixnum (as required)
uint64 Uses variable-length encoding. uint64 long int/long uint64 ulong integer/string Bignum or Fixnum (as required)
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int32 int int int32 int integer Bignum or Fixnum (as required)
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int64 long int/long int64 long integer/string Bignum
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 2^28. uint32 int int uint32 uint integer Bignum or Fixnum (as required)
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 2^56. uint64 long int/long uint64 ulong integer/string Bignum
sfixed32 Always four bytes. int32 int int int32 int integer Bignum or Fixnum (as required)
sfixed64 Always eight bytes. int64 long int/long int64 long integer/string Bignum
bool bool boolean boolean bool bool boolean TrueClass/FalseClass
string A string must always contain UTF-8 encoded or 7-bit ASCII text. string String str/unicode string string string String (UTF-8)
bytes May contain any arbitrary sequence of bytes. string ByteString str []byte ByteString string String (ASCII-8BIT)