@@ -276,21 +276,80 @@ static async Task PerformOperations(string? handle, string? password, string? au
276276
277277 var replyWithImageResult = await agent . ReplyTo ( createPostResult . Result . StrongReference , "Reply with an image." , imageUploadResult . Result ! , cancellationToken : cancellationToken ) ;
278278
279- using ( Stream resourceStream = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "Samples.Posting.BlueskyLogoRotated90.jpg" ) ! )
279+ if ( ! replyWithImageResult . Succeeded )
280+ {
281+ Console . ForegroundColor = ConsoleColor . Red ;
282+ Console . WriteLine ( $ "{ createPostResult . StatusCode } occurred when creating the post.") ;
283+ return ;
284+ }
285+
286+ using ( Stream resourceStream = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "Samples.Posting.BlueskyLogo.jpg" ) ! )
280287 using ( MemoryStream memoryStream = new ( ) )
281288 {
282289 resourceStream . CopyTo ( memoryStream ) ;
283290 imageAsBytes = memoryStream . ToArray ( ) ;
284291 }
285292
286293 imageUploadResult = await agent . UploadImage (
294+ imageAsBytes ,
295+ "image/jpg" ,
296+ "The Bluesky Logo" ,
297+ new AspectRatio ( 1000 , 1000 ) ,
298+ cancellationToken : cancellationToken ) ;
299+
300+ using ( Stream resourceStream = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "Samples.Posting.BlueskyLogoRotated90.jpg" ) ! )
301+ using ( MemoryStream memoryStream = new ( ) )
302+ {
303+ resourceStream . CopyTo ( memoryStream ) ;
304+ imageAsBytes = memoryStream . ToArray ( ) ;
305+ }
306+ var rotated90UploadResult = await agent . UploadImage (
287307 imageAsBytes ,
288308 "image/jpg" ,
289309 "The Bluesky Logo, rotated 90°" ,
290310 new AspectRatio ( 1000 , 1000 ) ,
291311 cancellationToken : cancellationToken ) ;
292312
293- if ( ! replyWithImageResult . Succeeded )
313+ using ( Stream resourceStream = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "Samples.Posting.BlueskyLogoRotated180.jpg" ) ! )
314+ using ( MemoryStream memoryStream = new ( ) )
315+ {
316+ resourceStream . CopyTo ( memoryStream ) ;
317+ imageAsBytes = memoryStream . ToArray ( ) ;
318+ }
319+ var rotated180UploadResult = await agent . UploadImage (
320+ imageAsBytes ,
321+ "image/jpg" ,
322+ "The Bluesky Logo, rotated 180°" ,
323+ new AspectRatio ( 1000 , 1000 ) ,
324+ cancellationToken : cancellationToken ) ;
325+
326+ using ( Stream resourceStream = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "Samples.Posting.BlueskyLogoRotated270.jpg" ) ! )
327+ using ( MemoryStream memoryStream = new ( ) )
328+ {
329+ resourceStream . CopyTo ( memoryStream ) ;
330+ imageAsBytes = memoryStream . ToArray ( ) ;
331+ }
332+ var rotated270UploadResult = await agent . UploadImage (
333+ imageAsBytes ,
334+ "image/jpg" ,
335+ "The Bluesky Logo, rotated 270°" ,
336+ new AspectRatio ( 1000 , 1000 ) ,
337+ cancellationToken : cancellationToken ) ;
338+
339+
340+ AtProtoHttpResult < CreateRecordResponse > multipleImagePostResult = await agent . Post (
341+ "Hello world with multiple images" ,
342+ [
343+ imageUploadResult . Result ! ,
344+ rotated90UploadResult . Result ! ,
345+ rotated180UploadResult . Result ! ,
346+ rotated270UploadResult . Result ! ,
347+ ] ,
348+ cancellationToken : cancellationToken ) ;
349+
350+ Debugger . Break ( ) ;
351+
352+ if ( ! multipleImagePostResult . Succeeded )
294353 {
295354 Console . ForegroundColor = ConsoleColor . Red ;
296355 Console . WriteLine ( $ "{ createPostResult . StatusCode } occurred when creating the post.") ;
@@ -299,9 +358,11 @@ static async Task PerformOperations(string? handle, string? password, string? au
299358
300359 Debugger . Break ( ) ;
301360
302- // Delete the post we just made, the image will eventually get cleaned up by the backend.
361+ // Delete the post we just made, the images will eventually get cleaned up by the backend.
303362 await agent . DeletePost ( createPostResult . Result . StrongReference , cancellationToken : cancellationToken ) ;
304363 await agent . DeletePost ( replyWithImageResult . Result . StrongReference , cancellationToken : cancellationToken ) ;
364+ await agent . DeletePost ( multipleImagePostResult . Result . StrongReference , cancellationToken : cancellationToken ) ;
365+
305366 }
306367
307368 {
@@ -367,7 +428,7 @@ static async Task PerformOperations(string? handle, string? password, string? au
367428 }
368429
369430 {
370- // quote
431+ // Quote
371432 AtProtoHttpResult < CreateRecordResponse > createPostResult = await agent . Post ( "Another test post, for quoting." , cancellationToken : cancellationToken ) ;
372433 if ( createPostResult . Succeeded )
373434 {
@@ -446,7 +507,6 @@ static async Task PerformOperations(string? handle, string? password, string? au
446507 var hashTag = new HashTag ( "beans" ) ;
447508 postBuilder . Append ( hashTag ) ;
448509
449-
450510 byte [ ] imageAsBytes ;
451511 using ( Stream resourceStream = Assembly . GetExecutingAssembly ( ) . GetManifestResourceStream ( "Samples.Posting.bean.png" ) ! )
452512 using ( MemoryStream memoryStream = new ( ) )
0 commit comments