@@ -163,123 +163,154 @@ internal static TransferUtilityUploadResponse MapCompleteMultipartUploadResponse
163163        } 
164164
165165        /// <summary> 
166-         /// Maps a  GetObjectResponse to TransferUtilityDownloadResponse . 
167-         /// Uses  the field mappings defined in  mapping.json "Conversion" -> " GetObjectResponse" -> "DownloadResponse".  
166+         /// Private helper method to populate the common properties from  GetObjectResponse to the base response class . 
167+         /// Contains all  the shared  mapping logic for  GetObjectResponse fields.   
168168        /// </summary> 
169169        /// <param name="source">The GetObjectResponse to map from</param> 
170-         /// <returns>A new TransferUtilityDownloadResponse with mapped fields</returns > 
171-         internal  static TransferUtilityDownloadResponse   MapGetObjectResponse ( GetObjectResponse  source ) 
170+         /// <param name="target">The TransferUtilityGetObjectResponseBase to populate</param > 
171+         private  static void   PopulateGetObjectResponseBase ( GetObjectResponse  source ,   TransferUtilityGetObjectResponseBase   target ) 
172172        { 
173-             if  ( source  ==  null ) 
174-                 return  null ; 
175- 
176-             var  response  =  new  TransferUtilityDownloadResponse ( ) ; 
173+             if  ( source  ==  null  ||  target  ==  null ) 
174+                 return ; 
177175
178176            // Map all fields as defined in mapping.json "Conversion" -> "GetObjectResponse" -> "DownloadResponse" 
179177            if  ( source . IsSetAcceptRanges ( ) ) 
180-                 response . AcceptRanges  =  source . AcceptRanges ; 
178+                 target . AcceptRanges  =  source . AcceptRanges ; 
181179
182180            if  ( source . IsSetBucketKeyEnabled ( ) ) 
183-                 response . BucketKeyEnabled  =  source . BucketKeyEnabled . GetValueOrDefault ( ) ; 
181+                 target . BucketKeyEnabled  =  source . BucketKeyEnabled . GetValueOrDefault ( ) ; 
184182
185183            if  ( source . IsSetChecksumCRC32 ( ) ) 
186-                 response . ChecksumCRC32  =  source . ChecksumCRC32 ; 
184+                 target . ChecksumCRC32  =  source . ChecksumCRC32 ; 
187185
188186            if  ( source . IsSetChecksumCRC32C ( ) ) 
189-                 response . ChecksumCRC32C  =  source . ChecksumCRC32C ; 
187+                 target . ChecksumCRC32C  =  source . ChecksumCRC32C ; 
190188
191189            if  ( source . IsSetChecksumCRC64NVME ( ) ) 
192-                 response . ChecksumCRC64NVME  =  source . ChecksumCRC64NVME ; 
190+                 target . ChecksumCRC64NVME  =  source . ChecksumCRC64NVME ; 
193191
194192            if  ( source . IsSetChecksumSHA1 ( ) ) 
195-                 response . ChecksumSHA1  =  source . ChecksumSHA1 ; 
193+                 target . ChecksumSHA1  =  source . ChecksumSHA1 ; 
196194
197195            if  ( source . IsSetChecksumSHA256 ( ) ) 
198-                 response . ChecksumSHA256  =  source . ChecksumSHA256 ; 
196+                 target . ChecksumSHA256  =  source . ChecksumSHA256 ; 
199197
200198            if  ( source . IsSetChecksumType ( ) ) 
201-                 response . ChecksumType  =  source . ChecksumType ; 
199+                 target . ChecksumType  =  source . ChecksumType ; 
202200
203201            if  ( source . IsSetContentRange ( ) ) 
204-                 response . ContentRange  =  source . ContentRange ; 
202+                 target . ContentRange  =  source . ContentRange ; 
205203
206-             response . Headers  =  source . Headers ; 
204+             target . Headers  =  source . Headers ; 
207205
208206            if  ( source . IsSetDeleteMarker ( ) ) 
209-                 response . DeleteMarker  =  source . DeleteMarker ; 
207+                 target . DeleteMarker  =  source . DeleteMarker ; 
210208
211209            if  ( source . IsSetETag ( ) ) 
212-                 response . ETag  =  source . ETag ; 
210+                 target . ETag  =  source . ETag ; 
213211
214212            if  ( source . Expiration  !=  null ) 
215-                 response . Expiration  =  source . Expiration ; 
213+                 target . Expiration  =  source . Expiration ; 
216214
217215            if  ( source . ExpiresString  !=  null ) 
218-                 response . ExpiresString  =  source . ExpiresString ; 
216+                 target . ExpiresString  =  source . ExpiresString ; 
219217
220218            if  ( source . IsSetLastModified ( ) ) 
221-                 response . LastModified  =  source . LastModified ; 
219+                 target . LastModified  =  source . LastModified ; 
222220
223221            if  ( source . Metadata  !=  null ) 
224-                 response . Metadata  =  source . Metadata ; 
222+                 target . Metadata  =  source . Metadata ; 
225223
226224            if  ( source . IsSetMissingMeta ( ) ) 
227-                 response . MissingMeta  =  source . MissingMeta ; 
225+                 target . MissingMeta  =  source . MissingMeta ; 
228226
229227            if  ( source . IsSetObjectLockLegalHoldStatus ( ) ) 
230-                 response . ObjectLockLegalHoldStatus  =  source . ObjectLockLegalHoldStatus ; 
228+                 target . ObjectLockLegalHoldStatus  =  source . ObjectLockLegalHoldStatus ; 
231229
232230            if  ( source . IsSetObjectLockMode ( ) ) 
233-                 response . ObjectLockMode  =  source . ObjectLockMode ; 
231+                 target . ObjectLockMode  =  source . ObjectLockMode ; 
234232
235233            if  ( source . IsSetObjectLockRetainUntilDate ( ) ) 
236-                 response . ObjectLockRetainUntilDate  =  source . ObjectLockRetainUntilDate ; 
234+                 target . ObjectLockRetainUntilDate  =  source . ObjectLockRetainUntilDate ; 
237235
238236            if  ( source . IsSetPartsCount ( ) ) 
239-                 response . PartsCount  =  source . PartsCount ; 
237+                 target . PartsCount  =  source . PartsCount ; 
240238
241239            if  ( source . IsSetReplicationStatus ( ) ) 
242-                 response . ReplicationStatus  =  source . ReplicationStatus ; 
240+                 target . ReplicationStatus  =  source . ReplicationStatus ; 
243241
244242            if  ( source . IsSetRequestCharged ( ) ) 
245-                 response . RequestCharged  =  source . RequestCharged ; 
243+                 target . RequestCharged  =  source . RequestCharged ; 
246244
247245            if  ( source . RestoreExpiration . HasValue ) 
248-                 response . RestoreExpiration  =  source . RestoreExpiration ; 
246+                 target . RestoreExpiration  =  source . RestoreExpiration ; 
249247
250248            if  ( source . RestoreInProgress . HasValue ) 
251-                 response . RestoreInProgress  =  source . RestoreInProgress ; 
249+                 target . RestoreInProgress  =  source . RestoreInProgress ; 
252250
253251            if  ( source . ServerSideEncryptionCustomerMethod  !=  null ) 
254-                 response . ServerSideEncryptionCustomerMethod  =  source . ServerSideEncryptionCustomerMethod ; 
252+                 target . ServerSideEncryptionCustomerMethod  =  source . ServerSideEncryptionCustomerMethod ; 
255253
256254            if  ( source . ServerSideEncryptionCustomerProvidedKeyMD5  !=  null ) 
257-                 response . ServerSideEncryptionCustomerProvidedKeyMD5  =  source . ServerSideEncryptionCustomerProvidedKeyMD5 ; 
255+                 target . ServerSideEncryptionCustomerProvidedKeyMD5  =  source . ServerSideEncryptionCustomerProvidedKeyMD5 ; 
258256
259257            if  ( source . IsSetServerSideEncryptionKeyManagementServiceKeyId ( ) ) 
260-                 response . ServerSideEncryptionKeyManagementServiceKeyId  =  source . ServerSideEncryptionKeyManagementServiceKeyId ; 
258+                 target . ServerSideEncryptionKeyManagementServiceKeyId  =  source . ServerSideEncryptionKeyManagementServiceKeyId ; 
261259
262260            if  ( source . IsSetServerSideEncryptionMethod ( ) ) 
263-                 response . ServerSideEncryptionMethod  =  source . ServerSideEncryptionMethod ; 
261+                 target . ServerSideEncryptionMethod  =  source . ServerSideEncryptionMethod ; 
264262
265263            if  ( source . IsSetStorageClass ( ) ) 
266-                 response . StorageClass  =  source . StorageClass ; 
264+                 target . StorageClass  =  source . StorageClass ; 
267265
268-             response . TagCount  =  source . TagCount ; 
266+             target . TagCount  =  source . TagCount ; 
269267
270268            if  ( source . IsSetVersionId ( ) ) 
271-                 response . VersionId  =  source . VersionId ; 
269+                 target . VersionId  =  source . VersionId ; 
272270
273271            if  ( source . IsSetWebsiteRedirectLocation ( ) ) 
274-                 response . WebsiteRedirectLocation  =  source . WebsiteRedirectLocation ; 
272+                 target . WebsiteRedirectLocation  =  source . WebsiteRedirectLocation ; 
275273
276-             // Copy response metadata 
277-             response . ResponseMetadata  =  source . ResponseMetadata ; 
278-             response . ContentLength  =  source . ContentLength ; 
279-             response . HttpStatusCode  =  source . HttpStatusCode ; 
274+             // Copy response metadata   
275+             target . ResponseMetadata  =  source . ResponseMetadata ; 
276+             target . ContentLength  =  source . ContentLength ; 
277+             target . HttpStatusCode  =  source . HttpStatusCode ; 
278+         } 
279+ 
280+         /// <summary> 
281+         /// Maps a GetObjectResponse to TransferUtilityDownloadResponse. 
282+         /// Uses the field mappings defined in mapping.json "Conversion" -> "GetObjectResponse" -> "DownloadResponse". 
283+         /// </summary> 
284+         /// <param name="source">The GetObjectResponse to map from</param> 
285+         /// <returns>A new TransferUtilityDownloadResponse with mapped fields</returns> 
286+         internal  static TransferUtilityDownloadResponse  MapGetObjectResponse ( GetObjectResponse  source ) 
287+         { 
288+             if  ( source  ==  null ) 
289+                 return  null ; 
280290
291+             var  response  =  new  TransferUtilityDownloadResponse ( ) ; 
292+             PopulateGetObjectResponseBase ( source ,  response ) ; 
281293            return  response ; 
282294        } 
295+ 
296+         /// <summary> 
297+         /// Maps a GetObjectResponse to TransferUtilityOpenStreamResponse. 
298+         /// Uses the same field mappings as DownloadResponse plus the ResponseStream property. 
299+         /// </summary> 
300+         /// <param name="source">The GetObjectResponse to map from</param> 
301+         /// <returns>A new TransferUtilityOpenStreamResponse with mapped fields</returns> 
302+         internal  static TransferUtilityOpenStreamResponse  MapGetObjectResponseToOpenStream ( GetObjectResponse  source ) 
303+         { 
304+             if  ( source  ==  null ) 
305+                 return  null ; 
306+ 
307+             var  response  =  new  TransferUtilityOpenStreamResponse ( ) ; 
308+             PopulateGetObjectResponseBase ( source ,  response ) ; 
309+             response . ResponseStream  =  source . ResponseStream ; 
310+ 
311+             return  response ;             
312+         } 
313+ 
283314
284315    } 
285316} 
0 commit comments