summaryrefslogtreecommitdiff
path: root/rtclient/ticket.h
blob: 7677b09be726f3ea6725c3b9daf1c1347fa11280 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef RTCLIENT_TICKET_H
#define RTCLIENT_TICKET_H

#include <stdbool.h>

struct rtclient_ticket {
	unsigned int id;
	char *subject;
};

enum rtclient_ticket_history_type {
	RTCLIENT_TICKET_HISTORY_TYPE_NONE = 0
	, RTCLIENT_TICKET_HISTORY_TYPE_CREATE
	, RTCLIENT_TICKET_HISTORY_TYPE_EMAIL_RECORD
	, RTCLIENT_TICKET_HISTORY_TYPE_SET
	, RTCLIENT_TICKET_HISTORY_TYPE_SET_WATCHER
	, RTCLIENT_TICKET_HISTORY_TYPE_STATUS
};

enum rtclient_ticket_history_field {
	RTCLIENT_TICKET_HISTORY_FIELD_NONE = 0
	, RTCLIENT_TICKET_HISTORY_FIELD_PRIORITY
	, RTCLIENT_TICKET_HISTORY_FIELD_STATUS
	, RTCLIENT_TICKET_HISTORY_FIELD_OWNER
};

struct rtclient_ticket_history_attachment {
	unsigned int id;
	char *file_name;
	size_t size;
};

struct rtclient_ticket_history {
	unsigned int id;
	unsigned int ticket;
	unsigned int time_taken;
	enum rtclient_ticket_history_type type;
	enum rtclient_ticket_history_field field;
	char *old_value;
	char *new_value;
	char *data;
	char *description;
	char *content;
	char *creator;
	struct tm *created;
	struct {
		size_t length;
		struct rtclient_ticket_history_attachment *attachments[];
	} *attachments;
};

struct rtclient_ticket_history_list {
	size_t length;
	struct rtclient_ticket_history *histories[];
};

#ifdef __cplusplus
extern "C" {
#endif

	void rtclient_ticket_new(const char *queue
			, const char *requestor
			, const char *subject
			, const char *cc
			, const char *admin_cc
			, const char *owner
			, const char *status
			, const char *priority
			, const char *initial_priority
			, const char *final_priority
			, const char *time_estimated
			, const char *starts
			, const char *due
			, const char *text);
	void rtclient_ticket_history(struct rtclient_ticket_history_list **listptr
			, unsigned int id, bool long_format);
	void rtclient_ticket_history_free
		(struct rtclient_ticket_history *history);
	void rtclient_ticket_history_list_free
		(struct rtclient_ticket_history_list *list);

#ifdef __cplusplus
}
#endif

#endif // RTCLIENT_TICKET_H