syntax = "proto3"; package protos; option go_package = "github.com/pogo-vcs/pogo/protos"; service Pogo { rpc Init(InitRequest) returns (InitResponse); rpc CheckNeededFiles(CheckNeededFilesRequest) returns (CheckNeededFilesResponse); rpc PushFull(stream PushFullRequest) returns (PushFullResponse); rpc SetBookmark(SetBookmarkRequest) returns (SetBookmarkResponse); rpc RemoveBookmark(RemoveBookmarkRequest) returns (RemoveBookmarkResponse); rpc GetBookmarks(GetBookmarksRequest) returns (GetBookmarksResponse); rpc NewChange(NewChangeRequest) returns (NewChangeResponse); rpc GetDescription(GetDescriptionRequest) returns (GetDescriptionResponse); rpc SetDescription(SetDescriptionRequest) returns (SetDescriptionResponse); rpc Log(LogRequest) returns (LogResponse); rpc Info(InfoRequest) returns (InfoResponse); rpc Edit(EditRequest) returns (stream EditResponse); rpc RemoveChange(RemoveChangeRequest) returns (RemoveChangeResponse); rpc GarbageCollect(GarbageCollectRequest) returns (GarbageCollectResponse); rpc GetRepositoryInfo(GetRepositoryInfoRequest) returns (GetRepositoryInfoResponse); rpc CreateInvite(CreateInviteRequest) returns (CreateInviteResponse); rpc GetInvites(GetInvitesRequest) returns (GetInvitesResponse); rpc SetRepositoryVisibility(SetRepositoryVisibilityRequest) returns (SetRepositoryVisibilityResponse); rpc SetSecret(SetSecretRequest) returns (SetSecretResponse); rpc GetSecret(GetSecretRequest) returns (GetSecretResponse); rpc GetAllSecrets(GetAllSecretsRequest) returns (GetAllSecretsResponse); rpc DeleteSecret(DeleteSecretRequest) returns (DeleteSecretResponse); rpc ListCIRuns(ListCIRunsRequest) returns (ListCIRunsResponse); rpc GetCIRun(GetCIRunRequest) returns (GetCIRunResponse); rpc Diff(DiffRequest) returns (stream DiffResponse); rpc DiffLocal(stream DiffLocalRequest) returns (stream DiffLocalResponse); } message Auth { bytes personal_access_token = 1; } message InitRequest { Auth auth = 1; string repo_name = 2; bool public = 3; } message FileHeader { string name = 1; optional bool executable = 2; bytes content_hash = 3; } message InitResponse { int32 repo_id = 1; int64 change_id = 2; } message CheckNeededFilesRequest { Auth auth = 1; int32 repo_id = 2; repeated bytes file_hashes = 3; } message CheckNeededFilesResponse { repeated bytes needed_hashes = 1; } message PushFullRequest { oneof payload { Auth auth = 1; int64 change_id = 2; FileHeader file_header = 3; bytes file_content = 4; EOF eof = 5; EndOfFiles end_of_files = 6; bool has_content = 7; // Signal whether file content follows or is already stored bool force = 8; // Force push even if change is readonly } } message PushFullResponse {} message EOF {} message EndOfFiles {} message SetBookmarkRequest { Auth auth = 1; int32 repo_id = 2; string bookmark_name = 3; optional string change_name = 4; optional int64 checked_out_change_id = 5; } message SetBookmarkResponse {} message RemoveBookmarkRequest { Auth auth = 1; int32 repo_id = 2; string bookmark_name = 3; } message RemoveBookmarkResponse {} message GetBookmarksRequest { Auth auth = 1; int32 repo_id = 2; } message Bookmark { string name = 1; string change_name = 2; } message GetBookmarksResponse { repeated Bookmark bookmarks = 1; } message NewChangeRequest { Auth auth = 1; int32 repo_id = 2; optional string description = 3; repeated string parent_change_names = 4; optional int64 checked_out_change_id = 5; } message NewChangeResponse { int64 change_id = 1; string change_name = 2; } message GetDescriptionRequest { Auth auth = 1; int64 change_id = 2; } message GetDescriptionResponse { optional string description = 1; } message SetDescriptionRequest { Auth auth = 1; int64 change_id = 2; string description = 3; } message SetDescriptionResponse {} message LogRequest { Auth auth = 1; int32 repo_id = 2; int64 checked_out_change_id = 3; int32 max_changes = 4; } message LogChange { int64 id = 1; string name = 2; string unique_prefix = 3; optional string description = 4; repeated string conflict_files = 5; string created_at = 6; string updated_at = 7; } message LogRelation { int64 child_id = 1; string child_name = 2; optional int64 parent_id = 3; string parent_name = 4; } message LogResponse { repeated LogChange changes = 1; repeated LogRelation relations = 2; int64 checked_out_change_id = 3; } message InfoRequest { Auth auth = 1; int32 repo_id = 2; int64 checked_out_change_id = 3; } message InfoResponse { string change_name_prefix = 1; string change_name_suffix = 2; string change_name = 3; optional string change_description = 4; repeated string bookmarks = 5; bool is_in_conflict = 6; } message EditRequest { Auth auth = 1; int32 repo_id = 2; string revision = 3; int64 change_id = 4; repeated string client_files = 5; } message EditResponse { oneof payload { FileToDelete file_to_delete = 1; FileHeader file_header = 2; bytes file_content = 3; EOF eof = 4; EndOfFiles end_of_files = 5; int64 change_id = 6; } } message FileToDelete { string name = 1; } message RemoveChangeRequest { Auth auth = 1; int32 repo_id = 2; string change_name = 3; bool keep_children = 4; } message RemoveChangeResponse {} message GarbageCollectRequest { Auth auth = 1; } message GarbageCollectResponse { int32 deleted_database_files = 1; int32 deleted_disk_files = 2; int64 bytes_freed = 3; } message GetRepositoryInfoRequest { Auth auth = 1; string repo_name = 2; } message GetRepositoryInfoResponse { int32 repo_id = 1; string repo_name = 2; bool is_public = 3; optional string main_bookmark_change = 4; optional string root_change = 5; } message CreateInviteRequest { Auth auth = 1; int64 expires_in_hours = 2; } message CreateInviteResponse { string invite_url = 1; string invite_token = 2; } message GetInvitesRequest { Auth auth = 1; } message Invite { string token = 1; string created_at = 2; string expires_at = 3; optional string used_at = 4; optional string used_by_username = 5; } message GetInvitesResponse { repeated Invite invites = 1; } message SetRepositoryVisibilityRequest { Auth auth = 1; int32 repo_id = 2; bool public = 3; } message SetRepositoryVisibilityResponse {} message SetSecretRequest { Auth auth = 1; int32 repo_id = 2; string key = 3; string value = 4; } message SetSecretResponse {} message GetSecretRequest { Auth auth = 1; int32 repo_id = 2; string key = 3; } message GetSecretResponse { string value = 1; } message GetAllSecretsRequest { Auth auth = 1; int32 repo_id = 2; } message Secret { string key = 1; string value = 2; } message GetAllSecretsResponse { repeated Secret secrets = 1; } message DeleteSecretRequest { Auth auth = 1; int32 repo_id = 2; string key = 3; } message DeleteSecretResponse {} message ListCIRunsRequest { Auth auth = 1; int32 repo_id = 2; } message CIRunSummary { int64 id = 1; string config_filename = 2; string event_type = 3; string rev = 4; optional string pattern = 5; string reason = 6; string task_type = 7; int32 status_code = 8; bool success = 9; string started_at = 10; string finished_at = 11; } message ListCIRunsResponse { repeated CIRunSummary runs = 1; } message GetCIRunRequest { Auth auth = 1; int32 repo_id = 2; int64 run_id = 3; } message GetCIRunResponse { CIRunSummary run = 1; string log = 2; } message DiffRequest { Auth auth = 1; int32 repo_id = 2; optional string rev1 = 3; optional string rev2 = 4; optional int64 checked_out_change_id = 5; optional bool use_patience = 6; optional bool include_large_files = 7; } message DiffResponse { oneof payload { DiffFileHeader file_header = 1; DiffBlock diff_block = 2; EndOfFile end_of_file = 3; } } message DiffFileHeader { string path = 1; string old_change_name = 2; string new_change_name = 3; DiffFileStatus status = 4; string old_hash = 5; string new_hash = 6; int32 old_line_count = 7; int32 new_line_count = 8; } message DiffBlock { DiffBlockType type = 1; repeated string lines = 2; } enum DiffBlockType { DIFF_BLOCK_TYPE_METADATA = 0; DIFF_BLOCK_TYPE_UNCHANGED = 1; DIFF_BLOCK_TYPE_REMOVED = 2; DIFF_BLOCK_TYPE_ADDED = 3; } enum DiffFileStatus { DIFF_FILE_STATUS_MODIFIED = 0; DIFF_FILE_STATUS_ADDED = 1; DIFF_FILE_STATUS_DELETED = 2; DIFF_FILE_STATUS_BINARY = 3; } message EndOfFile {} message DiffLocalRequest { oneof payload { Auth auth = 1; int32 repo_id = 2; int64 checked_out_change_id = 3; bool use_patience = 4; bool include_large_files = 5; LocalFileMetadata file_metadata = 6; EndOfMetadata end_of_metadata = 7; bytes file_content = 8; EOF eof = 9; } } message LocalFileMetadata { string path = 1; bytes content_hash = 2; optional bool executable = 3; } message EndOfMetadata {} message DiffLocalResponse { oneof payload { ContentRequest content_request = 1; DiffFileHeader file_header = 2; DiffBlock diff_block = 3; EndOfFile end_of_file = 4; } } message ContentRequest { string path = 1; }