RandomDukNET 1.0.0

dotnet add package RandomDukNET --version 1.0.0                
NuGet\Install-Package RandomDukNET -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RandomDukNET" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RandomDukNET --version 1.0.0                
#r "nuget: RandomDukNET, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install RandomDukNET as a Cake Addin
#addin nuget:?package=RandomDukNET&version=1.0.0

// Install RandomDukNET as a Cake Tool
#tool nuget:?package=RandomDukNET&version=1.0.0                

RandomDukNET

A C# API wrapper written in .NET 6.0 LTS for the website Random-d.uk. A website that has images of ducks

Credits:

Example Use:

Getting Random Image:

RandomDukManager manager = new RandomDukManager();
byte[] image = await manager.GetRandomImage();

File.WriteAllBytes("duck_image_random.jpg", image);

Getting Jpeg Duck Image By ID:

RandomDukManager manager = new RandomDukManager();
byte[] image = await manager.GetDuckImageJpegById(1); // Takes in a number representing a ID

File.WriteAllBytes("duck_image_1.jpg", image);

Getting Http Duck Image:

RandomDukManager manager = new RandomDukManager();
byte[] image = await manager.GetHttpDuckImage(400); // Takes in a number representing a status code

File.WriteAllBytes("duck_image_400error.jpg", image);

Getting Duk JSON Object:

RandomDukManager manager = new RandomDukManager();
Duk dukObject = await manager.GetRandom(); // await manager.GetQuack(); also does the same

Assert.IsNotNull(dukObject);
Assert.IsNotNull(dukObject.Message); // Message of duck image
Assert.IsNotNull(dukObject.Url); // Url pointing to the file of duck image

Getting List Of Image Filenames in JSON:

RandomDukManager manager = new RandomDukManager();
DukList duckList = await manager.GetImageList();

Assert.IsNotNull(result);
Assert.IsTrue(result.ImageFilenames.Count != 0); // List of all jpeg file names stored on the web server
Assert.IsTrue(result.GifFilenames.Count != 0); // List of all gif file names stored on the web server
Assert.IsTrue(result.HttpDuckFilenames.Count != 0); // List of all http duck file names stored on the web server
Assert.IsTrue(result.ImageCount != 0); // Number of jpeg images on the web server
Assert.IsTrue(result.GifCount != 0); // Number of gif images on the web server
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 229 3/5/2023