LQ.MemeApiDotNetWrapper 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package LQ.MemeApiDotNetWrapper --version 1.1.0                
NuGet\Install-Package LQ.MemeApiDotNetWrapper -Version 1.1.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="LQ.MemeApiDotNetWrapper" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LQ.MemeApiDotNetWrapper --version 1.1.0                
#r "nuget: LQ.MemeApiDotNetWrapper, 1.1.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 LQ.MemeApiDotNetWrapper as a Cake Addin
#addin nuget:?package=LQ.MemeApiDotNetWrapper&version=1.1.0

// Install LQ.MemeApiDotNetWrapper as a Cake Tool
#tool nuget:?package=LQ.MemeApiDotNetWrapper&version=1.1.0                

MemeApiDotNetWrapper

Does your application make use of random memes from Reddit? If this is the case, you might use this API to get your memes. That's fine and dandy, but what if you don't want to write your own implementation of it? That's where this wrapper comes in. Call one function and get your meme easily! Original API found here: https://github.com/D3vd/Meme_Api

If you find this library particularly useful/helpful please consider supporting me:
ko-fi

Usage Example

using System;
using MemeApiDotNetWrapper;

namespace Example
{
    public class CoolClass
    {
        public async void GetMeme()
        {
            MemeMachine memeMachine = new MemeMachine();
            var meme = await memeMachine.GetMeme();
            Console.WriteLine(meme.PostLink); // "https://redd.it/jiovfz"
            Console.WriteLine(meme.SubReddit); // "dankmemes"
            Console.WriteLine(meme.Title); // "*leaves call*"
            Console.WriteLine(meme.ImageUrl); // "https://i.redd.it/f7ibqp1dmiv51.gif"
            Console.WriteLine(meme.IsNsfw); // false
            Console.WriteLine(meme.IsSpoiler); // false
            Console.WriteLine(meme.AuthorUsername); // "Spartan-Yeet"
            Console.WriteLine(meme.Upvotes); // 3363
            Console.WriteLine(meme.Preview); /* [
                                                    PreviewURL108Width: "https://preview.redd.it/f7ibqp1dmiv51.gif?width=108&crop=smart&format=png8&s=02b12609100c14f55c31fe046f413a9415804d62",
                                                    PreviewURL216Width: "https://preview.redd.it/f7ibqp1dmiv51.gif?width=216&crop=smart&format=png8&s=8da35457641a045e88e42a25eca64c14a6759f82",
                                                    PreviewURL320Width: "https://preview.redd.it/f7ibqp1dmiv51.gif?width=320&crop=smart&format=png8&s=f2250b007b8252c7063b8580c2aa72c5741766ae",
                                                    PreviewURL640Width: "https://preview.redd.it/f7ibqp1dmiv51.gif?width=640&crop=smart&format=png8&s=6cd99df5e58c976bc115bd080a1e6afdbd0d71e7"
                                                ]
                                                *Additional Note: Previews go up to 1080 Width, depending on availability.
                                            */
        }
    }
}

Option: Specifying Subreddit

using System;
using MemeApiDotNetWrapper;

namespace Example
{
    public class CoolClass
    {
        public async void GetMeme()
        {
            MemeMachine memeMachine = new MemeMachine();
            var meme = await memeMachine.GetMeme("Otonokizaka");
            Console.WriteLine(meme.PostLink); // "https://redd.it/lndbu6"
            Console.WriteLine(meme.SubReddit); // "Otonokizaka"
            Console.WriteLine(meme.Title); // "*Panik mode activated*"
            Console.WriteLine(meme.ImageUrl); // "https://i.redd.it/f4x7l0xe2fi61.jpg"
            Console.WriteLine(meme.IsNsfw); // false
            Console.WriteLine(meme.IsSpoiler); // false
            Console.WriteLine(meme.AuthorUsername); // "ChrrisPBacon"
            Console.WriteLine(meme.Upvotes); // 380
            Console.WriteLine(meme.Preview); /* [
                                                    PreviewURL108Width: "https://preview.redd.it/f4x7l0xe2fi61.jpg?width=108\u0026crop=smart\u0026auto=webp\u0026s=0fea0b6643a51fac5efcc2bde5a01f92d67a44a9",
                                                    PreviewURL216Width: "https://preview.redd.it/f4x7l0xe2fi61.jpg?width=216\u0026crop=smart\u0026auto=webp\u0026s=c7bb22a5816b3b24e6d75013398ff30821958e3a",
                                                    PreviewURL320Width: "https://preview.redd.it/f4x7l0xe2fi61.jpg?width=320\u0026crop=smart\u0026auto=webp\u0026s=0d0bd71c16407e03be5dba71dd22373755d0c95a",
                                                    PreviewURL640Width: "https://preview.redd.it/f4x7l0xe2fi61.jpg?width=640\u0026crop=smart\u0026auto=webp\u0026s=b65873a26709ca86916b9421c94502b613702eca",
                                                    PreviewURL960Width: "https://preview.redd.it/f4x7l0xe2fi61.jpg?width=960\u0026crop=smart\u0026auto=webp\u0026s=e0d746101d13bc725e4763728838065e1b635634",
                                                    PreviewURL1080Width: "https://preview.redd.it/f4x7l0xe2fi61.jpg?width=1080\u0026crop=smart\u0026auto=webp\u0026s=fda15a8f12b41384a602a81699b9ed7a53cfc646"
                                                ]
                                                *Additional Note: Previews go up to 1080 Width, depending on availability.
                                            */
        }
    }
}

Resulting Class Structure:

Result: (object){
    PostLink: string //returns the link to the reddit post
    SubReddit: string //returns the subreddit that the meme came from
    Title: string //returns the title of the original post
    ImageUrl: string //returns the direct link to the meme
    IsNsfw: boolean //returns whether or not the post was marked as NSFW on reddit
    IsSpoiler: boolean //returns whether or not the post was marked as a spoiler on reddit
    AuthorUsername: string //returns the username of the original poster
    Upvotes: number //returns the amount of upvotes the post receivied
    Preview: [ //returns a list of preview links in various sizes
        PreviewURL108Width: string //returns a direct link to a preview of the meme with the width of 108 pixels
        PreviewURL216Width: string //returns a direct link to a preview of the meme with the width of 216 pixels
        PreviewURL320Width: string //returns a direct link to a preview of the meme with the width of 320 pixels
        PreviewURL640Width: string //returns a direct link to a preview of the meme with the width of 640 pixels
        PreviewURL960Width: string //returns a direct link to a preview of the meme with the width of 960 pixels
        PreviewURL1080Width: string //returns a direct link to a preview of the meme with the width of 1080 pixels
    ]
}

Benefits Of Using This Library:

Boils down the process of writing the implementation for the Random Reddit Meme Api to 3 lines. Import. Instantiate. Meme.

As a side note, if you would like to support or contribute to the development of the library:

  • Feel free to fork the repo and PR back any additions
  • Contact me at aldmnatividad@gmail.com for any suggestions
  • Donate to my Ko-fi here (I do this in my free time so any donation you can give helps me develop more things like this!)
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp3.1 is compatible. 
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.5.0 428 3/2/2021
1.3.0 360 2/24/2021
1.2.0 331 2/22/2021
1.1.0 316 2/20/2021
1.0.0 330 2/19/2021

MVP