예제 #1
0
        /// <summary>
        /// Gets document stream of latest version of given document ID.
        /// If version ID is null, it retrieves latest version of requested document ID.
        /// </summary>
        /// <param name="getDocumentStreamRequest">Request parameters.</param>
        /// <returns>Response for stream of latest version of requested document.</returns>
        public async Task <GetDocumentStreamResponse> GetDocumentStreamAsync(GetDocumentStreamRequest getDocumentStreamRequest)
        {
            String versionId = getDocumentStreamRequest.VersionId;

            if (versionId == null)
            {
                GetDocumentRequest getDocumentRequest = new GetDocumentRequest()
                {
                    DocumentId          = getDocumentStreamRequest.DocumentId,
                    AuthenticationToken = authenticationToken
                };

                GetDocumentResponse response = await client.GetDocumentAsync(getDocumentRequest).ConfigureAwait(false);

                versionId = response.Metadata.LatestVersionMetadata.Id;
            }

            Stream documentVersionStream = await GetDocumentVersionStreamAsync(getDocumentStreamRequest.DocumentId, versionId).ConfigureAwait(false);

            GetDocumentStreamResponse getDocumentStreamResponse = new GetDocumentStreamResponse(getDocumentStreamRequest)
            {
                Stream = documentVersionStream
            };

            return(getDocumentStreamResponse);
        }
 internal GetDocumentStreamResponse(GetDocumentStreamRequest request)
 {
     DocumentId = request.DocumentId;
 }