// 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_";

// An interface for enumerating vaults.
//
// Use this interface to get a listing of registered vaults on the server.
//
// Lists the vaults on the server that the logged-in user can see. Use it to let a user pick a vault
// or to find a vault's GUID by its name; then log in to that vault with
// [LogIn](mfiles:MFiles.IRPCLogin.LogIn) or
// [LogInWithSession](mfiles:MFiles.IRPCLogin.LogInWithSession).
//
// [GetVaults](mfiles:MFiles.IRPCVaults.GetVaults) is the method to use. It accepts both a
// server-level session (from a `LogIn` with the all-zero vault GUID) and a vault session.
// `GetReplicasOfVaults` and `GetGroundLinkProxies` serve special deployments and return nothing on
// an ordinary server. Server-level and vault sessions are described in
// [Authentication and sessions](https://developer.m-files.com/APIs/gRPC-API/runtime/authentication/).
service IRPCVaults {
	option (mfiles.api.service) = { book: "vault" level: LEVEL_CORE title: "Vaults on a server" };

	// Lists the vaults on the server that the session's user can see.
	//
	// Requires a session, either server-level or vault-level; without one the call fails with
	// `UNAUTHENTICATED`.
	//
	// Which vaults are returned:
	//
	// - A user who can manage vaults on the server sees every vault, unless
	//   `exclude_vaults_user_cannot_access` is true.
	// - Any other user sees only vaults where the login account has a user account. With
	//   `exclude_vaults_user_cannot_access` the user account must also be allowed to log in.
	// - A user whose login account lives in one vault (vault login accounts) sees only that vault.
	// - Offline vaults are left out unless `include_offline_vaults` is true.
	//
	// `vaults` and `online_states` are parallel arrays: `online_states[i]` is the state of `vaults[i]`.
	rpc GetVaults( GetVaultsRequest ) returns ( GetVaultsResponse ) {
		option idempotency_level = IDEMPOTENT;
		option (mfiles.api.method) = { session: SESSION_REQUIREMENT_SESSION highlighted: true };
	}

	// Gets replicas of document vaults (links to (remote) document vaults).
	//
	// Used by M-Files cached replica vaults over MS-RPC. Over gRPC the response is always empty.
	rpc GetReplicasOfVaults( GetReplicasOfVaultsRequest ) returns ( GetReplicasOfVaultsResponse ) {
		option (mfiles.api.method) = { session: SESSION_REQUIREMENT_NONE };
	}

	// Lists the Ground Link proxy vaults on the server that the session's user can see.
	//
	// Used by M-Files components that work with Ground Link; applications rarely need it. Visibility
	// and `online_states` work as in [GetVaults](mfiles:MFiles.IRPCVaults.GetVaults). The response is
	// empty on a server without Ground Link proxies.
	rpc GetGroundLinkProxies( GetGroundLinkProxiesRequest ) returns ( GetGroundLinkProxiesResponse ) {
		option idempotency_level = IDEMPOTENT;
		option (mfiles.api.method) = { session: SESSION_REQUIREMENT_SESSION };
	}
}

// A structure that specifies get vaults request.
message GetVaultsRequest {

	// True to also return vaults that are offline. Default false: only online vaults.
	bool include_offline_vaults = 1;

	// True to return only vaults the user can log in to. Without it a non-administrator also sees vaults where the user account exists but cannot log in, and a user who manages vaults sees all vaults.
	bool exclude_vaults_user_cannot_access = 2;
}

// A structure that specifies get vaults response.
message GetVaultsResponse {

	// The visible vaults. `guid` is the value to pass in `LoginData.vault_guid`.
	repeated VaultBasic vaults = 1;

	// True if the vault at the same index in `vaults` is online.
	repeated bool online_states = 2;
}

// A structure that specifies get replicas of vaults request.
message GetReplicasOfVaultsRequest {
}

// A structure that specifies get replicas of vaults response.
message GetReplicasOfVaultsResponse {

	// Always empty over gRPC.
	repeated VaultBasic vaults = 1;
}

// A structure that specifies get ground link proxies request.
message GetGroundLinkProxiesRequest {

	// True to also return proxies that are offline.
	bool include_offline_vaults = 1;
}

// A structure that specifies get ground link proxies response.
message GetGroundLinkProxiesResponse {

	// The visible Ground Link proxy vaults.
	repeated VaultBasic vaults = 1;

	// True if the proxy at the same index in `vaults` is online.
	repeated bool online_states = 2;
}
