/
infoprovider.go
44 lines (35 loc) · 1.37 KB
/
infoprovider.go
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
package xep0030
import (
"context"
"github.com/dantin/cubit/module/xep0004"
"github.com/dantin/cubit/xmpp"
"github.com/dantin/cubit/xmpp/jid"
)
// Feature represents a disco info feature entity.
type Feature = string
// Identity represents a disco info identity entity.
type Identity struct {
Category string
Type string
Name string
}
// Item represents a disco info item entity.
type Item struct {
Jid string
Name string
Node string
}
// InfoProvider represents a generic disco info domain provider.
type InfoProvider interface {
// Identities returns all identities associated to the provider.
Identities(ctx context.Context, toJID, fromJID *jid.JID, node string) []Identity
// Items returns all items associated to the provider.
// A proper stanza error should be returned in case an error occurs.
Items(ctx context.Context, toJID, fromJID *jid.JID, node string) ([]Item, *xmpp.StanzaError)
// Features returns all features associated to the provider.
// A proper stanza error should be returned in case an error occurs.
Features(ctx context.Context, toJID, fromJID *jid.JID, node string) ([]Feature, *xmpp.StanzaError)
// ResultForm returns the data form associated to the provider.
// A proper stanza error should be returned in case an error occurs.
Form(ctx context.Context, toJID, fromJID *jid.JID, node string) (*xep0004.DataForm, *xmpp.StanzaError)
}