syntax = "proto2";
option go_package = "blobstore";

package appengine;

message BlobstoreServiceError {
  enum ErrorCode {
    OK = 0;
    INTERNAL_ERROR = 1;
    URL_TOO_LONG = 2;
    PERMISSION_DENIED = 3;
    BLOB_NOT_FOUND = 4;
    DATA_INDEX_OUT_OF_RANGE = 5;
    BLOB_FETCH_SIZE_TOO_LARGE = 6;
    ARGUMENT_OUT_OF_RANGE = 8;
    INVALID_BLOB_KEY = 9;
  }
}

message CreateUploadURLRequest {
  required string success_path = 1;
  optional int64 max_upload_size_bytes = 2;
  optional int64 max_upload_size_per_blob_bytes = 3;
  optional string gs_bucket_name = 4;
  optional int32 url_expiry_time_seconds = 5;
}

message CreateUploadURLResponse {
  required string url = 1;
}

message DeleteBlobRequest {
  repeated string blob_key = 1;
  optional string token = 2;
}

message FetchDataRequest {
  required string blob_key = 1;
  required int64 start_index = 2;
  required int64 end_index = 3;
}

message FetchDataResponse {
  required bytes data = 1000 [ctype = CORD];
}

message CloneBlobRequest {
  required bytes blob_key = 1;
  required bytes mime_type = 2;
  required bytes target_app_id = 3;
}

message CloneBlobResponse {
  required bytes blob_key = 1;
}

message DecodeBlobKeyRequest {
  repeated string blob_key = 1;
}

message DecodeBlobKeyResponse {
  repeated string decoded = 1;
}

message CreateEncodedGoogleStorageKeyRequest {
  required string filename = 1;
}

message CreateEncodedGoogleStorageKeyResponse {
  required string blob_key = 1;
}
