Weeb.net
1.0.4
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 Weeb.net --version 1.0.4
NuGet\Install-Package Weeb.net -Version 1.0.4
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="Weeb.net" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Weeb.net --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Weeb.net, 1.0.4"
#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 Weeb.net as a Cake Addin #addin nuget:?package=Weeb.net&version=1.0.4 // Install Weeb.net as a Cake Tool #tool nuget:?package=Weeb.net&version=1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Token
To use the weeb.sh services you need an authentication token. You can request one at devs@weeb.sh
Usage
Creating a client and authentication
//...
WeebClient weebClient = new WeebClient();
string token = "YOUR TOKEN";
public async Task InitializeAsync()
{
//Will print current weeb.sh API version and Weeb.net wrapper version
await weebClient.Authenticate(token, TokenType.Bearer); //or TokenType.Wolke
}
//...
Getting all available tags
//...
public async Task<TagsData> GetTagsAsync(bool hidden)
{
return await weebClient.GetTagsAsync(hidden); //hidden is always defaulted to false
}
//...
Getting all available types
//...
public async Task<TypesData> GetTypesAsync(bool hidden)
{
return await weebClient.GetTypesAsync(hidden); //hidden is always defaulted to false
}
//...
Getting Random image with type and or tags
You must have at least either type or tags!
UPDATE: There have been som minor changes to accomodate new features.
fileType consists of: Jpg, png, gif, any
. Jpg and jpeg are treated as equal.
NsfwSearch consists of: false, ture, only
//...
public async Task<RandomData> GetTypesAsync(string type, IEnumerable<string> tags,FileType fileType, NsfwSearch nsfw,bool hidden)
{
var result = await weebClient.GetRandomAsync(type, tags, fileType, hidden, nsfw); //hidden and nsfw are always defaulted to false
if (result == null)
{
//Nothing was found do smth...
//...
return null
}
return result
}
//...
Models
TagsData
public class TagsData
{
internal string Status { get; set; } //cannot be used in your program. only used for internal wrapper things :P
public List<string> Tags { get; set; }
}
TypesData
public class TypesData
{
internal string Status { get; set; } //cannot be used in your program. only used for internal wrapper things :P
public List<string> Types { get; set; }
}
RandomData
public class RandomData
{
public string Id { get; set; }
public string BaseType { get; set; }
public string FileType { get; set; }
public string MimeType { get; set; }
public string Account { get; set; }
public bool Hidden { get; set; }
public bool Nsfw { get; set; }
public List<Tags> Tags { get; set; }
public string Url { get; set; }
}
public class Tags
{
public string Name { get; set; }
public bool Hidden { get; set; }
public string User { get; set; }
}
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
- Newtonsoft.Json (>= 11.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Added Support for Wolke Tokens