class Client
- Client
- Reference
- Object
Overview
Main client class.
Contains typical API functionality such as listing posts, flags, tags, etc.
Defined in:
e6/client.crConstructors
-
.new(login : String, api_key : String, site : String = "e621.net", debug : Bool = false)
Creates a new instance of Client with credentials.
-
.new(site : String = "e621.net", debug : Bool = false)
Creates a new instance of Client.
Instance Method Summary
- #debug : Bool
- #debug=(debug : Bool)
-
#get_post(id : UInt32) : Post | Nil
Gets a single post based on its ID.
-
#list_flags(id : UInt32) : Array(Flag) | Nil
Searches flags by post ID.
-
#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.
-
#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.
- #site : String
- #site=(site : String)
Constructor Detail
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.
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.
Instance Method Detail
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.
Searches posts using a string, just like how searching on the website works.
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.
Lists tags by name or category, sorted by date, count, or alphabetically.