class Client

Overview

Main client class.

Contains typical API functionality such as listing posts, flags, tags, etc.

Defined in:

e6/client.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(login : String, api_key : String, site : String = "e621.net", debug : Bool = false) #

Creates a new instance of Client with credentials. This will include the credentials in the Authorization: header, as per HTTP Basic Auth.

  • login - your username on the site.
  • api_key - your API key; get it from your account page > Manage API Access
  • site - the site to connect to.
  • debug - whether or not to print debug information such as request times and URLs.

[View source]
def self.new(site : String = "e621.net", debug : Bool = false) #

Creates a new instance of Client.

  • site - the site to connect to.
  • debug - whether or not to print debug information such as request times and URLs.

[View source]

Instance Method Detail

def debug : Bool #

[View source]
def debug=(debug : Bool) #

[View source]
def get_post(id : UInt32) : Post | Nil #

Gets a single post based on its ID.


[View source]
def list_flags(id : UInt32) : Array(Flag) | Nil #

Searches flags by post ID.

BUG Currently, searching by creator ID or name is broken on the API side, so it is not implemented at the moment.

See e621 API > Flags > Listing


[View source]
def list_posts(tags : String, limit : UInt32 = 75, page : String | UInt32 = 0) : Array(Post) | Nil #

Searches posts using a string, just like how searching on the website works.

see e621 API > Posts > List

In addition to a/b(post_id) or a page number, page can also accept "next" or prev". When using "next" or "prev" in page, the IDs of the first and last posts of the last search will be reused when requesting the next or previous page. Note that "next" or "prev" will not work on the first search of a specific query.


[View source]
def list_tags(name_matches : String | Nil = nil, category : UInt8 | String | Nil = nil, order : String = "date", hide_empty : Bool = true, has_wiki : Bool | Nil = nil, has_artist : Bool | Nil = nil, limit : UInt32 = 75, page : UInt32 = 0) : Array(Tag) | Nil #

Lists tags by name or category, sorted by date, count, or alphabetically.

See e621 API > Tags > Listing


[View source]
def site : String #

[View source]
def site=(site : String) #

[View source]