forked from legastero/stanza
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xep0221.ts
47 lines (42 loc) · 1.25 KB
/
xep0221.ts
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
// ====================================================================
// XEP-0221: Data Forms Media Element
// --------------------------------------------------------------------
// Source: https://xmpp.org/extensions/xep-0221.html
// Version: 1.0 (2008-09-03)
// ====================================================================
import { attribute, DefinitionOptions, integerAttribute, text } from '../jxt';
import { NS_DATAFORM_MEDIA } from '../Namespaces';
declare module './xep0004' {
export interface DataFormFieldBase {
media?: DataFormMedia;
}
}
export interface DataFormMedia {
height: number;
width: number;
sources: Array<{
uri: string;
mediaType: string;
}>;
}
const Protocol: DefinitionOptions[] = [
{
element: 'media',
fields: {
height: integerAttribute('height'),
width: integerAttribute('width')
},
namespace: NS_DATAFORM_MEDIA,
path: 'dataform.fields.media'
},
{
aliases: [{ multiple: true, path: 'dataform.fields.media.sources' }],
element: 'uri',
fields: {
mediaType: attribute('type'),
uri: text()
},
namespace: NS_DATAFORM_MEDIA
}
];
export default Protocol;