@@ -163,125 +163,156 @@ 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
203-             response . ContentLength  =  source . ContentLength ; 
201+             target . ContentLength  =  source . ContentLength ; 
204202
205203            if  ( source . IsSetContentRange ( ) ) 
206-                 response . ContentRange  =  source . ContentRange ; 
204+                 target . ContentRange  =  source . ContentRange ; 
207205
208-             response . Headers  =  source . Headers ; 
206+             target . Headers  =  source . Headers ; 
209207
210208            if  ( source . IsSetDeleteMarker ( ) ) 
211-                 response . DeleteMarker  =  source . DeleteMarker ; 
209+                 target . DeleteMarker  =  source . DeleteMarker ; 
212210
213211            if  ( source . IsSetETag ( ) ) 
214-                 response . ETag  =  source . ETag ; 
212+                 target . ETag  =  source . ETag ; 
215213
216214            if  ( source . Expiration  !=  null ) 
217-                 response . Expiration  =  source . Expiration ; 
215+                 target . Expiration  =  source . Expiration ; 
218216
219217            if  ( source . ExpiresString  !=  null ) 
220-                 response . ExpiresString  =  source . ExpiresString ; 
218+                 target . ExpiresString  =  source . ExpiresString ; 
221219
222220            if  ( source . IsSetLastModified ( ) ) 
223-                 response . LastModified  =  source . LastModified ; 
221+                 target . LastModified  =  source . LastModified ; 
224222
225223            if  ( source . Metadata  !=  null ) 
226-                 response . Metadata  =  source . Metadata ; 
224+                 target . Metadata  =  source . Metadata ; 
227225
228226            if  ( source . IsSetMissingMeta ( ) ) 
229-                 response . MissingMeta  =  source . MissingMeta ; 
227+                 target . MissingMeta  =  source . MissingMeta ; 
230228
231229            if  ( source . IsSetObjectLockLegalHoldStatus ( ) ) 
232-                 response . ObjectLockLegalHoldStatus  =  source . ObjectLockLegalHoldStatus ; 
230+                 target . ObjectLockLegalHoldStatus  =  source . ObjectLockLegalHoldStatus ; 
233231
234232            if  ( source . IsSetObjectLockMode ( ) ) 
235-                 response . ObjectLockMode  =  source . ObjectLockMode ; 
233+                 target . ObjectLockMode  =  source . ObjectLockMode ; 
236234
237235            if  ( source . IsSetObjectLockRetainUntilDate ( ) ) 
238-                 response . ObjectLockRetainUntilDate  =  source . ObjectLockRetainUntilDate ; 
236+                 target . ObjectLockRetainUntilDate  =  source . ObjectLockRetainUntilDate ; 
239237
240238            if  ( source . IsSetPartsCount ( ) ) 
241-                 response . PartsCount  =  source . PartsCount ; 
239+                 target . PartsCount  =  source . PartsCount ; 
242240
243241            if  ( source . IsSetReplicationStatus ( ) ) 
244-                 response . ReplicationStatus  =  source . ReplicationStatus ; 
242+                 target . ReplicationStatus  =  source . ReplicationStatus ; 
245243
246244            if  ( source . IsSetRequestCharged ( ) ) 
247-                 response . RequestCharged  =  source . RequestCharged ; 
245+                 target . RequestCharged  =  source . RequestCharged ; 
248246
249247            if  ( source . RestoreExpiration . HasValue ) 
250-                 response . RestoreExpiration  =  source . RestoreExpiration ; 
248+                 target . RestoreExpiration  =  source . RestoreExpiration ; 
251249
252250            if  ( source . RestoreInProgress . HasValue ) 
253-                 response . RestoreInProgress  =  source . RestoreInProgress ; 
251+                 target . RestoreInProgress  =  source . RestoreInProgress ; 
254252
255253            if  ( source . ServerSideEncryptionCustomerMethod  !=  null ) 
256-                 response . ServerSideEncryptionCustomerMethod  =  source . ServerSideEncryptionCustomerMethod ; 
254+                 target . ServerSideEncryptionCustomerMethod  =  source . ServerSideEncryptionCustomerMethod ; 
257255
258256            if  ( source . ServerSideEncryptionCustomerProvidedKeyMD5  !=  null ) 
259-                 response . ServerSideEncryptionCustomerProvidedKeyMD5  =  source . ServerSideEncryptionCustomerProvidedKeyMD5 ; 
257+                 target . ServerSideEncryptionCustomerProvidedKeyMD5  =  source . ServerSideEncryptionCustomerProvidedKeyMD5 ; 
260258
261259            if  ( source . IsSetServerSideEncryptionKeyManagementServiceKeyId ( ) ) 
262-                 response . ServerSideEncryptionKeyManagementServiceKeyId  =  source . ServerSideEncryptionKeyManagementServiceKeyId ; 
260+                 target . ServerSideEncryptionKeyManagementServiceKeyId  =  source . ServerSideEncryptionKeyManagementServiceKeyId ; 
263261
264262            if  ( source . IsSetServerSideEncryptionMethod ( ) ) 
265-                 response . ServerSideEncryptionMethod  =  source . ServerSideEncryptionMethod ; 
263+                 target . ServerSideEncryptionMethod  =  source . ServerSideEncryptionMethod ; 
266264
267265            if  ( source . IsSetStorageClass ( ) ) 
268-                 response . StorageClass  =  source . StorageClass ; 
266+                 target . StorageClass  =  source . StorageClass ; 
269267
270-             response . TagCount  =  source . TagCount ; 
268+             target . TagCount  =  source . TagCount ; 
271269
272270            if  ( source . IsSetVersionId ( ) ) 
273-                 response . VersionId  =  source . VersionId ; 
271+                 target . VersionId  =  source . VersionId ; 
274272
275273            if  ( source . IsSetWebsiteRedirectLocation ( ) ) 
276-                 response . WebsiteRedirectLocation  =  source . WebsiteRedirectLocation ; 
274+                 target . WebsiteRedirectLocation  =  source . WebsiteRedirectLocation ; 
277275
278-             // Copy response metadata 
279-             response . ResponseMetadata  =  source . ResponseMetadata ; 
280-             response . ContentLength  =  source . ContentLength ; 
281-             response . HttpStatusCode  =  source . HttpStatusCode ; 
276+             // Copy response metadata   
277+             target . ResponseMetadata  =  source . ResponseMetadata ; 
278+             target . ContentLength  =  source . ContentLength ; 
279+             target . HttpStatusCode  =  source . HttpStatusCode ; 
280+         } 
281+ 
282+         /// <summary> 
283+         /// Maps a GetObjectResponse to TransferUtilityDownloadResponse. 
284+         /// Uses the field mappings defined in mapping.json "Conversion" -> "GetObjectResponse" -> "DownloadResponse". 
285+         /// </summary> 
286+         /// <param name="source">The GetObjectResponse to map from</param> 
287+         /// <returns>A new TransferUtilityDownloadResponse with mapped fields</returns> 
288+         internal  static TransferUtilityDownloadResponse  MapGetObjectResponse ( GetObjectResponse  source ) 
289+         { 
290+             if  ( source  ==  null ) 
291+                 return  null ; 
282292
293+             var  response  =  new  TransferUtilityDownloadResponse ( ) ; 
294+             PopulateGetObjectResponseBase ( source ,  response ) ; 
283295            return  response ; 
284296        } 
297+ 
298+         /// <summary> 
299+         /// Maps a GetObjectResponse to TransferUtilityOpenStreamResponse. 
300+         /// Uses the same field mappings as DownloadResponse plus the ResponseStream property. 
301+         /// </summary> 
302+         /// <param name="source">The GetObjectResponse to map from</param> 
303+         /// <returns>A new TransferUtilityOpenStreamResponse with mapped fields</returns> 
304+         internal  static TransferUtilityOpenStreamResponse  MapGetObjectResponseToOpenStream ( GetObjectResponse  source ) 
305+         { 
306+             if  ( source  ==  null ) 
307+                 return  null ; 
308+ 
309+             var  response  =  new  TransferUtilityOpenStreamResponse ( ) ; 
310+             PopulateGetObjectResponseBase ( source ,  response ) ; 
311+             response . ResponseStream  =  source . ResponseStream ; 
312+ 
313+             return  response ;             
314+         } 
315+ 
285316
286317    } 
287318} 
0 commit comments