summaryrefslogtreecommitdiff
path: root/qrtclient.hxx
blob: 8ee76b35a9885b4e5a9c4a75ddcc3142fc4973c9 (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
#ifndef QRTCLIENT_HXX
#define QRTCLIENT_HXX

#include <QObject>
#include "qrtclient/user.hxx"
#include "qrtclient/ticket.hxx"
#include "qrtclient/tickethistory.hxx"

namespace RTClient {

class Client : public QObject
{
	Q_OBJECT

	public:
		Client(char const* url, char const* cookies,
				char const* certificate = nullptr);
		~Client();

	public slots:
		void logIn(QString const& name, QString const& password);
		void userNew(QString const& name,
				QString const& password,
				QString const& emailAddress = nullptr,
				QString const& realName = nullptr,
				QString const& nickName = nullptr,
				QString const& organization = nullptr,
				QString const& address1 = nullptr,
				QString const& address2 = nullptr,
				QString const& city = nullptr,
				QString const& state = nullptr,
				QString const& zip = nullptr,
				QString const& country = nullptr,
				QString const& homePhone = nullptr,
				QString const& workPhone = nullptr,
				QString const& mobilePhone = nullptr,
				QString const& pagerPhone = nullptr,
				QString const& contactInfo = nullptr,
				QString const& comments = nullptr,
				QString const& signature = nullptr,
				QString const& gecos = nullptr,
				rtclient_user_lang lang
					= RTCLIENT_USER_LANG_NONE,
				rtclient_user_timezone timezone
					= RTCLIENT_USER_TIMEZONE_NONE,
				bool disabled = false,
				bool privileged = false);
		void userShow(unsigned int id);
		void userShow(QString const& name);
		void ticketNew(QString const& queue = nullptr,
				QString const& requestor = nullptr,
				QString const& subject = nullptr,
				QString const& cc = nullptr,
				QString const& adminCc = nullptr,
				QString const& owner = nullptr,
				QString const& status = nullptr,
				QString const& priority = nullptr,
				QString const& initialPriority = nullptr,
				QString const& finalPriority = nullptr,
				QString const& timeEstimated = nullptr,
				QString const& starts = nullptr,
				QString const& due = nullptr,
				QString const& text = nullptr);
		void searchTicket(QString const& owner);
		void ticketHistoryList(int id, bool longFormat = false);

	signals:
		void loggedIn(QString const& name);
		void userShown(User const& user);
		void searchedTicket(TicketList const& list);
		void gotTicketHistoryList(TicketHistoryList const& list);

	protected:
		void emitLoggedIn(QString const&);
		void emitUserShown(User const&);
		void emitSearchedTicket(TicketList const&);
		void emitGotTicketHistoryList(TicketHistoryList const&);
};

}

#endif