libpushover.h 1.41 KB
Newer Older
Shawn Webb's avatar
Shawn Webb committed
1
2
3
4
5
6
7
#ifndef _LIBPUSHOVER_H
#define _LIBPUSHOVER_H

#include <stdbool.h>

#include <curl/curl.h>

Shawn Webb's avatar
Shawn Webb committed
8
9
#define	LIBPUSHOVER_VERSION	 20200428001UL

Shawn Webb's avatar
Shawn Webb committed
10
11
12
#define EXPORTED_SYM	 __attribute__((visibility("default")))
#define PUSHOVER_URI	 "https://api.pushover.net/1/messages.json"

13
14
15
#define	PUSHOVER_FLAGS_NONE	0
#define	PUSHOVER_FLAGS_ALLOC	1

16
17
18
19
20
21
struct _pushover_ctx;
struct _pushover_message;

typedef struct _pushover_ctx pushover_ctx_t;
typedef struct _pushover_message pushover_message_t;

Shawn Webb's avatar
Shawn Webb committed
22
23
24
25
26
27
28
29
30
typedef enum _pushover_priority {
	PSH_PRIO_NONE = -2,
	PSH_PRIO_QUIET = -1,
	PSH_PRIO_DEF = 0,
	PSH_PRIO_HIGH = 1,
	PSH_PRIO_CONFIRM = 2
} pushover_priority_t;

pushover_ctx_t *pushover_init_ctx(const char *);
Shawn Webb's avatar
Shawn Webb committed
31
void pushover_free_ctx(pushover_ctx_t **);
Shawn Webb's avatar
Shawn Webb committed
32
bool pushover_set_uri(pushover_ctx_t *, const char *);
33
bool pushover_set_token(pushover_ctx_t *, const char *);
Shawn Webb's avatar
Shawn Webb committed
34
pushover_message_t *pushover_init_message(pushover_message_t *);
35
void pushover_free_message(pushover_message_t **);
Shawn Webb's avatar
Shawn Webb committed
36
bool pushover_message_set_msg(pushover_message_t *, char *);
37
bool pushover_message_set_dest(pushover_message_t *, char *);
Shawn Webb's avatar
Shawn Webb committed
38
39
40
41
42
43
bool pushover_message_set_title(pushover_message_t *, char *);
bool pushover_message_set_device(pushover_message_t *, char *);
bool pushover_message_set_priority(pushover_message_t *,
    pushover_priority_t);
bool pushover_submit_message(pushover_ctx_t *, pushover_message_t *);

44
45
bool pushover_message_priority_sane(pushover_priority_t);

Shawn Webb's avatar
Shawn Webb committed
46
#endif /* !_LIBPUSHOVER_H */