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

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

// Writes custom entries to the vault's event log.
//
// Applications and vault applications use
// [AddCustomEventEntry](mfiles:MFiles.IRPCEventLog.AddCustomEventEntry) to record their own
// auditable events next to the events that M-Files Server writes itself (logins, object changes,
// administrative changes). Reading and exporting the event log are administrative operations and
// are not part of this service.
//
// - Requires a vault session whose user has the vault right `generate_event_logs`
//   ([VaultAccess](mfiles:MFiles.VaultAccess)).
// - Nothing is written while event logging is disabled in the vault; the call still succeeds.
service IRPCEventLog {
	option (mfiles.api.service) = { book: "vault" level: LEVEL_STANDARD title: "Event log" };

	// Adds a custom entry to the vault's event log and returns its event ID.
	//
	// - Requires the vault right `generate_event_logs`; otherwise the call fails with an access
	//   denied error.
	// - The entry is recorded as a custom event with the current time and the calling user's account
	//   and name.
	// - The event data is stored as a `customevent` XML element whose `customeventtype` attribute is
	//   `event_type`. If `xml_data` is well-formed XML, its root element becomes a child of that
	//   element; any other text is stored as the element's text value.
	// - When event logging is disabled in the vault, nothing is written and `event_id` is 0.
	// - Not idempotent: every successful call adds a new entry.
	rpc AddCustomEventEntry( AddCustomEventEntryRequest ) returns ( AddCustomEventEntryResponse ) {
		option (mfiles.api.method) = { session: SESSION_REQUIREMENT_SESSION };
	}
}

// The request of AddCustomEventEntry.
message AddCustomEventEntryRequest {

	// An identifier of your choice for the kind of event, for example `"MyApp.ContractApproved"`. Stored as the `customeventtype` attribute of the entry.
	string event_type = 1;

	// The event data: either an XML document (stored as XML) or plain text (stored as text). May be empty.
	string xml_data = 2;
}

// The response of AddCustomEventEntry.
message AddCustomEventEntryResponse {

	// The ID of the new event log entry, or 0 if event logging is disabled.
	int64 event_id = 1;
}
