paths
paths
#
Request models for the CaptureGraph captured-data file API.
Pydantic models the server and its clients (capturegraph-sync, the iOS client) exchange. A single-file transfer addresses its leaf in the URL and carries metadata in headers, so the models here are the batch request shapes plus the caller profile every request stamps into its headers:
- [LeafResolveRequest][] / [LeafResolveEntry][] —
POST files:resolve, a batch of (path, cached version) leaves answered positionally by LeafResolveResponse. - [FileSaveRequest][] / [FileSaveEntry][] —
POST files:save, many small files uploaded inline in one round trip, answered by FileSaveResponse. - [RequestProfileModel][] / [LocationModel][] — the caller's identity
and opted-in position, carried in
X-CG-*headers (seeheaders.py).
Each path is the chain of on-disk folder names from the target root, its last
component the leaf stem (no extension); the server resolves it against the
target's declared schema. See docs/dsl/captured-data-format.md for the spec.
FileSaveEntry
#
Bases: BaseModel
One small file in a batch save request.
path addresses the leaf (last component is its stem); extension is the
bytes' actual on-disk extension (must be one the leaf's scalar declares); and
data_base64 carries the bytes themselves. The batch is for many tiny files
— a larger file uses a single streaming PUT files/{path} instead.
Source code in capturegraph-lib/capturegraph/api_models/paths.py
FileSaveRequest
#
Bases: BaseModel
Request body for the files:save batch endpoint.
Every entry is validated against the schema before anything is written, so the batch either applies in full or fails with no partial write.
Source code in capturegraph-lib/capturegraph/api_models/paths.py
LeafResolveEntry
#
Bases: BaseModel
One leaf in a batch resolve request.
path is the chain of on-disk folder names to the leaf, its last component
the leaf stem. known_version is the content version the client currently
has cached, or None when it holds no copy; the server compares it against
the leaf's current version to decide unchanged vs present.
Source code in capturegraph-lib/capturegraph/api_models/paths.py
LeafResolveRequest
#
Bases: BaseModel
Request body for the files:resolve batch endpoint.
results[i] of the response corresponds to entries[i].
Source code in capturegraph-lib/capturegraph/api_models/paths.py
LocationModel
#
Bases: BaseModel
A geographic position carried as request context.
The WGS84 fields of the edu.cornell.location value
(altitude_meters/heading_degrees default to 0.0), declared in
the X-CG-Location header's field order. A plain mirror so
[api_models][] stays decoupled from the type system; the server converts
it to a cg.Location at the interceptor boundary.
Source code in capturegraph-lib/capturegraph/api_models/paths.py
RequestProfileModel
#
Bases: BaseModel
Who (and optionally where) a request comes from.
user_id is the requesting client's identity so interceptor-backed leaves
can resolve per-user; location is the caller's position when they have
opted in to sharing it with this server. Built server-side from the request's
X-CG-User-Id / X-CG-Location headers; both absent by default.