Skip to main content

orgversion API

Table of Contents​

Top

upsquad/orgversion/v1/version.proto​

DiffVersionsRequest​

DiffVersionsRequest names the two versions to compare.

FieldTypeLabelDescription
from_version_idstringThe earlier ("before") version id (UUID).
to_version_idstringThe later ("after") version id (UUID).

DiffVersionsResponse​

DiffVersionsResponse carries the structural change list between the two.

FieldTypeLabelDescription
changesVersionChangerepeatedThe structural changes (members + units).

GetTreeAtRequest​

GetTreeAtRequest selects a point in history by timestamp or version_seq. If version_seq is non-zero it takes precedence; otherwise at_timestamp is used. The org is taken from the caller's scope.

FieldTypeLabelDescription
at_timestampgoogle.protobuf.TimestampReconstruct the tree as of the latest version at or before this time.
version_seqint64Reconstruct the tree at exactly this version_seq (takes precedence).

GetTreeAtResponse​

GetTreeAtResponse is the reconstructed org tree at the resolved version.

FieldTypeLabelDescription
membersTreeMemberNoderepeatedMembers alive at the resolved version.
unitsTreeUnitNoderepeatedUnits alive at the resolved version.
resolved_version_seqint64The version_seq the request resolved to (0 if no version existed yet).

GetVersionRequest​

GetVersionRequest identifies one version by id.

FieldTypeLabelDescription
version_idstringThe version row id (UUID).

GetVersionResponse​

GetVersionResponse carries a version's metadata plus its change list.

FieldTypeLabelDescription
versionVersionThe version metadata.
changesVersionChangerepeatedThe change list (diff against the immediately preceding version).

ListVersionsRequest​

ListVersionsRequest pages the org's version history. The org is taken from the caller's scope.

FieldTypeLabelDescription
page_sizeint32Max versions to return (1..100; default 50).
page_tokenint64Keyset cursor: return versions with version_seq strictly below this value. Zero starts at the newest version.

ListVersionsResponse​

ListVersionsResponse carries one page of versions, newest first.

FieldTypeLabelDescription
versionsVersionrepeatedThe page of versions.
next_page_tokenint64Cursor for the next page; zero when the history is exhausted.

RestoreAsDraftRequest​

RestoreAsDraftRequest names the version to restore to. The org is taken from the caller's scope.

FieldTypeLabelDescription
version_idstringThe target version to restore the org structure to (UUID).

RestoreAsDraftResponse​

RestoreAsDraftResponse carries the synthesised restore (founder Design Call 3, non-destructive).

