An output configuration interface specifies where exported data goes and how it is processed. Encapsulating these options lets a request carry configuration in and receive the same configuration as confirmation. section 2.4.3
A typical configuration can include:
- A destination, such as a hosted file or an Amazon S3 location. section 2.4.3
- Optional compression, including a gzip compression level from 1 to 9. section 2.4.3
- Optional encryption settings that can be extended with additional configuration. section 2.4.3
Exporting messages
An ExportMessages request accepts a parent user and MessageOutputConfig. The export response returns that output configuration, while a long-running operation reports progress and eventually returns the result or an error. section 2.4.3
Listing 2.4 API to export messages using a design pattern
abstract class Twapi {
static version = "v1";
static title = "Twapi API";
@post("/{parent=users/*}/messages:export")
ExportMessages(req: ExportMessagesRequest):
Operation<ExportMessagesResponse,
ExportMessagesMetadata>; #1
}
interface ExportMessagesRequest {
// The parent user of the messages to be exported.
parent: string;
outputConfig: MessageOutputConfig; #2
}
interface MessageOutputConfig {
destination: Destination; #3
compressionConfig?: CompressionConfig; #4
encryptionConfig?: EncryptionConfig;
}
interface ExportMessagesResponse {
outputConfig: MessageOutputConfig; #5
}
interface ExportMessagesMetadata {
// An integer between 0 and 100
// representing the progress of the operation.
progressPercent: number; #6
}
Use the API definition to see how outputConfig connects the export request and response to an asynchronous operation. section 2.4.3
