Metadata is auxiliary information about an operation’s progress or other properties. In long-running operations, it accompanies the eventual result without replacing it. section 10.6 section 10.3.1
Use metadata to:
- Report progress or estimated time remaining before a result is available. section 10.3.1
- Give an operation a typed metadata interface instead of exposing an unstructured value. section 10.3 section 10.3.1
- Support discovery and filtering of operations by metadata, such as identifying paused work. section 10.3.8
Export progress
An asynchronous message export returns Operation<ExportMessagesResponse, ExportMessagesMetadata>. Its metadata stores progressPercent from 0% for not started to 100% for complete, while the result later contains the output configuration. section 2.4.3
Metadata is optional: an operation can use null when no metadata is worth storing. Do not confuse operation metadata with relationship metadata, which describes the relationship itself rather than execution progress. section 10.3.1 section 15.4.2
Listing 10.4 Definition of the Operation and OperationError interfaces
interface Operation<ResultT, MetadataT> { #1
id: string;
done: boolean; #2
result?: ResultT | OperationError; #1
metadata?: MetadataT; #1
}
interface OperationError {
code: string;
message: string;
details?: any;
}
Inspect the generic Operation interface to see how typed metadata sits alongside completion status and the eventual result or error. section 10.3.1




















