Files
c621/include/e621.h
2026-02-06 20:52:29 +00:00

117 lines
2.1 KiB
C

#ifndef E621_HPP
#define E621_HPP
// Includes
#include <stdbool.h>
// Defines
#ifndef E621_HOST
#define E621_HOST "https://e621.net"
#endif
#ifndef E621_URL_BUF_SIZE
#define E621_URL_BUF_SIZE 2048
#endif
// Structs
typedef struct {
unsigned int width;
unsigned int height;
char *ext;
unsigned int size;
char *md5;
char *url;
} e6_file_t;
typedef struct {
unsigned int width;
unsigned int height;
char *url;
} e6_preview_t;
typedef struct {
bool has;
unsigned int width;
unsigned int height;
char *url;
} e6_sample_t;
typedef struct {
unsigned int up;
unsigned int down;
int total;
} e6_score_t;
typedef struct {
char **general;
int general_count;
char **artist;
int artist_count;
char **contributor;
int contributor_count;
char **copyright;
int copyright_count;
char **character;
int character_count;
char **species;
int species_count;
char **invalid;
int invalid_count;
char **meta;
int meta_count;
char **lore;
int lore_count;
} e6_tags_t;
typedef struct flags_t {
bool pending;
bool flagged;
bool note_locked;
bool status_locked;
bool rating_locked;
bool deleted;
} e6_flags_t;
typedef struct {
unsigned int parent_id;
bool has_children;
bool has_active_children;
int *children;
} e6_relationships_t;
typedef struct {
unsigned int id;
char *created_at;
char *updated_at;
e6_file_t file;
e6_preview_t preview;
e6_sample_t sample;
e6_score_t score;
e6_tags_t tags;
char **locked_tags;
int locked_tags_count;
unsigned int change_seq;
e6_flags_t flags;
char *rating;
unsigned int fav_count;
int *pools;
e6_relationships_t relationships;
unsigned int approver_id;
unsigned int uploader_id;
char *description;
unsigned int comment_count;
bool is_favorited;
} e6_post_t;
typedef struct {
char *username;
char *api_key;
char *project_name;
float project_ver;
} e6_auth_t;
// Functions
e6_post_t *E6List(e6_auth_t auth, char **tags, int tags_count, unsigned int page, unsigned int limit);
#endif