FieldTypeLabelDescription
draft_idstringThe created draft id (UUID) when OrgDraftService is wired; empty otherwise.
opsRestoreOprepeatedThe synthesised inverse op-set (always populated). When draft_id is empty this is the payload OrgDraftService (#1322) will consume to build a draft.
pending_draft_serviceboolTrue when OrgDraftService is not yet wired and ops are returned inline for the caller to materialise once #1322 lands.

RestoreOp​

RestoreOp is one synthesised inverse operation a restore would apply. Its shape is what OrgDraftService (#1322) consumes to build a restore draft.

FieldTypeLabelDescription
op_typestringcreate
target_member_idstringThe member the op acts on (UUID); empty for create.
payloadgoogle.protobuf.StructOp-specific arguments (e.g. new_reports_to, clearance) as a JSON struct.

TreeMemberNode​

TreeMemberNode is one member in a reconstructed point-in-time tree.

FieldTypeLabelDescription
idstringMember id (UUID).
reports_tostringSupervisor member id (UUID); empty for roots.
member_typestring"human" or "agent".
display_namestringDisplay name.
clearanceint32Clearance level 1..5.
statusstringLifecycle status (active / pending_reassignment / ...).

TreeUnitNode​

TreeUnitNode is one org unit in a reconstructed point-in-time tree.

FieldTypeLabelDescription
idstringUnit id (UUID).
parent_idstringParent unit id (UUID); empty for roots.
namestringUnit name.
unit_typestring"team" or "pillar".

Version​

Version is the metadata of one immutable org_versions row.

FieldTypeLabelDescription
version_idstringOpaque version row id (UUID).
org_idstringThe owning organisation (UUID).
version_seqint64Per-org monotonic sequence number (1-based, gap-free).
created_bystringThe acting member id (UUID); empty for system / sync writes.
sourceVersionSourceWhich write path produced this version.
source_refstringProvenance ref: draft id
approval_idstringSoft ref to a governance approval (UUID); empty when none.
summarystringHuman label for the version list.
change_countint32Count of entity changes in this version (UI "N changes" badge).
is_keyframeboolWhether this version stores a full tree snapshot.
created_atgoogle.protobuf.TimestampWhen the version was captured.

VersionChange​

VersionChange is one structural change between two trees.

FieldTypeLabelDescription
change_typeChangeTypeWhat kind of change this is.
entity_typeEntityTypeWhether the changed entity is a member or a unit.
target_idstringThe changed entity's id (UUID).
beforegoogle.protobuf.StructThe entity's state in the earlier tree (null for additions).
aftergoogle.protobuf.StructThe entity's state in the later tree (null for removals).

ChangeType​

ChangeType classifies a single structural change in a version diff.

NameNumberDescription
CHANGE_TYPE_UNSPECIFIED0Unset / unknown change type.
CHANGE_TYPE_ADDED1The entity exists in the later tree but not the earlier one.
CHANGE_TYPE_REMOVED2The entity exists in the earlier tree but not the later one.
CHANGE_TYPE_MOVED3The entity's parent (reports_to / parent_id) changed.
CHANGE_TYPE_FIELD_CHANGED4A non-parent field changed (clearance / role / status).
CHANGE_TYPE_RENAMED5A unit's name changed.

EntityType​

EntityType distinguishes the two kinds of node a change can touch.

NameNumberDescription
ENTITY_TYPE_UNSPECIFIED0Unset / unknown entity type.
ENTITY_TYPE_MEMBER1A member (human or agent) in the reporting tree.
ENTITY_TYPE_UNIT2An org unit (team or pillar).

VersionSource​

VersionSource records which write path produced a version.

NameNumberDescription
VERSION_SOURCE_UNSPECIFIED0Unset / unknown source.
VERSION_SOURCE_DRAFT1Published from an OrgDraftService draft (N ops → 1 version).
VERSION_SOURCE_DIRECT2A single direct mutation RPC (1 RPC → 1 version).
VERSION_SOURCE_IMPORT3A bulk import batch (1 import → 1 version).

OrgVersionService​

OrgVersionService is the external (Connect / gRPC) surface for org-structure version history. All operations are tenant-scoped via JWT-derived scope claims and PostgreSQL row-level security.

Method NameRequest TypeResponse TypeDescription
ListVersionsListVersionsRequestListVersionsResponseListVersions returns the org's version history, newest first. The org is taken from the caller's scope; pagination is keyset on version_seq.
GetVersionGetVersionRequestGetVersionResponseGetVersion returns one version's metadata plus its change list (the diff against the immediately preceding version), powering the "Changes in this version" pane.
GetTreeAtGetTreeAtRequestGetTreeAtResponseGetTreeAt reconstructs the org tree as of a past point in time (by timestamp) or at a specific version_seq. Reconstruction reads the nearest preceding keyframe and replays forward deltas. Read-only.
DiffVersionsDiffVersionsRequestDiffVersionsResponseDiffVersions computes the structural diff between two versions: per member (added / removed / moved / field-changed) and per unit (added / removed / moved / renamed). Read-only.
RestoreAsDraftRestoreAsDraftRequestRestoreAsDraftResponseRestoreAsDraft synthesises the inverse op-set transforming the current tree back to the target version (founder Design Call 3, non-destructive). When OrgDraftService (#1322) is wired it materialises a real draft and returns its id; until then it returns the op-set inline with pending_draft_service = true. Never mutates the live org.

Scalar Value Types​

.proto TypeNotesC++JavaPythonGoC#PHPRuby
doubledoubledoublefloatfloat64doublefloatFloat
floatfloatfloatfloatfloat32floatfloatFloat
int32Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.int32intintint32intintegerBignum or Fixnum (as required)
int64Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.int64longint/longint64longinteger/stringBignum
uint32Uses variable-length encoding.uint32intint/longuint32uintintegerBignum or Fixnum (as required)
uint64Uses variable-length encoding.uint64longint/longuint64ulonginteger/stringBignum or Fixnum (as required)
sint32Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.int32intintint32intintegerBignum or Fixnum (as required)
sint64Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.int64longint/longint64longinteger/stringBignum
fixed32Always four bytes. More efficient than uint32 if values are often greater than 2^28.uint32intintuint32uintintegerBignum or Fixnum (as required)
fixed64Always eight bytes. More efficient than uint64 if values are often greater than 2^56.uint64longint/longuint64ulonginteger/stringBignum
sfixed32Always four bytes.int32intintint32intintegerBignum or Fixnum (as required)
sfixed64Always eight bytes.int64longint/longint64longinteger/stringBignum
boolboolbooleanbooleanboolboolbooleanTrueClass/FalseClass
stringA string must always contain UTF-8 encoded or 7-bit ASCII text.stringStringstr/unicodestringstringstringString (UTF-8)
bytesMay contain any arbitrary sequence of bytes.stringByteStringstr[]byteByteStringstringString (ASCII-8BIT)