syntax = "proto3";

package mesh.v1;

import "mesh/v1/git_model.proto";

option go_package = "atlassian.com/bitbucket/mesh/rpc/v1";
option java_multiple_files = true;
option java_outer_classname = "ContentProtos";
option java_package = "com.atlassian.bitbucket.mesh.rpc.v1";

/* Requests the NodeType for a specified path at a given commit. The path may be empty,
   for the root directory. */
message RpcGetNodeTypeRequest {
  string repository = 1;
  RpcGitTimeouts timeouts = 3;

  bytes commitish = 10;
  bytes path = 11;
}

/* Returns the NodeType for a NodeTypeRequest. */
message RpcGetNodeTypeResponse {
  RpcNodeType type = 1;
}

/* Requests for the object information such as the size and type. */
message RpcGetObjectInfoRequest {
  string repository = 1;
  RpcGitTimeouts timeouts = 2;

  bytes commitish = 10;
  //Optional value. Empty = root tree object at commitish, Missing = commit object with ID commitish.
  optional bytes path = 11;
}

/* Returns a RpcGitObjectInfo which has the object ID, GitObjectType and size for a GetObjectInfoRequest. */
message RpcGetObjectInfoResponse {
  RpcGitObjectInfo object_info = 1;
}

message RpcListDirectoryRequest {
  string repository = 1;
  RpcGitTimeouts timeouts = 3;

  bytes commitish = 10;
  int32 limit = 11;
  bytes path = 12;
  bool recursive = 13;
  bool sizes = 14;
  int32 skip = 15;
}

message RpcListDirectoryResponse {
  oneof response_oneof {
    RpcDirectory directory = 1;
    RpcFile file = 2;
    RpcSubmodule submodule = 3;
  }
}

message RpcListDirectoryResponseFragment {
  repeated RpcListDirectoryResponse responses = 1;
}
