Skip to main content

orgdraft API

Table of Contents

Top

upsquad/orgdraft/v1/draft.proto

AddOpRequest

AddOpRequest appends one op to a draft.

FieldTypeLabelDescription
draft_idstringThe draft to append to (UUID).
op_typeOpTypeThe operation kind.
target_member_idstringThe member the op acts on (UUID); empty for create.
payloadgoogle.protobuf.StructOp-specific arguments (see HLD-B §5.2).

AddOpResponse

AddOpResponse carries the appended op with its assigned seq.

FieldTypeLabelDescription
opDraftOpThe appended op.

CreateDraftRequest

CreateDraftRequest opens a draft. The org is taken from the caller's scope.

FieldTypeLabelDescription
titlestringWorking-draft label (optional).

CreateDraftResponse

CreateDraftResponse carries the new draft.

FieldTypeLabelDescription
draftDraftThe created draft.

DiscardRequest

DiscardRequest discards a draft.

FieldTypeLabelDescription
draft_idstringThe draft to discard (UUID).

DiscardResponse

DiscardResponse confirms discard.

FieldTypeLabelDescription
discardedboolTrue when the draft transitioned to discarded.

Draft

Draft is one org_drafts header row.

FieldTypeLabelDescription
idstringDraft id (UUID).
org_idstringThe owning organisation (UUID).
titlestringWorking-draft label (may be empty).
created_bystringThe author member id (UUID).
statusDraftStatusLifecycle state.
base_version_idstringThe version this draft was opened against (UUID); empty when the org had no version history at creation.
approval_idstringThe governance approval opened on Publish (UUID); empty until then.
published_version_idstringThe org_versions row produced on successful publish (UUID); empty until published.
created_atgoogle.protobuf.TimestampWhen the draft was created.
updated_atgoogle.protobuf.TimestampWhen the draft was last modified.

DraftOp

DraftOp is one org_draft_ops row.

FieldTypeLabelDescription
idstringOp id (UUID).
draft_idstringThe owning draft (UUID).
seqint321-based apply order within the draft.
op_typeOpTypeThe operation kind.
target_member_idstringThe member the op acts on (UUID); empty for create.
payloadgoogle.protobuf.StructOp-specific arguments (see HLD-B §5.2).
last_validationOpVerdictThe most recent per-op verdict from Validate (null until first validated).
conflictboolWhether this op is currently flagged as a base-version conflict.

GetDraftRequest

GetDraftRequest deep-links a draft.

FieldTypeLabelDescription
draft_idstringThe draft to fetch (UUID).

GetDraftResponse

GetDraftResponse carries the header plus its ops.

FieldTypeLabelDescription
draftDraftThe draft header.
opsDraftOprepeatedThe draft's ops, ordered by seq ascending.

ListDraftsRequest

ListDraftsRequest pages the org's drafts.

FieldTypeLabelDescription
filterDraftFilterWhich slice to return.
page_sizeint32Max drafts to return (1..100; default 50).
page_tokenint64Keyset cursor (updated_at micros of the last row); zero starts at newest.

ListDraftsResponse

ListDraftsResponse carries one page of drafts, newest first.

FieldTypeLabelDescription
draftsDraftrepeatedThe page of drafts.
next_page_tokenint64Cursor for the next page; zero when exhausted.

ListOpsRequest

ListOpsRequest lists a draft's ops.

FieldTypeLabelDescription
draft_idstringThe draft to list (UUID).

ListOpsResponse

ListOpsResponse carries the ops in apply order.

FieldTypeLabelDescription
opsDraftOprepeatedThe ops, ordered by seq ascending.

OpVerdict

OpVerdict is the per-op result captured at Validate.

FieldTypeLabelDescription
seqint32The op's seq this verdict belongs to.
op_idstringThe op id (UUID) this verdict belongs to.
statusOpVerdictStatusValidity outcome.
fieldstringThe offending payload field, when status is INVALID (e.g. "reports_to").
messagestringHuman-readable explanation of an INVALID / CONFLICT verdict.

PublishRequest

PublishRequest publishes (or resumes publishing) a draft.

FieldTypeLabelDescription
draft_idstringThe draft to publish (UUID).

PublishResponse

PublishResponse carries the publish outcome.

FieldTypeLabelDescription
outcomePublishOutcomeHigh-level outcome.
version_idstringThe published org_versions row (UUID); set when outcome is PUBLISHED.
approval_idstringThe governance approval (UUID); set for both gated and auto-approved publishes.
statusDraftStatusThe draft's resulting status.
verdictsOpVerdictrepeatedPopulated when outcome is REJECTED: the failing verdicts.
created_member_idsstringrepeatedcreated_member_ids carries the UUIDs of members created by create ops in this publish, in op-sequence order. Populated when outcome is PUBLISHED so the frontend can act on a freshly added person (e.g. open their detail panel) without re-deriving the id from the tree. Empty when the publish created no members.

RemoveOpRequest

