Skip to content
A .net core wrapper for Wolke's weeb api
C#
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Weeb.net
.gitignore
LICENSE
README.md

README.md


Weeb.net

A fast and easy to use weeb.sh API wrapper.
Originally build with Discord bots in mind like Sora-v2!
Join his Discord Server for support on the wrapper.


NuGet

Installation

Nuget

Frequently updated on Nuget. Versioning follows Semver.

Dependencies

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

//...
	// For example "Sora", "1.0.0". These can be ommited and will default to Weeb.net and its version.
	WeebClient weebClient = new WeebClient("YourBotName", "YourBotVersion");
	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; }
    }
You can’t perform that action at this time.