syntax = "proto3";

package gitaly;

import "lint.proto";
import "shared.proto";

option go_package = "gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb";

// WikiService is a service that provides Wiki-related functionality. This
// service is deprecated and should not be used anymore. Instead, all
// functionality to implement Wikis should use Git-based RPCS.
service WikiService {

  // This comment is left unintentionally blank.
  rpc WikiWritePage(stream WikiWritePageRequest) returns (WikiWritePageResponse) {
    option (op_type) = {
      op: MUTATOR
    };
  }

  // This comment is left unintentionally blank.
  rpc WikiUpdatePage(stream WikiUpdatePageRequest) returns (WikiUpdatePageResponse) {
    option (op_type) = {
      op: MUTATOR
    };
  }

  // WikiFindPage returns a stream because the page's raw_data field may be arbitrarily large.
  rpc WikiFindPage(WikiFindPageRequest) returns (stream WikiFindPageResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // This comment is left unintentionally blank.
  rpc WikiGetAllPages(WikiGetAllPagesRequest) returns (stream WikiGetAllPagesResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // This comment is left unintentionally blank.
  rpc WikiListPages(WikiListPagesRequest) returns (stream WikiListPagesResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

}

// This comment is left unintentionally blank.
message WikiCommitDetails {
  // This comment is left unintentionally blank.
  bytes name = 1;
  // This comment is left unintentionally blank.
  bytes email = 2;
  // This comment is left unintentionally blank.
  bytes message = 3;
  // This comment is left unintentionally blank.
  int32 user_id = 4;
  // This comment is left unintentionally blank.
  bytes user_name = 5;
}

// This comment is left unintentionally blank.
message WikiPageVersion {
  // This comment is left unintentionally blank.
  GitCommit commit = 1;
  // This comment is left unintentionally blank.
  string format = 2;
}

// This comment is left unintentionally blank.
message WikiPage {
  // These fields are only present in the first message of a WikiPage stream
  WikiPageVersion version = 1;
  // This comment is left unintentionally blank.
  string format = 2;
  // This comment is left unintentionally blank.
  bytes title = 3;
  // This comment is left unintentionally blank.
  string url_path = 4;
  // This comment is left unintentionally blank.
  bytes path = 5;
  // This comment is left unintentionally blank.
  bytes name = 6;
  // This comment is left unintentionally blank.
  bool historical = 7;
  // This field is present in all messages of a WikiPage stream
  bytes raw_data = 8;
}

// This message is sent in a stream because the 'content' field may be large.
message WikiWritePageRequest {
  // These following fields are only present in the first message.
  Repository repository = 1 [(target_repository)=true];
  // This comment is left unintentionally blank.
  bytes name = 2;
  // This comment is left unintentionally blank.
  string format = 3;
  // This comment is left unintentionally blank.
  WikiCommitDetails commit_details = 4;
  // This field is present in all messages.
  bytes content = 5;
}

// This comment is left unintentionally blank.
message WikiWritePageResponse {
  // This comment is left unintentionally blank.
  bytes duplicate_error = 1;
}

// This comment is left unintentionally blank.
message WikiUpdatePageRequest {
  // There fields are only present in the first message of the stream
  Repository repository = 1 [(target_repository)=true];
  // This comment is left unintentionally blank.
  bytes page_path = 2;
  // This comment is left unintentionally blank.
  bytes title = 3;
  // This comment is left unintentionally blank.
  string format = 4;
  // This comment is left unintentionally blank.
  WikiCommitDetails commit_details = 5;
  // This field is present in all messages
  bytes content = 6;
}

// This comment is left unintentionally blank.
message WikiUpdatePageResponse {
  // This comment is left unintentionally blank.
  bytes error = 1;
}

// This comment is left unintentionally blank.
message WikiFindPageRequest {
  // This comment is left unintentionally blank.
  Repository repository = 1 [(target_repository)=true];
  // This comment is left unintentionally blank.
  bytes title = 2;
  // This comment is left unintentionally blank.
  bytes revision = 3;
  // This comment is left unintentionally blank.
  bytes directory = 4;
  // prevents the content from being sent over the response
  bool skip_content = 5;
}

// WikiFindPageResponse is a stream because we need multiple WikiPage
// messages to send the raw_data field.
message WikiFindPageResponse {
  // This comment is left unintentionally blank.
  WikiPage page = 1;
}

// This comment is left unintentionally blank.
message WikiGetAllPagesRequest {
  // This comment is left unintentionally blank.
  enum SortBy {
    // This comment is left unintentionally blank.
    TITLE = 0; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH
    // This comment is left unintentionally blank.
    CREATED_AT = 1; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
  }

  // This comment is left unintentionally blank.
  Repository repository = 1 [(target_repository)=true];
  // Passing 0 means no limit is applied
  uint32 limit = 2;
  // This comment is left unintentionally blank.
  bool direction_desc = 3;
  // This comment is left unintentionally blank.
  SortBy sort = 4;
}

// The WikiGetAllPagesResponse stream is a concatenation of WikiPage streams
message WikiGetAllPagesResponse {
  // This comment is left unintentionally blank.
  WikiPage page = 1;
  // When end_of_page is true it signals a change of page for the next Response message (if any)
  bool end_of_page = 2;
}

// This comment is left unintentionally blank.
message WikiListPagesRequest {
  // This comment is left unintentionally blank.
  enum SortBy {
    // This comment is left unintentionally blank.
    TITLE = 0; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH
    // This comment is left unintentionally blank.
    CREATED_AT = 1; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
  }

  // This comment is left unintentionally blank.
  Repository repository = 1 [(target_repository)=true];
  // Passing 0 means no limit is applied
  uint32 limit = 2;
  // This comment is left unintentionally blank.
  bool direction_desc = 3;
  // This comment is left unintentionally blank.
  SortBy sort = 4;
  // This comment is left unintentionally blank.
  uint32 offset = 5;
}

// The WikiListPagesResponse stream is a concatenation of WikiPage streams without content
message WikiListPagesResponse {
  // This comment is left unintentionally blank.
  WikiPage page = 1;
}