RemoveOpRequest deletes one op from a draft.

FieldTypeLabelDescription
draft_idstringThe owning draft (UUID).
op_idstringThe op to remove (UUID).

RemoveOpResponse

RemoveOpResponse confirms removal.

FieldTypeLabelDescription
removedboolTrue when the op existed and was removed.

ValidateRequest

ValidateRequest validates a draft.

FieldTypeLabelDescription
draft_idstringThe draft to validate (UUID).

ValidateResponse

ValidateResponse is the per-op validation report.

FieldTypeLabelDescription
verdictsOpVerdictrepeatedPer-op verdicts, ordered by seq.
publishableboolTrue iff every op is VALID and no op is CONFLICT (publishable).

DraftFilter

DraftFilter selects which drafts ListDrafts returns.

NameNumberDescription
DRAFT_FILTER_UNSPECIFIED0Default: open (non-terminal) drafts.
DRAFT_FILTER_OPEN1Only open drafts (draft / validating / pending_approval).
DRAFT_FILTER_MINE2Only the caller's own drafts.
DRAFT_FILTER_ALL3All drafts including published / discarded.

DraftStatus

DraftStatus is the draft lifecycle state.

NameNumberDescription
DRAFT_STATUS_UNSPECIFIED0Unset / unknown status.
DRAFT_STATUS_DRAFT1Editable; accepting ops.
DRAFT_STATUS_VALIDATING2A validation replay is in progress.
DRAFT_STATUS_PENDING_APPROVAL3Publish opened an approval and is holding the apply (two-phase gate).
DRAFT_STATUS_PUBLISHED4Applied; produced a published_version_id.
DRAFT_STATUS_DISCARDED5Abandoned; retained for audit, no longer editable.

OpType

OpType is the member-level operation kind (HLD-B §5.2). Unit-level ops (merge / split) are out of FW1 scope.

NameNumberDescription
OP_TYPE_UNSPECIFIED0Unset / unknown op type.
OP_TYPE_CREATE1Create a new member (target_member_id empty).
OP_TYPE_UPDATE2Update mutable fields of an existing member.
OP_TYPE_MOVE3Reparent a member (change reports_to).
OP_TYPE_REMOVE4Soft-delete a member, reparenting reports to a successor.
OP_TYPE_PROMOTE5Promote a member, optionally replacing another.

OpVerdictStatus

OpVerdictStatus is the validity outcome of one op at the last Validate.

NameNumberDescription
OP_VERDICT_STATUS_UNSPECIFIED0Not yet validated.
OP_VERDICT_STATUS_VALID1The op replayed cleanly against the cumulative working copy.
OP_VERDICT_STATUS_INVALID2The op failed a validator (cycle / clearance / email / missing target).
OP_VERDICT_STATUS_CONFLICT3The op's referenced member diverged from the draft's base version (Design Call 1, fail-closed). Publish aborts while any op is CONFLICT.

PublishOutcome

PublishOutcome is the high-level result of a Publish call.

NameNumberDescription
PUBLISH_OUTCOME_UNSPECIFIED0Unset / unknown outcome.
PUBLISH_OUTCOME_PUBLISHED1The draft applied and produced a version.
PUBLISH_OUTCOME_PENDING_APPROVAL2The draft is sensitive; an approval was opened and the apply is deferred.
PUBLISH_OUTCOME_REJECTED3Validation / conflict check failed; nothing was written.

OrgDraftService

OrgDraftService is the external (Connect / gRPC) surface for the org restructure draft workflow. All operations are tenant-scoped via the gateway-derived scope and PostgreSQL row-level security.

Method NameRequest TypeResponse TypeDescription
CreateDraftCreateDraftRequestCreateDraftResponseCreateDraft opens an empty draft anchored to the org's latest version (the optimistic-concurrency base for conflict detection).
AddOpAddOpRequestAddOpResponseAddOp appends one member-level op to a draft, assigning the next seq.
RemoveOpRemoveOpRequestRemoveOpResponseRemoveOp deletes one op from a draft and re-sequences the tail.
ListOpsListOpsRequestListOpsResponseListOps returns a draft's ops in apply order with their last verdicts.
GetDraftGetDraftRequestGetDraftResponseGetDraft returns a draft header plus its ops (deep-link into an in-progress draft).
ValidateValidateRequestValidateResponseValidate replays the ops into a doomed sub-transaction and returns per-op verdicts (valid / invalid / conflict). It never commits any mutation.
PublishPublishRequestPublishResponsePublish applies a validated draft. Two-phase (Design Call 2): sensitive drafts defer the apply until an ApprovalService grant; non-sensitive drafts apply immediately. Re-invoking Publish on a pending_approval draft resumes and applies once the approval is granted.
DiscardDiscardRequestDiscardResponseDiscard marks a draft discarded; its ops are retained for audit but the draft can no longer be edited or published.
ListDraftsListDraftsRequestListDraftsResponseListDrafts lists the org's drafts filtered by open / mine / all.

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)