aboutsummaryrefslogtreecommitdiffstats
path: root/teal-src/util/stanza.d.tl
blob: a04deee0f9f0fdccfad688cd6bb4e1cd7b62e3bb (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
87
88
89
90
91
92
93
94
95
local record lib

	type children_iter = function ( stanza_t ) : stanza_t
	type childtags_iter = function () : stanza_t
	type maptags_cb = function ( stanza_t ) : stanza_t


	enum stanza_error_type
		"auth"
		"cancel"
		"continue"
		"modify"
		"wait"
	end
	enum stanza_error_condition
		"bad-request"
		"conflict"
		"feature-not-implemented"
		"forbidden"
		"gone"
		"internal-server-error"
		"item-not-found"
		"jid-malformed"
		"not-acceptable"
		"not-allowed"
		"not-authorized"
		"policy-violation"
		"recipient-unavailable"
		"redirect"
		"registration-required"
		"remote-server-not-found"
		"remote-server-timeout"
		"resource-constraint"
		"service-unavailable"
		"subscription-required"
		"undefined-condition"
		"unexpected-request"
	end

	record stanza_t
		name : string
		attr : { string : string }
		{ stanza_t | string }
		tags : { stanza_t }

		query : function ( stanza_t, string ) : stanza_t
		body : function ( stanza_t, string, { string : string } ) : stanza_t
		text_tag : function ( stanza_t, string, string, { string : string } ) : stanza_t
		tag : function ( stanza_t, string, { string : string } ) : stanza_t
		text : function ( stanza_t, string ) : stanza_t
		up : function ( stanza_t ) : stanza_t
		reset : function ( stanza_t ) : stanza_t
		add_direct_child : function ( stanza_t, stanza_t )
		add_child : function ( stanza_t, stanza_t )
		remove_children : function ( stanza_t, string, string ) : stanza_t

		get_child : function ( stanza_t, string, string ) : stanza_t
		get_text : function ( stanza_t ) : string
		get_child_text : function ( stanza_t, string, string ) : string
		child_with_name : function ( stanza_t, string, string ) : stanza_t
		child_with_ns : function ( stanza_t, string, string ) : stanza_t
		children : function ( stanza_t ) : children_iter, stanza_t, integer
		childtags : function ( stanza_t, string, string ) : childtags_iter
		maptags : function ( stanza_t, maptags_cb ) : stanza_t
		find : function ( stanza_t, string ) : stanza_t | string

		top_tag : function ( stanza_t ) : string
		pretty_print : function ( stanza_t ) : string
		pretty_top_tag : function ( stanza_t ) : string

		get_error : function ( stanza_t ) : stanza_error_type, stanza_error_condition, string, stanza_t
		indent : function ( stanza_t, integer, string ) : stanza_t
	end

	record serialized_stanza_t
		name : string
		attr : { string : string }
		{ serialized_stanza_t | string }
	end

	stanza : function ( string, { string : string } ) : stanza_t
	is_stanza : function ( any ) : boolean
	preserialize : function ( stanza_t ) : serialized_stanza_t
	deserialize : function ( serialized_stanza_t ) : stanza_t
	clone : function ( stanza_t, boolean ) : stanza_t
	message : function ( { string : string }, string ) : stanza_t
	iq : function ( { string : string } ) : stanza_t
	reply : function ( stanza_t ) : stanza_t
	error_reply : function ( stanza_t, stanza_error_type, stanza_error_condition, string, string ) : stanza_t
	presence : function ( { string : string } ) : stanza_t
	xml_escape : function ( string ) : string
	pretty_print : function ( string ) : string
end

return lib