Files
c621/include/e621.h
T
2026-05-01 13:16:04 +01:00

113 lines
2.0 KiB
C

#ifndef E621_H
#define E621_H
// 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 **tags;
int tags_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;
int children_count;
} 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 general_tags;
e6_tags_t artist_tags;
e6_tags_t character_tags;
e6_tags_t species_tags;
e6_tags_t copyright_tags;
e6_tags_t contributor_tags;
e6_tags_t invalid_tags;
e6_tags_t meta_tags;
e6_tags_t lore_tags;
e6_tags_t locked_tags;
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, e6_tags_t tags, unsigned int page, unsigned int limit);
#endif