MartineApiNet 1.0.6
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package MartineApiNet --version 1.0.6
NuGet\Install-Package MartineApiNet -Version 1.0.6
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="MartineApiNet" Version="1.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MartineApiNet --version 1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MartineApiNet, 1.0.6"
#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 MartineApiNet as a Cake Addin #addin nuget:?package=MartineApiNet&version=1.0.6 // Install MartineApiNet as a Cake Tool #tool nuget:?package=MartineApiNet&version=1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MartineApi Wrapper
Overview
MartineAPI is a an API made by the owner of Martine Bot
If you find any errors/issues or want any features added, create an issue
Getting started
Installing the package
Add the NuGet package MartineApiNet
to your project:
dotnet add package MartineApiNet
Simple usage
using System;
using System.Threading.Tasks;
using MartineApiNet;
public class ExampleClass
{
private readonly MartineApi _martineApi;
public ExampleClass()
=> _martineApi = new MartineApi();
public async Task GetRandomMeme()
{
var image = await _martineApi.RedditApi.GetRandomMeme();
Console.WriteLine(image.Data.PostUrl);
}
}
Example using custom HttpClient
You can provide your own HttpClient instance, but you have to set the BaseAddress manually
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using MartineApiNet;
public ExampleClass()
{
var httpClient = new HttpClient
{
BaseAddress = new Uri("https://api.martinebot.com/v1")
};
_martineApi = new MartineApi(httpClient);
}
Example using dependency injection
Create a ServiceCollection, then add an instance of the MartineApi class to it
using System;
using System.Threading.Tasks;
using MartineApiNet;
using Microsoft.Extensions.DependencyInjection;
public class Startup
{
private MartineApi _martineApi;
private IServiceProvider _serviceProvider;
public void Init()
{
var services = new ServiceCollection();
_martineApi = new MartineApi();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
}
public async Task RunAsync()
{
var exampleClass = _serviceProvider.GetService<ExampleClass>();
var image = await exampleClass.GetRandomMeme();
Console.WriteLine(image.Data.PostUrl);
}
private void ConfigureServices(IServiceCollection services)
{
services.AddSingleton(_martineApi);
services.AddSingleton<ExampleClass>();
}
}
Using this in a class:
using System.Threading.Tasks;
using MartineApiNet;
using MartineApiNet.Models.Images;
public class ExampleClass
{
private readonly MartineApi _martineApi;
public ExampleClass(MartineApi martineApi)
=> _martineApi = martineApi;
public async Task<RedditPost> GetRandomMeme()
=> await _martineApi.GetRandomMeme();
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net5.0
- Refit (>= 6.3.2)
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.14 | 1,446 | 8/6/2022 | |
1.0.13 | 380 | 8/6/2022 | |
1.0.12 | 500 | 7/22/2022 | |
1.0.11 | 368 | 7/22/2022 | |
1.0.10 | 367 | 7/22/2022 | |
1.0.9 | 382 | 7/22/2022 | |
1.0.8 | 380 | 7/22/2022 | |
1.0.7 | 382 | 7/22/2022 | |
1.0.6 | 1,229 | 2/20/2022 | |
1.0.5 | 402 | 2/20/2022 | |
1.0.4 | 400 | 2/20/2022 | |
1.0.3 | 416 | 2/20/2022 | |
1.0.2 | 428 | 2/18/2022 | |
1.0.1 | 430 | 2/18/2022 | |
1.0.0 | 440 | 2/18/2022 |