// M-Files Server gRPC API 26.11. Generated from the M-Files Server IDL; do not edit.
// Documentation: https://developer.m-files.com/APIs/gRPC-API/
syntax = "proto3";

package MFiles;

import "mfiles/api/annotations.proto";
import "mfiles/structs.proto";

option csharp_namespace = "MFiles.Grpc";
option go_package = "github.com/M-Files/mfiles-grpc-api/go/mfiles;mfiles";
option java_multiple_files = true;
option java_package = "com.mfiles.grpc";
option objc_class_prefix = "MF_";

// Server-to-server variants of file upload commit and file size checks.
//
// **For M-Files components only.** M-Files Server calls these methods on another M-Files Server
// when it forwards a file operation of a session that it relays to that server. No M-Files client
// calls them. Applications should use the public equivalents in
// [IRPCObjectOperations](mfiles:MFiles.IRPCObjectOperations) instead:
//
// | Internal method | Use instead |
// |---|---|
// | [UploadFileCommit2](mfiles:MFiles.IRPCDocumentOperationsFileIOInternal.UploadFileCommit2) | [UploadFileCommit](mfiles:MFiles.IRPCObjectOperations.UploadFileCommit) |
// | [GetFileOutline](mfiles:MFiles.IRPCDocumentOperationsFileIOInternal.GetFileOutline) | [GetFileSize](mfiles:MFiles.IRPCObjectOperations.GetFileSize), or `file_outline` of [DownloadFile_Begin](mfiles:MFiles.IRPCObjectOperations.DownloadFile_Begin) |
//
// Both methods need a vault session of a login that has a user account in the vault. They return
// the vault's metadata structure version in the `mfiles-metadata-version-bin` trailer.
service IRPCDocumentOperationsFileIOInternal {
	option (mfiles.api.service) = { book: "integration" level: LEVEL_SPECIALIZED title: "Document file I/O for server components" };

	// Completes an upload made with UploadFile and stores it as the new content of the file; returns
	// only the data file version.
	//
	// **For M-Files components only.** M-Files Server calls it on another M-Files Server to forward
	// [UploadFileCommit](mfiles:MFiles.IRPCObjectOperations.UploadFileCommit). Applications should call
	// `UploadFileCommit`.
	// - Changes the file content of the object. The checks are those of `UploadFileCommit`: the object
	//   must be checked out to the caller, and the caller needs edit access to it.
	// - Unlike `UploadFileCommit`, it does not fill in unset file times and returns no object version
	//   information.
	// - Requires a vault session of a login that has a user account in the vault.
	rpc UploadFileCommit2( UploadFileCommit2Request ) returns ( UploadFileCommit2Response ) {
		option (mfiles.api.method) = { session: SESSION_REQUIREMENT_SESSION_OR_ASSERTION returns_metadata_structure_version: true internal: true };
	}

	// Gets the size and MD5 checksum of a file version.
	//
	// **For M-Files components only.** M-Files Server calls it on another M-Files Server. Applications
	// should use [GetFileSize](mfiles:MFiles.IRPCObjectOperations.GetFileSize), or the `file_outline` of
	// [DownloadFile_Begin](mfiles:MFiles.IRPCObjectOperations.DownloadFile_Begin) with `need_checksum`.
	// - Read-only. Requires a vault session of a login that has a user account in the vault and read
	//   access to the object; works for a normal user.
	// - `obj_file_ver.file_ver` must name a specific file version; `FILE_VER_TYPE_LATEST` fails with
	//   "Not found. (File <id>-0 not found.)". Files of external (unmanaged) objects
	//   are not supported.
	rpc GetFileOutline( GetFileOutlineRequest ) returns ( GetFileOutlineResponse ) {
		option (mfiles.api.method) = { session: SESSION_REQUIREMENT_SESSION_OR_ASSERTION returns_metadata_structure_version: true internal: true };
	}
}

// The request of UploadFileCommit2.
message UploadFileCommit2Request {

	// The ID from [UploadFile](mfiles:MFiles.IRPCObjectOperations.UploadFile).
	int32 upload_id = 1;

	// The object that owns the file.
	ObjID obj_id = 2;

	// The file and its new size. `title`, `extension` and `allocation_size` are ignored.
	File file = 3;

	// If not zero, specifies the low-order part of the MD5 checksum of the uploaded file.
	int64 low_digest = 4;

	// If not zero, specifies the high-order part of the MD5 checksum of the uploaded file.
	int64 high_digest = 5;
}

// The response of UploadFileCommit2.
message UploadFileCommit2Response {

	// The version of the stored data file of the new file content.
	int32 data_file_version = 1;
}

// The request of GetFileOutline.
message GetFileOutlineRequest {

	// The object and the specific file version.
	ObjFileVer obj_file_ver = 1;
}

// The response of GetFileOutline.
message GetFileOutlineResponse {

	// The version of the stored data file of this file version.
	int32 data_file_version = 1;

	// `size` in bytes (`size_precision` is `FILE_SIZE_PRECISION_EXACT`) and `md5_checksum` as 32 hexadecimal digits.
	FileOutline file_outline = 2;
}
