chore: Update to matrix v1.2
This commit is contained in:
parent
2fa6561f36
commit
d6bb91f7e1
|
|
@ -13,6 +13,10 @@ test/.test_coverage.dart
|
||||||
coverage/
|
coverage/
|
||||||
coverage_badge.svg
|
coverage_badge.svg
|
||||||
|
|
||||||
|
# codegen related
|
||||||
|
*.bak
|
||||||
|
*.bakmacoscompat
|
||||||
|
|
||||||
# IntelliJ related
|
# IntelliJ related
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
|
|
|
||||||
|
|
@ -89,17 +89,17 @@ class FakeMatrixApi extends MockClient {
|
||||||
statusCode = 405;
|
statusCode = 405;
|
||||||
}
|
}
|
||||||
} else if (method == 'PUT' &&
|
} else if (method == 'PUT' &&
|
||||||
action.contains('/client/r0/sendToDevice/')) {
|
action.contains('/client/v3/sendToDevice/')) {
|
||||||
res = {};
|
res = {};
|
||||||
} else if (method == 'GET' &&
|
} else if (method == 'GET' &&
|
||||||
action.contains('/client/r0/rooms/') &&
|
action.contains('/client/v3/rooms/') &&
|
||||||
action.contains('/state/m.room.member/')) {
|
action.contains('/state/m.room.member/')) {
|
||||||
res = {'displayname': ''};
|
res = {'displayname': ''};
|
||||||
} else if (method == 'PUT' &&
|
} else if (method == 'PUT' &&
|
||||||
action.contains(
|
action.contains(
|
||||||
'/client/r0/rooms/!1234%3AfakeServer.notExisting/send/')) {
|
'/client/v3/rooms/!1234%3AfakeServer.notExisting/send/')) {
|
||||||
res = {'event_id': '\$event${FakeMatrixApi.eventCounter++}'};
|
res = {'event_id': '\$event${FakeMatrixApi.eventCounter++}'};
|
||||||
} else if (action.contains('/client/r0/sync')) {
|
} else if (action.contains('/client/v3/sync')) {
|
||||||
res = {
|
res = {
|
||||||
'next_batch': DateTime.now().millisecondsSinceEpoch.toString
|
'next_batch': DateTime.now().millisecondsSinceEpoch.toString
|
||||||
};
|
};
|
||||||
|
|
@ -752,11 +752,11 @@ class FakeMatrixApi extends MockClient {
|
||||||
'errcode': 'M_FORBIDDEN',
|
'errcode': 'M_FORBIDDEN',
|
||||||
'error': 'Blabla',
|
'error': 'Blabla',
|
||||||
},
|
},
|
||||||
'/media/r0/preview_url?url=https%3A%2F%2Fmatrix.org&ts=10': (var req) => {
|
'/media/v3/preview_url?url=https%3A%2F%2Fmatrix.org&ts=10': (var req) => {
|
||||||
'og:image': 'mxc://example.com/ascERGshawAWawugaAcauga',
|
'og:image': 'mxc://example.com/ascERGshawAWawugaAcauga',
|
||||||
'matrix:image:size': 102400
|
'matrix:image:size': 102400
|
||||||
},
|
},
|
||||||
'/media/r0/config': (var req) => {'m.upload.size': 50000000},
|
'/media/v3/config': (var req) => {'m.upload.size': 50000000},
|
||||||
'/.well-known/matrix/client': (var req) => {
|
'/.well-known/matrix/client': (var req) => {
|
||||||
'm.homeserver': {
|
'm.homeserver': {
|
||||||
'base_url': 'https://fakeserver.notexisting',
|
'base_url': 'https://fakeserver.notexisting',
|
||||||
|
|
@ -768,7 +768,7 @@ class FakeMatrixApi extends MockClient {
|
||||||
'app_url': 'https://custom.app.fakeserver.notexisting'
|
'app_url': 'https://custom.app.fakeserver.notexisting'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'/client/r0/user/%40alice%3Aexample.com/rooms/!localpart%3Aexample.com/tags':
|
'/client/v3/user/%40alice%3Aexample.com/rooms/!localpart%3Aexample.com/tags':
|
||||||
(var req) => {
|
(var req) => {
|
||||||
'tags': {
|
'tags': {
|
||||||
'm.favourite': {'order': 0.1},
|
'm.favourite': {'order': 0.1},
|
||||||
|
|
@ -776,7 +776,7 @@ class FakeMatrixApi extends MockClient {
|
||||||
'u.Customers': {}
|
'u.Customers': {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'/client/r0/events?from=1234&timeout=10&room_id=%211234': (var req) => {
|
'/client/v3/events?from=1234&timeout=10&room_id=%211234': (var req) => {
|
||||||
'start': 's3456_9_0',
|
'start': 's3456_9_0',
|
||||||
'end': 's3457_9_0',
|
'end': 's3457_9_0',
|
||||||
'chunk': [
|
'chunk': [
|
||||||
|
|
@ -796,35 +796,35 @@ class FakeMatrixApi extends MockClient {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'/client/r0/thirdparty/location?alias=1234': (var req) => [
|
'/client/v3/thirdparty/location?alias=1234': (var req) => [
|
||||||
{
|
{
|
||||||
'alias': '#freenode_#matrix:matrix.org',
|
'alias': '#freenode_#matrix:matrix.org',
|
||||||
'protocol': 'irc',
|
'protocol': 'irc',
|
||||||
'fields': {'network': 'freenode', 'channel': '#matrix'}
|
'fields': {'network': 'freenode', 'channel': '#matrix'}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'/client/r0/thirdparty/location/irc': (var req) => [
|
'/client/v3/thirdparty/location/irc': (var req) => [
|
||||||
{
|
{
|
||||||
'alias': '#freenode_#matrix:matrix.org',
|
'alias': '#freenode_#matrix:matrix.org',
|
||||||
'protocol': 'irc',
|
'protocol': 'irc',
|
||||||
'fields': {'network': 'freenode', 'channel': '#matrix'}
|
'fields': {'network': 'freenode', 'channel': '#matrix'}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'/client/r0/thirdparty/user/irc': (var req) => [
|
'/client/v3/thirdparty/user/irc': (var req) => [
|
||||||
{
|
{
|
||||||
'userid': '@_gitter_jim:matrix.org',
|
'userid': '@_gitter_jim:matrix.org',
|
||||||
'protocol': 'gitter',
|
'protocol': 'gitter',
|
||||||
'fields': {'user': 'jim'}
|
'fields': {'user': 'jim'}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'/client/r0/thirdparty/user?userid=1234': (var req) => [
|
'/client/v3/thirdparty/user?userid=1234': (var req) => [
|
||||||
{
|
{
|
||||||
'userid': '@_gitter_jim:matrix.org',
|
'userid': '@_gitter_jim:matrix.org',
|
||||||
'protocol': 'gitter',
|
'protocol': 'gitter',
|
||||||
'fields': {'user': 'jim'}
|
'fields': {'user': 'jim'}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'/client/r0/thirdparty/protocol/irc': (var req) => {
|
'/client/v3/thirdparty/protocol/irc': (var req) => {
|
||||||
'user_fields': ['network', 'nickname'],
|
'user_fields': ['network', 'nickname'],
|
||||||
'location_fields': ['network', 'channel'],
|
'location_fields': ['network', 'channel'],
|
||||||
'icon': 'mxc://example.org/aBcDeFgH',
|
'icon': 'mxc://example.org/aBcDeFgH',
|
||||||
|
|
@ -845,7 +845,7 @@ class FakeMatrixApi extends MockClient {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'/client/r0/thirdparty/protocols': (var req) => {
|
'/client/v3/thirdparty/protocols': (var req) => {
|
||||||
'irc': {
|
'irc': {
|
||||||
'user_fields': ['network', 'nickname'],
|
'user_fields': ['network', 'nickname'],
|
||||||
'location_fields': ['network', 'channel'],
|
'location_fields': ['network', 'channel'],
|
||||||
|
|
@ -888,9 +888,9 @@ class FakeMatrixApi extends MockClient {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'/client/r0/account/whoami': (var req) =>
|
'/client/v3/account/whoami': (var req) =>
|
||||||
{'user_id': 'alice@example.com'},
|
{'user_id': 'alice@example.com'},
|
||||||
'/client/r0/capabilities': (var req) => {
|
'/client/v3/capabilities': (var req) => {
|
||||||
'capabilities': {
|
'capabilities': {
|
||||||
'm.change_password': {'enabled': false},
|
'm.change_password': {'enabled': false},
|
||||||
'm.room_versions': {
|
'm.room_versions': {
|
||||||
|
|
@ -905,7 +905,7 @@ class FakeMatrixApi extends MockClient {
|
||||||
'com.example.custom.ratelimit': {'max_requests_per_hour': 600}
|
'com.example.custom.ratelimit': {'max_requests_per_hour': 600}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/1234/context/1234?limit=10&filter=%7B%7D': (var req) =>
|
'/client/v3/rooms/1234/context/1234?limit=10&filter=%7B%7D': (var req) =>
|
||||||
{
|
{
|
||||||
'end': 't29-57_2_0_2',
|
'end': 't29-57_2_0_2',
|
||||||
'events_after': [
|
'events_after': [
|
||||||
|
|
@ -996,7 +996,7 @@ class FakeMatrixApi extends MockClient {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'/client/r0/admin/whois/%40alice%3Aexample.com': (var req) => {
|
'/client/v3/admin/whois/%40alice%3Aexample.com': (var req) => {
|
||||||
'user_id': '@peter:rabbit.rocks',
|
'user_id': '@peter:rabbit.rocks',
|
||||||
'devices': {
|
'devices': {
|
||||||
'teapot': {
|
'teapot': {
|
||||||
|
|
@ -1020,15 +1020,15 @@ class FakeMatrixApi extends MockClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'/client/r0/user/%40alice%3Aexample.com/account_data/test.account.data':
|
'/client/v3/user/%40alice%3Aexample.com/account_data/test.account.data':
|
||||||
(var req) => {'foo': 'bar'},
|
(var req) => {'foo': 'bar'},
|
||||||
'/client/r0/user/%40alice%3Aexample.com/rooms/1234/account_data/test.account.data':
|
'/client/v3/user/%40alice%3Aexample.com/rooms/1234/account_data/test.account.data':
|
||||||
(var req) => {'foo': 'bar'},
|
(var req) => {'foo': 'bar'},
|
||||||
'/client/r0/directory/room/%23testalias%3Aexample.com': (var reqI) => {
|
'/client/v3/directory/room/%23testalias%3Aexample.com': (var reqI) => {
|
||||||
'room_id': '!abnjk1jdasj98:capuchins.com',
|
'room_id': '!abnjk1jdasj98:capuchins.com',
|
||||||
'servers': ['capuchins.com', 'matrix.org', 'another.com']
|
'servers': ['capuchins.com', 'matrix.org', 'another.com']
|
||||||
},
|
},
|
||||||
'/client/r0/account/3pid': (var req) => {
|
'/client/v3/account/3pid': (var req) => {
|
||||||
'threepids': [
|
'threepids': [
|
||||||
{
|
{
|
||||||
'medium': 'email',
|
'medium': 'email',
|
||||||
|
|
@ -1038,7 +1038,7 @@ class FakeMatrixApi extends MockClient {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'/client/r0/devices': (var req) => {
|
'/client/v3/devices': (var req) => {
|
||||||
'devices': [
|
'devices': [
|
||||||
{
|
{
|
||||||
'device_id': 'QBUAZIFURK',
|
'device_id': 'QBUAZIFURK',
|
||||||
|
|
@ -1048,7 +1048,7 @@ class FakeMatrixApi extends MockClient {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'/client/r0/notifications?from=1234&limit=10&only=1234': (var req) => {
|
'/client/v3/notifications?from=1234&limit=10&only=1234': (var req) => {
|
||||||
'next_token': 'abcdef',
|
'next_token': 'abcdef',
|
||||||
'notifications': [
|
'notifications': [
|
||||||
{
|
{
|
||||||
|
|
@ -1074,21 +1074,21 @@ class FakeMatrixApi extends MockClient {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'/client/r0/devices/QBUAZIFURK': (var req) => {
|
'/client/v3/devices/QBUAZIFURK': (var req) => {
|
||||||
'device_id': 'QBUAZIFURK',
|
'device_id': 'QBUAZIFURK',
|
||||||
'display_name': 'android',
|
'display_name': 'android',
|
||||||
'last_seen_ip': '1.2.3.4',
|
'last_seen_ip': '1.2.3.4',
|
||||||
'last_seen_ts': 1474491775024
|
'last_seen_ts': 1474491775024
|
||||||
},
|
},
|
||||||
'/client/r0/profile/%40alice%3Aexample.com/displayname': (var reqI) =>
|
'/client/v3/profile/%40alice%3Aexample.com/displayname': (var reqI) =>
|
||||||
{'displayname': 'Alice M'},
|
{'displayname': 'Alice M'},
|
||||||
'/client/r0/profile/%40alice%3Aexample.com/avatar_url': (var reqI) =>
|
'/client/v3/profile/%40alice%3Aexample.com/avatar_url': (var reqI) =>
|
||||||
{'avatar_url': 'mxc://test'},
|
{'avatar_url': 'mxc://test'},
|
||||||
'/client/r0/profile/%40alice%3Aexample.com': (var reqI) => {
|
'/client/v3/profile/%40alice%3Aexample.com': (var reqI) => {
|
||||||
'avatar_url': 'mxc://test',
|
'avatar_url': 'mxc://test',
|
||||||
'displayname': 'Alice M',
|
'displayname': 'Alice M',
|
||||||
},
|
},
|
||||||
'/client/r0/voip/turnServer': (var req) => {
|
'/client/v3/voip/turnServer': (var req) => {
|
||||||
'username': '1443779631:@user:example.com',
|
'username': '1443779631:@user:example.com',
|
||||||
'password': 'JlKfBy1QwLrO20385QyAtEyIv0=',
|
'password': 'JlKfBy1QwLrO20385QyAtEyIv0=',
|
||||||
'uris': [
|
'uris': [
|
||||||
|
|
@ -1098,18 +1098,18 @@ class FakeMatrixApi extends MockClient {
|
||||||
],
|
],
|
||||||
'ttl': 86400
|
'ttl': 86400
|
||||||
},
|
},
|
||||||
'/client/r0/presence/${Uri.encodeComponent('@alice:example.com')}/status':
|
'/client/v3/presence/${Uri.encodeComponent('@alice:example.com')}/status':
|
||||||
(var req) => {
|
(var req) => {
|
||||||
'presence': 'unavailable',
|
'presence': 'unavailable',
|
||||||
'last_active_ago': 420845,
|
'last_active_ago': 420845,
|
||||||
'status_msg': 'test',
|
'status_msg': 'test',
|
||||||
'currently_active': false
|
'currently_active': false
|
||||||
},
|
},
|
||||||
'/client/r0/keys/changes?from=1234&to=1234': (var req) => {
|
'/client/v3/keys/changes?from=1234&to=1234': (var req) => {
|
||||||
'changed': ['@alice:example.com', '@bob:example.org'],
|
'changed': ['@alice:example.com', '@bob:example.org'],
|
||||||
'left': ['@clara:example.com', '@doug:example.org']
|
'left': ['@clara:example.com', '@doug:example.org']
|
||||||
},
|
},
|
||||||
'/client/r0/pushers': (var req) => {
|
'/client/v3/pushers': (var req) => {
|
||||||
'pushers': [
|
'pushers': [
|
||||||
{
|
{
|
||||||
'pushkey': 'Xp/MzCt8/9DcSNE9cuiaoT5Ac55job3TdLSSmtmYl4A=',
|
'pushkey': 'Xp/MzCt8/9DcSNE9cuiaoT5Ac55job3TdLSSmtmYl4A=',
|
||||||
|
|
@ -1126,11 +1126,10 @@ class FakeMatrixApi extends MockClient {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'/client/r0/publicRooms?limit=10&since=1234&server=example.com':
|
'/client/v3/publicRooms?limit=10&since=1234&server=example.com':
|
||||||
(var req) => {
|
(var req) => {
|
||||||
'chunk': [
|
'chunk': [
|
||||||
{
|
{
|
||||||
'aliases': ['#murrays:cheese.bar'],
|
|
||||||
'canonical_alias': '#murrays:cheese.bar',
|
'canonical_alias': '#murrays:cheese.bar',
|
||||||
'avatar_url': 'mxc://bleeker.street/CHEDDARandBRIE',
|
'avatar_url': 'mxc://bleeker.street/CHEDDARandBRIE',
|
||||||
'guest_can_join': false,
|
'guest_can_join': false,
|
||||||
|
|
@ -1145,30 +1144,30 @@ class FakeMatrixApi extends MockClient {
|
||||||
'prev_batch': 'p1902',
|
'prev_batch': 'p1902',
|
||||||
'total_room_count_estimate': 115
|
'total_room_count_estimate': 115
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!localpart%3Aexample.com/aliases': (var req) => {
|
'/client/v3/rooms/!localpart%3Aexample.com/aliases': (var req) => {
|
||||||
'aliases': [
|
'aliases': [
|
||||||
'#somewhere:example.com',
|
'#somewhere:example.com',
|
||||||
'#another:example.com',
|
'#another:example.com',
|
||||||
'#hat_trick:example.com'
|
'#hat_trick:example.com'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'/client/r0/joined_rooms': (var req) => {
|
'/client/v3/joined_rooms': (var req) => {
|
||||||
'joined_rooms': ['!foo:example.com']
|
'joined_rooms': ['!foo:example.com']
|
||||||
},
|
},
|
||||||
'/client/r0/directory/list/room/!localpart%3Aexample.com': (var req) =>
|
'/client/v3/directory/list/room/!localpart%3Aexample.com': (var req) =>
|
||||||
{'visibility': 'public'},
|
{'visibility': 'public'},
|
||||||
'/client/r0/rooms/1/state/m.room.member/@alice:example.com': (var req) =>
|
'/client/v3/rooms/1/state/m.room.member/@alice:example.com': (var req) =>
|
||||||
{'displayname': 'Alice'},
|
{'displayname': 'Alice'},
|
||||||
'/client/r0/profile/%40getme%3Aexample.com': (var req) => {
|
'/client/v3/profile/%40getme%3Aexample.com': (var req) => {
|
||||||
'avatar_url': 'mxc://test',
|
'avatar_url': 'mxc://test',
|
||||||
'displayname': 'You got me',
|
'displayname': 'You got me',
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/state/m.room.member/@getme%3Aexample.com':
|
'/client/v3/rooms/!localpart%3Aserver.abc/state/m.room.member/@getme%3Aexample.com':
|
||||||
(var req) => {
|
(var req) => {
|
||||||
'avatar_url': 'mxc://test',
|
'avatar_url': 'mxc://test',
|
||||||
'displayname': 'You got me',
|
'displayname': 'You got me',
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/state': (var req) => [
|
'/client/v3/rooms/!localpart%3Aserver.abc/state': (var req) => [
|
||||||
{
|
{
|
||||||
'content': {'join_rule': 'public'},
|
'content': {'join_rule': 'public'},
|
||||||
'type': 'm.room.join_rules',
|
'type': 'm.room.join_rules',
|
||||||
|
|
@ -1233,12 +1232,12 @@ class FakeMatrixApi extends MockClient {
|
||||||
'state_key': ''
|
'state_key': ''
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'/client/r0/rooms/!localpart:server.abc/state/m.room.member/@getme:example.com':
|
'/client/v3/rooms/!localpart:server.abc/state/m.room.member/@getme:example.com':
|
||||||
(var req) => {
|
(var req) => {
|
||||||
'avatar_url': 'mxc://test',
|
'avatar_url': 'mxc://test',
|
||||||
'displayname': 'You got me',
|
'displayname': 'You got me',
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!localpart:server.abc/event/1234': (var req) => {
|
'/client/v3/rooms/!localpart:server.abc/event/1234': (var req) => {
|
||||||
'content': {
|
'content': {
|
||||||
'body': 'This is an example text message',
|
'body': 'This is an example text message',
|
||||||
'msgtype': 'm.text',
|
'msgtype': 'm.text',
|
||||||
|
|
@ -1252,7 +1251,7 @@ class FakeMatrixApi extends MockClient {
|
||||||
'origin_server_ts': 1432735824653,
|
'origin_server_ts': 1432735824653,
|
||||||
'unsigned': {'age': 1234}
|
'unsigned': {'age': 1234}
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/event/1234': (var req) => {
|
'/client/v3/rooms/!localpart%3Aserver.abc/event/1234': (var req) => {
|
||||||
'content': {
|
'content': {
|
||||||
'body': 'This is an example text message',
|
'body': 'This is an example text message',
|
||||||
'msgtype': 'm.text',
|
'msgtype': 'm.text',
|
||||||
|
|
@ -1266,11 +1265,11 @@ class FakeMatrixApi extends MockClient {
|
||||||
'origin_server_ts': 1432735824653,
|
'origin_server_ts': 1432735824653,
|
||||||
'unsigned': {'age': 1234}
|
'unsigned': {'age': 1234}
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/messages?from=1234&to=1234&dir=b&limit=10&filter=%7B%22lazy_load_members%22%3Atrue%7D':
|
'/client/v3/rooms/!localpart%3Aserver.abc/messages?from=1234&to=1234&dir=b&limit=10&filter=%7B%22lazy_load_members%22%3Atrue%7D':
|
||||||
(var req) => messagesResponse,
|
(var req) => messagesResponse,
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/messages?from=&dir=b&limit=10&filter=%7B%22lazy_load_members%22%3Atrue%7D':
|
'/client/v3/rooms/!localpart%3Aserver.abc/messages?from=&dir=b&limit=10&filter=%7B%22lazy_load_members%22%3Atrue%7D':
|
||||||
(var req) => messagesResponse,
|
(var req) => messagesResponse,
|
||||||
'/client/r0/rooms/!1234%3Aexample.com/messages?from=1234&dir=b&limit=100&filter=%7B%22lazy_load_members%22%3Atrue%7D':
|
'/client/v3/rooms/!1234%3Aexample.com/messages?from=1234&dir=b&limit=100&filter=%7B%22lazy_load_members%22%3Atrue%7D':
|
||||||
(var req) => messagesResponse,
|
(var req) => messagesResponse,
|
||||||
'/client/versions': (var req) => {
|
'/client/versions': (var req) => {
|
||||||
'versions': [
|
'versions': [
|
||||||
|
|
@ -1283,12 +1282,12 @@ class FakeMatrixApi extends MockClient {
|
||||||
],
|
],
|
||||||
'unstable_features': {'m.lazy_load_members': true},
|
'unstable_features': {'m.lazy_load_members': true},
|
||||||
},
|
},
|
||||||
'/client/r0/login': (var req) => {
|
'/client/v3/login': (var req) => {
|
||||||
'flows': [
|
'flows': [
|
||||||
{'type': 'm.login.password'}
|
{'type': 'm.login.password'}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/joined_members': (var req) => {
|
'/client/v3/rooms/!localpart%3Aserver.abc/joined_members': (var req) => {
|
||||||
'joined': {
|
'joined': {
|
||||||
'@bar:example.com': {
|
'@bar:example.com': {
|
||||||
'display_name': 'Bar',
|
'display_name': 'Bar',
|
||||||
|
|
@ -1296,7 +1295,7 @@ class FakeMatrixApi extends MockClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/members?at=1234&membership=join¬_membership=leave':
|
'/client/v3/rooms/!localpart%3Aserver.abc/members?at=1234&membership=join¬_membership=leave':
|
||||||
(var req) => {
|
(var req) => {
|
||||||
'chunk': [
|
'chunk': [
|
||||||
{
|
{
|
||||||
|
|
@ -1315,7 +1314,7 @@ class FakeMatrixApi extends MockClient {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!696r7674:example.com/members': (var req) => {
|
'/client/v3/rooms/!696r7674:example.com/members': (var req) => {
|
||||||
'chunk': [
|
'chunk': [
|
||||||
{
|
{
|
||||||
'content': {
|
'content': {
|
||||||
|
|
@ -1333,7 +1332,7 @@ class FakeMatrixApi extends MockClient {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!726s6s6q:example.com/members': (var req) => {
|
'/client/v3/rooms/!726s6s6q:example.com/members': (var req) => {
|
||||||
'chunk': [
|
'chunk': [
|
||||||
{
|
{
|
||||||
'content': {
|
'content': {
|
||||||
|
|
@ -1351,7 +1350,7 @@ class FakeMatrixApi extends MockClient {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/members': (var req) => {
|
'/client/v3/rooms/!localpart%3Aserver.abc/members': (var req) => {
|
||||||
'chunk': [
|
'chunk': [
|
||||||
{
|
{
|
||||||
'content': {
|
'content': {
|
||||||
|
|
@ -1369,20 +1368,20 @@ class FakeMatrixApi extends MockClient {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'/client/r0/pushrules/global/content/nocake': (var req) => {
|
'/client/v3/pushrules/global/content/nocake': (var req) => {
|
||||||
'actions': ['dont_notify'],
|
'actions': ['dont_notify'],
|
||||||
'pattern': 'cake*lie',
|
'pattern': 'cake*lie',
|
||||||
'rule_id': 'nocake',
|
'rule_id': 'nocake',
|
||||||
'enabled': true,
|
'enabled': true,
|
||||||
'default': false
|
'default': false
|
||||||
},
|
},
|
||||||
'/client/r0/pushrules/global/content/nocake/enabled': (var req) => {
|
'/client/v3/pushrules/global/content/nocake/enabled': (var req) => {
|
||||||
'enabled': true,
|
'enabled': true,
|
||||||
},
|
},
|
||||||
'/client/r0/pushrules/global/content/nocake/actions': (var req) => {
|
'/client/v3/pushrules/global/content/nocake/actions': (var req) => {
|
||||||
'actions': ['notify']
|
'actions': ['notify']
|
||||||
},
|
},
|
||||||
'/client/r0/pushrules': (var req) => {
|
'/client/v3/pushrules': (var req) => {
|
||||||
'global': {
|
'global': {
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
|
|
@ -1527,15 +1526,15 @@ class FakeMatrixApi extends MockClient {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'/client/r0/sync?filter=%7B%22room%22%3A%7B%22include_leave%22%3Atrue%2C%22timeline%22%3A%7B%22limit%22%3A10%7D%7D%7D&timeout=0':
|
'/client/v3/sync?filter=%7B%22room%22%3A%7B%22include_leave%22%3Atrue%2C%22timeline%22%3A%7B%22limit%22%3A10%7D%7D%7D&timeout=0':
|
||||||
(var req) => archiveSyncResponse,
|
(var req) => archiveSyncResponse,
|
||||||
'/client/r0/sync?filter=%7B%22room%22%3A%7B%22state%22%3A%7B%22lazy_load_members%22%3Atrue%7D%7D%7D':
|
'/client/v3/sync?filter=%7B%22room%22%3A%7B%22state%22%3A%7B%22lazy_load_members%22%3Atrue%7D%7D%7D':
|
||||||
(var req) => syncResponse,
|
(var req) => syncResponse,
|
||||||
'/client/r0/sync?filter=%7B%7D&since=1234&full_state=false&set_presence=unavailable&timeout=15':
|
'/client/v3/sync?filter=%7B%7D&since=1234&full_state=false&set_presence=unavailable&timeout=15':
|
||||||
(var req) => syncResponse,
|
(var req) => syncResponse,
|
||||||
'/client/r0/register/available?username=testuser': (var req) =>
|
'/client/v3/register/available?username=testuser': (var req) =>
|
||||||
{'available': true},
|
{'available': true},
|
||||||
'/client/r0/user/${Uri.encodeComponent('alice@example.com')}/filter/1234':
|
'/client/v3/user/${Uri.encodeComponent('alice@example.com')}/filter/1234':
|
||||||
(var req) => {
|
(var req) => {
|
||||||
'room': {
|
'room': {
|
||||||
'state': {
|
'state': {
|
||||||
|
|
@ -1566,7 +1565,7 @@ class FakeMatrixApi extends MockClient {
|
||||||
'event_format': 'client',
|
'event_format': 'client',
|
||||||
'event_fields': ['type', 'content', 'sender']
|
'event_fields': ['type', 'content', 'sender']
|
||||||
},
|
},
|
||||||
'/client/unstable/room_keys/version': (var req) => {
|
'/client/v3/room_keys/version': (var req) => {
|
||||||
'algorithm': AlgorithmTypes.megolmBackupV1Curve25519AesSha2,
|
'algorithm': AlgorithmTypes.megolmBackupV1Curve25519AesSha2,
|
||||||
'auth_data': {
|
'auth_data': {
|
||||||
'public_key': 'GXYaxqhNhUK28zUdxOmEsFRguz+PzBsDlTLlF0O0RkM',
|
'public_key': 'GXYaxqhNhUK28zUdxOmEsFRguz+PzBsDlTLlF0O0RkM',
|
||||||
|
|
@ -1576,7 +1575,7 @@ class FakeMatrixApi extends MockClient {
|
||||||
'etag': '0',
|
'etag': '0',
|
||||||
'version': '5',
|
'version': '5',
|
||||||
},
|
},
|
||||||
'/client/unstable/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}/${Uri.encodeComponent('ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU')}?version=5':
|
'/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}/${Uri.encodeComponent('ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU')}?version=5':
|
||||||
(var req) => {
|
(var req) => {
|
||||||
'first_message_index': 0,
|
'first_message_index': 0,
|
||||||
'forwarded_count': 0,
|
'forwarded_count': 0,
|
||||||
|
|
@ -1588,7 +1587,7 @@ class FakeMatrixApi extends MockClient {
|
||||||
'mac': 'QzKV/fgAs4U',
|
'mac': 'QzKV/fgAs4U',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'/client/unstable/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}?version=5':
|
'/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}?version=5':
|
||||||
(var req) => {
|
(var req) => {
|
||||||
'sessions': {
|
'sessions': {
|
||||||
'ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU': {
|
'ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU': {
|
||||||
|
|
@ -1605,7 +1604,7 @@ class FakeMatrixApi extends MockClient {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'/client/unstable/room_keys/keys?version=5': (var req) => {
|
'/client/v3/room_keys/keys?version=5': (var req) => {
|
||||||
'rooms': {
|
'rooms': {
|
||||||
'!726s6s6q:example.com': {
|
'!726s6s6q:example.com': {
|
||||||
'sessions': {
|
'sessions': {
|
||||||
|
|
@ -1627,16 +1626,16 @@ class FakeMatrixApi extends MockClient {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'POST': {
|
'POST': {
|
||||||
'/client/r0/delete_devices': (var req) => {},
|
'/client/v3/delete_devices': (var req) => {},
|
||||||
'/client/r0/account/3pid/add': (var req) => {},
|
'/client/v3/account/3pid/add': (var req) => {},
|
||||||
'/client/r0/account/3pid/bind': (var req) => {},
|
'/client/v3/account/3pid/bind': (var req) => {},
|
||||||
'/client/r0/account/3pid/delete': (var req) =>
|
'/client/v3/account/3pid/delete': (var req) =>
|
||||||
{'id_server_unbind_result': 'success'},
|
{'id_server_unbind_result': 'success'},
|
||||||
'/client/r0/account/3pid/unbind': (var req) =>
|
'/client/v3/account/3pid/unbind': (var req) =>
|
||||||
{'id_server_unbind_result': 'success'},
|
{'id_server_unbind_result': 'success'},
|
||||||
'/client/r0/account/password': (var req) => {},
|
'/client/v3/account/password': (var req) => {},
|
||||||
'/client/r0/rooms/1234/report/1234': (var req) => {},
|
'/client/v3/rooms/1234/report/1234': (var req) => {},
|
||||||
'/client/r0/search': (var req) => {
|
'/client/v3/search': (var req) => {
|
||||||
'search_categories': {
|
'search_categories': {
|
||||||
'room_events': {
|
'room_events': {
|
||||||
'groups': {
|
'groups': {
|
||||||
|
|
@ -1674,9 +1673,9 @@ class FakeMatrixApi extends MockClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'/client/r0/account/deactivate': (var req) =>
|
'/client/v3/account/deactivate': (var req) =>
|
||||||
{'id_server_unbind_result': 'success'},
|
{'id_server_unbind_result': 'success'},
|
||||||
'/client/r0/user_directory/search': (var req) => {
|
'/client/v3/user_directory/search': (var req) => {
|
||||||
'results': [
|
'results': [
|
||||||
{
|
{
|
||||||
'user_id': '@foo:bar.com',
|
'user_id': '@foo:bar.com',
|
||||||
|
|
@ -1686,39 +1685,38 @@ class FakeMatrixApi extends MockClient {
|
||||||
],
|
],
|
||||||
'limited': false
|
'limited': false
|
||||||
},
|
},
|
||||||
'/client/r0/register/email/requestToken': (var req) => {
|
'/client/v3/register/email/requestToken': (var req) => {
|
||||||
'sid': '123abc',
|
'sid': '123abc',
|
||||||
'submit_url': 'https://example.org/path/to/submitToken'
|
'submit_url': 'https://example.org/path/to/submitToken'
|
||||||
},
|
},
|
||||||
'/client/r0/register/msisdn/requestToken': (var req) => {
|
'/client/v3/register/msisdn/requestToken': (var req) => {
|
||||||
'sid': '123abc',
|
'sid': '123abc',
|
||||||
'submit_url': 'https://example.org/path/to/submitToken'
|
'submit_url': 'https://example.org/path/to/submitToken'
|
||||||
},
|
},
|
||||||
'/client/r0/account/password/email/requestToken': (var req) => {
|
'/client/v3/account/password/email/requestToken': (var req) => {
|
||||||
'sid': '123abc',
|
'sid': '123abc',
|
||||||
'submit_url': 'https://example.org/path/to/submitToken'
|
'submit_url': 'https://example.org/path/to/submitToken'
|
||||||
},
|
},
|
||||||
'/client/r0/account/password/msisdn/requestToken': (var req) => {
|
'/client/v3/account/password/msisdn/requestToken': (var req) => {
|
||||||
'sid': '123abc',
|
'sid': '123abc',
|
||||||
'submit_url': 'https://example.org/path/to/submitToken'
|
'submit_url': 'https://example.org/path/to/submitToken'
|
||||||
},
|
},
|
||||||
'/client/r0/account/3pid/email/requestToken': (var req) => {
|
'/client/v3/account/3pid/email/requestToken': (var req) => {
|
||||||
'sid': '123abc',
|
'sid': '123abc',
|
||||||
'submit_url': 'https://example.org/path/to/submitToken'
|
'submit_url': 'https://example.org/path/to/submitToken'
|
||||||
},
|
},
|
||||||
'/client/r0/account/3pid/msisdn/requestToken': (var req) => {
|
'/client/v3/account/3pid/msisdn/requestToken': (var req) => {
|
||||||
'sid': '123abc',
|
'sid': '123abc',
|
||||||
'submit_url': 'https://example.org/path/to/submitToken'
|
'submit_url': 'https://example.org/path/to/submitToken'
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!localpart%3Aexample.com/receipt/m.read/%241234%3Aexample.com':
|
'/client/v3/rooms/!localpart%3Aexample.com/receipt/m.read/%241234%3Aexample.com':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aexample.com/read_markers': (var req) => {},
|
'/client/v3/rooms/!localpart%3Aexample.com/read_markers': (var req) => {},
|
||||||
'/client/r0/user/${Uri.encodeComponent('alice@example.com')}/filter':
|
'/client/v3/user/${Uri.encodeComponent('alice@example.com')}/filter':
|
||||||
(var req) => {'filter_id': '1234'},
|
(var req) => {'filter_id': '1234'},
|
||||||
'/client/r0/publicRooms?server=example.com': (var req) => {
|
'/client/v3/publicRooms?server=example.com': (var req) => {
|
||||||
'chunk': [
|
'chunk': [
|
||||||
{
|
{
|
||||||
'aliases': ['#murrays:cheese.bar'],
|
|
||||||
'canonical_alias': '#murrays:cheese.bar',
|
'canonical_alias': '#murrays:cheese.bar',
|
||||||
'avatar_url': 'mxc://bleeker.street/CHEDDARandBRIE',
|
'avatar_url': 'mxc://bleeker.street/CHEDDARandBRIE',
|
||||||
'guest_can_join': false,
|
'guest_can_join': false,
|
||||||
|
|
@ -1733,7 +1731,7 @@ class FakeMatrixApi extends MockClient {
|
||||||
'prev_batch': 'p1902',
|
'prev_batch': 'p1902',
|
||||||
'total_room_count_estimate': 115
|
'total_room_count_estimate': 115
|
||||||
},
|
},
|
||||||
'/client/r0/keys/claim': (var req) => {
|
'/client/v3/keys/claim': (var req) => {
|
||||||
'failures': {},
|
'failures': {},
|
||||||
'one_time_keys': {
|
'one_time_keys': {
|
||||||
if (decodeJson(req)['one_time_keys']['@alice:example.com'] !=
|
if (decodeJson(req)['one_time_keys']['@alice:example.com'] !=
|
||||||
|
|
@ -1769,25 +1767,25 @@ class FakeMatrixApi extends MockClient {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!localpart%3Aexample.com/invite': (var req) => {},
|
'/client/v3/rooms/!localpart%3Aexample.com/invite': (var req) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aexample.com/leave': (var req) => {},
|
'/client/v3/rooms/!localpart%3Aexample.com/leave': (var req) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aexample.com/forget': (var req) => {},
|
'/client/v3/rooms/!localpart%3Aexample.com/forget': (var req) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/kick': (var req) => {},
|
'/client/v3/rooms/!localpart%3Aserver.abc/kick': (var req) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aexample.com/kick': (var req) => {},
|
'/client/v3/rooms/!localpart%3Aexample.com/kick': (var req) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aexample.com/ban': (var req) => {},
|
'/client/v3/rooms/!localpart%3Aexample.com/ban': (var req) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aexample.com/unban': (var req) => {},
|
'/client/v3/rooms/!localpart%3Aexample.com/unban': (var req) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aexample.com/join': (var req) =>
|
'/client/v3/rooms/!localpart%3Aexample.com/join': (var req) =>
|
||||||
{'room_id': '!localpart:example.com'},
|
{'room_id': '!localpart:example.com'},
|
||||||
'/client/r0/join/!localpart%3Aexample.com?server_name=example.com&server_name=example.abc':
|
'/client/v3/join/!localpart%3Aexample.com?server_name=example.com&server_name=example.abc':
|
||||||
(var req) => {'room_id': '!localpart:example.com'},
|
(var req) => {'room_id': '!localpart:example.com'},
|
||||||
'/client/r0/keys/upload': (var req) => {
|
'/client/v3/keys/upload': (var req) => {
|
||||||
'one_time_key_counts': {
|
'one_time_key_counts': {
|
||||||
'curve25519': 10,
|
'curve25519': 10,
|
||||||
'signed_curve25519':
|
'signed_curve25519':
|
||||||
decodeJson(req)['one_time_keys']?.keys?.length ?? 0,
|
decodeJson(req)['one_time_keys']?.keys?.length ?? 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'/client/r0/keys/query': (var req) => {
|
'/client/v3/keys/query': (var req) => {
|
||||||
'failures': {},
|
'failures': {},
|
||||||
'device_keys': {
|
'device_keys': {
|
||||||
'@alice:example.com': {
|
'@alice:example.com': {
|
||||||
|
|
@ -1970,32 +1968,32 @@ class FakeMatrixApi extends MockClient {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'/client/r0/register': (var req) => {
|
'/client/v3/register': (var req) => {
|
||||||
'user_id': '@testuser:example.com',
|
'user_id': '@testuser:example.com',
|
||||||
'access_token': '1234',
|
'access_token': '1234',
|
||||||
'device_id': 'ABCD',
|
'device_id': 'ABCD',
|
||||||
},
|
},
|
||||||
'/client/r0/register?kind=user': (var req) =>
|
'/client/v3/register?kind=user': (var req) =>
|
||||||
{'user_id': '@testuser:example.com'},
|
{'user_id': '@testuser:example.com'},
|
||||||
'/client/r0/register?kind=guest': (var req) =>
|
'/client/v3/register?kind=guest': (var req) =>
|
||||||
{'user_id': '@testuser:example.com'},
|
{'user_id': '@testuser:example.com'},
|
||||||
'/client/r0/rooms/1234/upgrade': (var req) => {
|
'/client/v3/rooms/1234/upgrade': (var req) => {
|
||||||
'replacement_room': '!1234:fakeServer.notExisting',
|
'replacement_room': '!1234:fakeServer.notExisting',
|
||||||
},
|
},
|
||||||
'/client/r0/user/1234/openid/request_token': (var req) => {
|
'/client/v3/user/1234/openid/request_token': (var req) => {
|
||||||
'access_token': 'SomeT0kenHere',
|
'access_token': 'SomeT0kenHere',
|
||||||
'token_type': 'Bearer',
|
'token_type': 'Bearer',
|
||||||
'matrix_server_name': 'example.com',
|
'matrix_server_name': 'example.com',
|
||||||
'expires_in': 3600
|
'expires_in': 3600
|
||||||
},
|
},
|
||||||
'/client/r0/user/@test:fakeServer.notExisting/openid/request_token':
|
'/client/v3/user/@test:fakeServer.notExisting/openid/request_token':
|
||||||
(var req) => {
|
(var req) => {
|
||||||
'access_token': 'SomeT0kenHere',
|
'access_token': 'SomeT0kenHere',
|
||||||
'token_type': 'Bearer',
|
'token_type': 'Bearer',
|
||||||
'matrix_server_name': 'example.com',
|
'matrix_server_name': 'example.com',
|
||||||
'expires_in': 3600
|
'expires_in': 3600
|
||||||
},
|
},
|
||||||
'/client/r0/login': (var req) => {
|
'/client/v3/login': (var req) => {
|
||||||
'user_id': '@test:fakeServer.notExisting',
|
'user_id': '@test:fakeServer.notExisting',
|
||||||
'access_token': 'abc123',
|
'access_token': 'abc123',
|
||||||
'device_id': 'GHTYAJCE',
|
'device_id': 'GHTYAJCE',
|
||||||
|
|
@ -2004,160 +2002,160 @@ class FakeMatrixApi extends MockClient {
|
||||||
'm.identity_server': {'base_url': 'https://id.example.org'}
|
'm.identity_server': {'base_url': 'https://id.example.org'}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'/media/r0/upload?filename=file.jpeg': (var req) =>
|
'/media/v3/upload?filename=file.jpeg': (var req) =>
|
||||||
{'content_uri': 'mxc://example.com/AQwafuaFswefuhsfAFAgsw'},
|
{'content_uri': 'mxc://example.com/AQwafuaFswefuhsfAFAgsw'},
|
||||||
'/client/r0/logout': (var reqI) => {},
|
'/client/v3/logout': (var reqI) => {},
|
||||||
'/client/r0/pushers/set': (var reqI) => {},
|
'/client/v3/pushers/set': (var reqI) => {},
|
||||||
'/client/r0/join/1234': (var reqI) => {'room_id': '1234'},
|
'/client/v3/join/1234': (var reqI) => {'room_id': '1234'},
|
||||||
'/client/r0/logout/all': (var reqI) => {},
|
'/client/v3/logout/all': (var reqI) => {},
|
||||||
'/client/r0/createRoom': (var reqI) => {
|
'/client/v3/createRoom': (var reqI) => {
|
||||||
'room_id': '!1234:fakeServer.notExisting',
|
'room_id': '!1234:fakeServer.notExisting',
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/read_markers': (var reqI) => {},
|
'/client/v3/rooms/!localpart%3Aserver.abc/read_markers': (var reqI) => {},
|
||||||
'/client/r0/rooms/!localpart:server.abc/kick': (var reqI) => {},
|
'/client/v3/rooms/!localpart:server.abc/kick': (var reqI) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/ban': (var reqI) => {},
|
'/client/v3/rooms/!localpart%3Aserver.abc/ban': (var reqI) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/unban': (var reqI) => {},
|
'/client/v3/rooms/!localpart%3Aserver.abc/unban': (var reqI) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/invite': (var reqI) => {},
|
'/client/v3/rooms/!localpart%3Aserver.abc/invite': (var reqI) => {},
|
||||||
'/client/unstable/keys/device_signing/upload': (var reqI) {
|
'/client/v3/keys/device_signing/upload': (var reqI) {
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
'/client/r0/keys/signatures/upload': (var reqI) => {'failures': {}},
|
'/client/v3/keys/signatures/upload': (var reqI) => {'failures': {}},
|
||||||
'/client/unstable/room_keys/version': (var reqI) => {'version': '5'},
|
'/client/v3/room_keys/version': (var reqI) => {'version': '5'},
|
||||||
},
|
},
|
||||||
'PUT': {
|
'PUT': {
|
||||||
'/client/r0/user/%40test%3AfakeServer.notExisting/account_data/m.ignored_user_list':
|
'/client/v3/user/%40test%3AfakeServer.notExisting/account_data/m.ignored_user_list':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/presence/${Uri.encodeComponent('@alice:example.com')}/status':
|
'/client/v3/presence/${Uri.encodeComponent('@alice:example.com')}/status':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/pushrules/global/content/nocake/enabled': (var req) => {},
|
'/client/v3/pushrules/global/content/nocake/enabled': (var req) => {},
|
||||||
'/client/r0/pushrules/global/content/nocake/actions': (var req) => {},
|
'/client/v3/pushrules/global/content/nocake/actions': (var req) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/state/m.room.history_visibility':
|
'/client/v3/rooms/!localpart%3Aserver.abc/state/m.room.history_visibility':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/state/m.room.join_rules':
|
'/client/v3/rooms/!localpart%3Aserver.abc/state/m.room.join_rules':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/state/m.room.guest_access':
|
'/client/v3/rooms/!localpart%3Aserver.abc/state/m.room.guest_access':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/send/m.call.invite/1234':
|
'/client/v3/rooms/!localpart%3Aserver.abc/send/m.call.invite/1234':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/send/m.call.answer/1234':
|
'/client/v3/rooms/!localpart%3Aserver.abc/send/m.call.answer/1234':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/send/m.call.candidates/1234':
|
'/client/v3/rooms/!localpart%3Aserver.abc/send/m.call.candidates/1234':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/send/m.call.hangup/1234':
|
'/client/v3/rooms/!localpart%3Aserver.abc/send/m.call.hangup/1234':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/rooms/!1234%3Aexample.com/redact/1143273582443PhrSn%3Aexample.org/1234':
|
'/client/v3/rooms/!1234%3Aexample.com/redact/1143273582443PhrSn%3Aexample.org/1234':
|
||||||
(var req) => {'event_id': '1234'},
|
(var req) => {'event_id': '1234'},
|
||||||
'/client/r0/pushrules/global/room/!localpart%3Aserver.abc': (var req) =>
|
'/client/v3/pushrules/global/room/!localpart%3Aserver.abc': (var req) =>
|
||||||
{},
|
{},
|
||||||
'/client/r0/pushrules/global/override/.m.rule.master/enabled':
|
'/client/v3/pushrules/global/override/.m.rule.master/enabled':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/pushrules/global/content/nocake?before=1&after=2':
|
'/client/v3/pushrules/global/content/nocake?before=1&after=2':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/devices/QBUAZIFURK': (var req) => {},
|
'/client/v3/devices/QBUAZIFURK': (var req) => {},
|
||||||
'/client/r0/directory/room/%23testalias%3Aexample.com': (var reqI) => {},
|
'/client/v3/directory/room/%23testalias%3Aexample.com': (var reqI) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/send/m.room.message/testtxid':
|
'/client/v3/rooms/!localpart%3Aserver.abc/send/m.room.message/testtxid':
|
||||||
(var reqI) => {
|
(var reqI) => {
|
||||||
'event_id': '\$event${FakeMatrixApi.eventCounter++}',
|
'event_id': '\$event${FakeMatrixApi.eventCounter++}',
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/send/m.reaction/testtxid':
|
'/client/v3/rooms/!localpart%3Aserver.abc/send/m.reaction/testtxid':
|
||||||
(var reqI) => {
|
(var reqI) => {
|
||||||
'event_id': '\$event${FakeMatrixApi.eventCounter++}',
|
'event_id': '\$event${FakeMatrixApi.eventCounter++}',
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!localpart%3Aexample.com/typing/%40alice%3Aexample.com':
|
'/client/v3/rooms/!localpart%3Aexample.com/typing/%40alice%3Aexample.com':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/rooms/!1234%3Aexample.com/send/m.room.message/1234':
|
'/client/v3/rooms/!1234%3Aexample.com/send/m.room.message/1234':
|
||||||
(var reqI) => {
|
(var reqI) => {
|
||||||
'event_id': '\$event${FakeMatrixApi.eventCounter++}',
|
'event_id': '\$event${FakeMatrixApi.eventCounter++}',
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!1234%3Aexample.com/send/m.room.message/newresend':
|
'/client/v3/rooms/!1234%3Aexample.com/send/m.room.message/newresend':
|
||||||
(var reqI) => {
|
(var reqI) => {
|
||||||
'event_id': '\$event${FakeMatrixApi.eventCounter++}',
|
'event_id': '\$event${FakeMatrixApi.eventCounter++}',
|
||||||
},
|
},
|
||||||
'/client/r0/user/%40test%3AfakeServer.notExisting/rooms/!localpart%3Aserver.abc/tags/m.favourite':
|
'/client/v3/user/%40test%3AfakeServer.notExisting/rooms/!localpart%3Aserver.abc/tags/m.favourite':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/user/%40alice%3Aexample.com/rooms/!localpart%3Aexample.com/tags/testtag':
|
'/client/v3/user/%40alice%3Aexample.com/rooms/!localpart%3Aexample.com/tags/testtag':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/user/%40alice%3Aexample.com/account_data/test.account.data':
|
'/client/v3/user/%40alice%3Aexample.com/account_data/test.account.data':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/user/%40test%3AfakeServer.notExisting/account_data/best%20animal':
|
'/client/v3/user/%40test%3AfakeServer.notExisting/account_data/best%20animal':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/user/%40alice%3Aexample.com/rooms/1234/account_data/test.account.data':
|
'/client/v3/user/%40alice%3Aexample.com/rooms/1234/account_data/test.account.data':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/user/%40test%3AfakeServer.notExisting/rooms/!localpart%3Aserver.abc/account_data/com.famedly.marked_unread':
|
'/client/v3/user/%40test%3AfakeServer.notExisting/rooms/!localpart%3Aserver.abc/account_data/com.famedly.marked_unread':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/user/%40test%3AfakeServer.notExisting/account_data/m.direct':
|
'/client/v3/user/%40test%3AfakeServer.notExisting/account_data/m.direct':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/user/%40othertest%3AfakeServer.notExisting/account_data/m.direct':
|
'/client/v3/user/%40othertest%3AfakeServer.notExisting/account_data/m.direct':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/profile/%40alice%3Aexample.com/displayname': (var reqI) => {},
|
'/client/v3/profile/%40alice%3Aexample.com/displayname': (var reqI) => {},
|
||||||
'/client/r0/profile/%40alice%3Aexample.com/avatar_url': (var reqI) => {},
|
'/client/v3/profile/%40alice%3Aexample.com/avatar_url': (var reqI) => {},
|
||||||
'/client/r0/profile/%40test%3AfakeServer.notExisting/avatar_url':
|
'/client/v3/profile/%40test%3AfakeServer.notExisting/avatar_url':
|
||||||
(var reqI) => {},
|
(var reqI) => {},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/state/m.room.encryption':
|
'/client/v3/rooms/!localpart%3Aserver.abc/state/m.room.encryption':
|
||||||
(var reqI) => {'event_id': 'YUwRidLecu:example.com'},
|
(var reqI) => {'event_id': 'YUwRidLecu:example.com'},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/state/m.room.avatar':
|
'/client/v3/rooms/!localpart%3Aserver.abc/state/m.room.avatar':
|
||||||
(var reqI) => {'event_id': 'YUwRidLecu:example.com'},
|
(var reqI) => {'event_id': 'YUwRidLecu:example.com'},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/send/m.room.message/1234':
|
'/client/v3/rooms/!localpart%3Aserver.abc/send/m.room.message/1234':
|
||||||
(var reqI) => {'event_id': 'YUwRidLecu:example.com'},
|
(var reqI) => {'event_id': 'YUwRidLecu:example.com'},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/redact/1234/1234': (var reqI) =>
|
'/client/v3/rooms/!localpart%3Aserver.abc/redact/1234/1234': (var reqI) =>
|
||||||
{'event_id': 'YUwRidLecu:example.com'},
|
{'event_id': 'YUwRidLecu:example.com'},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/state/m.room.name':
|
'/client/v3/rooms/!localpart%3Aserver.abc/state/m.room.name':
|
||||||
(var reqI) => {
|
(var reqI) => {
|
||||||
'event_id': '42',
|
'event_id': '42',
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/state/m.room.topic':
|
'/client/v3/rooms/!localpart%3Aserver.abc/state/m.room.topic':
|
||||||
(var reqI) => {
|
(var reqI) => {
|
||||||
'event_id': '42',
|
'event_id': '42',
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/state/m.room.pinned_events':
|
'/client/v3/rooms/!localpart%3Aserver.abc/state/m.room.pinned_events':
|
||||||
(var reqI) => {
|
(var reqI) => {
|
||||||
'event_id': '42',
|
'event_id': '42',
|
||||||
},
|
},
|
||||||
'/client/r0/rooms/!localpart%3Aserver.abc/state/m.room.power_levels':
|
'/client/v3/rooms/!localpart%3Aserver.abc/state/m.room.power_levels':
|
||||||
(var reqI) => {
|
(var reqI) => {
|
||||||
'event_id': '42',
|
'event_id': '42',
|
||||||
},
|
},
|
||||||
'/client/r0/directory/list/room/!localpart%3Aexample.com': (var req) =>
|
'/client/v3/directory/list/room/!localpart%3Aexample.com': (var req) =>
|
||||||
{},
|
{},
|
||||||
'/client/unstable/room_keys/version/5': (var req) => {},
|
'/client/v3/room_keys/version/5': (var req) => {},
|
||||||
'/client/unstable/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}/${Uri.encodeComponent('ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU')}?version=5':
|
'/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}/${Uri.encodeComponent('ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU')}?version=5':
|
||||||
(var req) => {
|
(var req) => {
|
||||||
'etag': 'asdf',
|
'etag': 'asdf',
|
||||||
'count': 1,
|
'count': 1,
|
||||||
},
|
},
|
||||||
'/client/unstable/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}?version=5':
|
'/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}?version=5':
|
||||||
(var req) => {
|
(var req) => {
|
||||||
'etag': 'asdf',
|
'etag': 'asdf',
|
||||||
'count': 1,
|
'count': 1,
|
||||||
},
|
},
|
||||||
'/client/unstable/room_keys/keys?version=5': (var req) => {
|
'/client/v3/room_keys/keys?version=5': (var req) => {
|
||||||
'etag': 'asdf',
|
'etag': 'asdf',
|
||||||
'count': 1,
|
'count': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'DELETE': {
|
'DELETE': {
|
||||||
'/unknown/token': (var req) => {'errcode': 'M_UNKNOWN_TOKEN'},
|
'/unknown/token': (var req) => {'errcode': 'M_UNKNOWN_TOKEN'},
|
||||||
'/client/r0/devices/QBUAZIFURK': (var req) => {},
|
'/client/v3/devices/QBUAZIFURK': (var req) => {},
|
||||||
'/client/r0/directory/room/%23testalias%3Aexample.com': (var reqI) => {},
|
'/client/v3/directory/room/%23testalias%3Aexample.com': (var reqI) => {},
|
||||||
'/client/r0/pushrules/global/content/nocake': (var req) => {},
|
'/client/v3/pushrules/global/content/nocake': (var req) => {},
|
||||||
'/client/r0/pushrules/global/override/!localpart%3Aserver.abc':
|
'/client/v3/pushrules/global/override/!localpart%3Aserver.abc':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/user/%40test%3AfakeServer.notExisting/rooms/!localpart%3Aserver.abc/tags/m.favourite':
|
'/client/v3/user/%40test%3AfakeServer.notExisting/rooms/!localpart%3Aserver.abc/tags/m.favourite':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/r0/user/%40alice%3Aexample.com/rooms/!localpart%3Aexample.com/tags/testtag':
|
'/client/v3/user/%40alice%3Aexample.com/rooms/!localpart%3Aexample.com/tags/testtag':
|
||||||
(var req) => {},
|
(var req) => {},
|
||||||
'/client/unstable/room_keys/version/5': (var req) => {},
|
'/client/v3/room_keys/version/5': (var req) => {},
|
||||||
'/client/unstable/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}/${Uri.encodeComponent('ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU')}?version=5':
|
'/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}/${Uri.encodeComponent('ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU')}?version=5':
|
||||||
(var req) => {
|
(var req) => {
|
||||||
'etag': 'asdf',
|
'etag': 'asdf',
|
||||||
'count': 1,
|
'count': 1,
|
||||||
},
|
},
|
||||||
'/client/unstable/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}?version=5':
|
'/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}?version=5':
|
||||||
(var req) => {
|
(var req) => {
|
||||||
'etag': 'asdf',
|
'etag': 'asdf',
|
||||||
'count': 1,
|
'count': 1,
|
||||||
},
|
},
|
||||||
'/client/unstable/room_keys/keys?version=5': (var req) => {
|
'/client/v3/room_keys/keys?version=5': (var req) => {
|
||||||
'etag': 'asdf',
|
'etag': 'asdf',
|
||||||
'count': 1,
|
'count': 1,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -6,6 +6,8 @@ import '../model/sync_update.dart';
|
||||||
import '../model/matrix_event.dart';
|
import '../model/matrix_event.dart';
|
||||||
|
|
||||||
import 'internal.dart';
|
import 'internal.dart';
|
||||||
|
import 'package:enhanced_enum/enhanced_enum.dart';
|
||||||
|
part 'model.g.dart';
|
||||||
|
|
||||||
class _NameSource {
|
class _NameSource {
|
||||||
final String source;
|
final String source;
|
||||||
|
|
@ -82,8 +84,238 @@ class DiscoveryInformation {
|
||||||
Map<String, Map<String, dynamic>> additionalProperties;
|
Map<String, Map<String, dynamic>> additionalProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@_NameSource('spec')
|
||||||
|
class PublicRoomsChunk {
|
||||||
|
PublicRoomsChunk({
|
||||||
|
this.avatarUrl,
|
||||||
|
this.canonicalAlias,
|
||||||
|
required this.guestCanJoin,
|
||||||
|
this.joinRule,
|
||||||
|
this.name,
|
||||||
|
required this.numJoinedMembers,
|
||||||
|
required this.roomId,
|
||||||
|
this.topic,
|
||||||
|
required this.worldReadable,
|
||||||
|
});
|
||||||
|
|
||||||
|
PublicRoomsChunk.fromJson(Map<String, dynamic> json)
|
||||||
|
: avatarUrl =
|
||||||
|
((v) => v != null ? Uri.parse(v) : null)(json['avatar_url']),
|
||||||
|
canonicalAlias =
|
||||||
|
((v) => v != null ? v as String : null)(json['canonical_alias']),
|
||||||
|
guestCanJoin = json['guest_can_join'] as bool,
|
||||||
|
joinRule = ((v) => v != null ? v as String : null)(json['join_rule']),
|
||||||
|
name = ((v) => v != null ? v as String : null)(json['name']),
|
||||||
|
numJoinedMembers = json['num_joined_members'] as int,
|
||||||
|
roomId = json['room_id'] as String,
|
||||||
|
topic = ((v) => v != null ? v as String : null)(json['topic']),
|
||||||
|
worldReadable = json['world_readable'] as bool;
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final avatarUrl = this.avatarUrl;
|
||||||
|
final canonicalAlias = this.canonicalAlias;
|
||||||
|
final joinRule = this.joinRule;
|
||||||
|
final name = this.name;
|
||||||
|
final topic = this.topic;
|
||||||
|
return {
|
||||||
|
if (avatarUrl != null) 'avatar_url': avatarUrl.toString(),
|
||||||
|
if (canonicalAlias != null) 'canonical_alias': canonicalAlias,
|
||||||
|
'guest_can_join': guestCanJoin,
|
||||||
|
if (joinRule != null) 'join_rule': joinRule,
|
||||||
|
if (name != null) 'name': name,
|
||||||
|
'num_joined_members': numJoinedMembers,
|
||||||
|
'room_id': roomId,
|
||||||
|
if (topic != null) 'topic': topic,
|
||||||
|
'world_readable': worldReadable,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The URL for the room's avatar, if one is set.
|
||||||
|
Uri? avatarUrl;
|
||||||
|
|
||||||
|
/// The canonical alias of the room, if any.
|
||||||
|
String? canonicalAlias;
|
||||||
|
|
||||||
|
/// Whether guest users may join the room and participate in it.
|
||||||
|
/// If they can, they will be subject to ordinary power level
|
||||||
|
/// rules like any other user.
|
||||||
|
bool guestCanJoin;
|
||||||
|
|
||||||
|
/// The room's join rule. When not present, the room is assumed to
|
||||||
|
/// be `public`.
|
||||||
|
String? joinRule;
|
||||||
|
|
||||||
|
/// The name of the room, if any.
|
||||||
|
String? name;
|
||||||
|
|
||||||
|
/// The number of members joined to the room.
|
||||||
|
int numJoinedMembers;
|
||||||
|
|
||||||
|
/// The ID of the room.
|
||||||
|
String roomId;
|
||||||
|
|
||||||
|
/// The topic of the room, if any.
|
||||||
|
String? topic;
|
||||||
|
|
||||||
|
/// Whether the room may be viewed by guest users without joining.
|
||||||
|
bool worldReadable;
|
||||||
|
}
|
||||||
|
|
||||||
@_NameSource('rule override generated')
|
@_NameSource('rule override generated')
|
||||||
enum ThirdPartyIdentifierMedium { email, msisdn }
|
class SpaceRoomsChunkBase {
|
||||||
|
SpaceRoomsChunkBase({
|
||||||
|
required this.childrenState,
|
||||||
|
required this.roomType,
|
||||||
|
});
|
||||||
|
|
||||||
|
SpaceRoomsChunkBase.fromJson(Map<String, dynamic> json)
|
||||||
|
: childrenState = (json['children_state'] as List)
|
||||||
|
.map((v) => MatrixEvent.fromJson(v))
|
||||||
|
.toList(),
|
||||||
|
roomType = json['room_type'] as String;
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
'children_state': childrenState.map((v) => v.toJson()).toList(),
|
||||||
|
'room_type': roomType,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// The [`m.space.child`](#mspacechild) events of the space-room, represented
|
||||||
|
/// as [Stripped State Events](#stripped-state) with an added `origin_server_ts` key.
|
||||||
|
///
|
||||||
|
/// If the room is not a space-room, this should be empty.
|
||||||
|
List<MatrixEvent> childrenState;
|
||||||
|
|
||||||
|
/// The `type` of room (from [`m.room.create`](https://spec.matrix.org/unstable/client-server-api/#mroomcreate)), if any.
|
||||||
|
String roomType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@_NameSource('rule override generated')
|
||||||
|
class SpaceRoomsChunk implements PublicRoomsChunk, SpaceRoomsChunkBase {
|
||||||
|
SpaceRoomsChunk({
|
||||||
|
this.avatarUrl,
|
||||||
|
this.canonicalAlias,
|
||||||
|
required this.guestCanJoin,
|
||||||
|
this.joinRule,
|
||||||
|
this.name,
|
||||||
|
required this.numJoinedMembers,
|
||||||
|
required this.roomId,
|
||||||
|
this.topic,
|
||||||
|
required this.worldReadable,
|
||||||
|
required this.childrenState,
|
||||||
|
required this.roomType,
|
||||||
|
});
|
||||||
|
|
||||||
|
SpaceRoomsChunk.fromJson(Map<String, dynamic> json)
|
||||||
|
: avatarUrl =
|
||||||
|
((v) => v != null ? Uri.parse(v) : null)(json['avatar_url']),
|
||||||
|
canonicalAlias =
|
||||||
|
((v) => v != null ? v as String : null)(json['canonical_alias']),
|
||||||
|
guestCanJoin = json['guest_can_join'] as bool,
|
||||||
|
joinRule = ((v) => v != null ? v as String : null)(json['join_rule']),
|
||||||
|
name = ((v) => v != null ? v as String : null)(json['name']),
|
||||||
|
numJoinedMembers = json['num_joined_members'] as int,
|
||||||
|
roomId = json['room_id'] as String,
|
||||||
|
topic = ((v) => v != null ? v as String : null)(json['topic']),
|
||||||
|
worldReadable = json['world_readable'] as bool,
|
||||||
|
childrenState = (json['children_state'] as List)
|
||||||
|
.map((v) => MatrixEvent.fromJson(v))
|
||||||
|
.toList(),
|
||||||
|
roomType = json['room_type'] as String;
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final avatarUrl = this.avatarUrl;
|
||||||
|
final canonicalAlias = this.canonicalAlias;
|
||||||
|
final joinRule = this.joinRule;
|
||||||
|
final name = this.name;
|
||||||
|
final topic = this.topic;
|
||||||
|
return {
|
||||||
|
if (avatarUrl != null) 'avatar_url': avatarUrl.toString(),
|
||||||
|
if (canonicalAlias != null) 'canonical_alias': canonicalAlias,
|
||||||
|
'guest_can_join': guestCanJoin,
|
||||||
|
if (joinRule != null) 'join_rule': joinRule,
|
||||||
|
if (name != null) 'name': name,
|
||||||
|
'num_joined_members': numJoinedMembers,
|
||||||
|
'room_id': roomId,
|
||||||
|
if (topic != null) 'topic': topic,
|
||||||
|
'world_readable': worldReadable,
|
||||||
|
'children_state': childrenState.map((v) => v.toJson()).toList(),
|
||||||
|
'room_type': roomType,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The URL for the room's avatar, if one is set.
|
||||||
|
Uri? avatarUrl;
|
||||||
|
|
||||||
|
/// The canonical alias of the room, if any.
|
||||||
|
String? canonicalAlias;
|
||||||
|
|
||||||
|
/// Whether guest users may join the room and participate in it.
|
||||||
|
/// If they can, they will be subject to ordinary power level
|
||||||
|
/// rules like any other user.
|
||||||
|
bool guestCanJoin;
|
||||||
|
|
||||||
|
/// The room's join rule. When not present, the room is assumed to
|
||||||
|
/// be `public`.
|
||||||
|
String? joinRule;
|
||||||
|
|
||||||
|
/// The name of the room, if any.
|
||||||
|
String? name;
|
||||||
|
|
||||||
|
/// The number of members joined to the room.
|
||||||
|
int numJoinedMembers;
|
||||||
|
|
||||||
|
/// The ID of the room.
|
||||||
|
String roomId;
|
||||||
|
|
||||||
|
/// The topic of the room, if any.
|
||||||
|
String? topic;
|
||||||
|
|
||||||
|
/// Whether the room may be viewed by guest users without joining.
|
||||||
|
bool worldReadable;
|
||||||
|
|
||||||
|
/// The [`m.space.child`](#mspacechild) events of the space-room, represented
|
||||||
|
/// as [Stripped State Events](#stripped-state) with an added `origin_server_ts` key.
|
||||||
|
///
|
||||||
|
/// If the room is not a space-room, this should be empty.
|
||||||
|
List<MatrixEvent> childrenState;
|
||||||
|
|
||||||
|
/// The `type` of room (from [`m.room.create`](https://spec.matrix.org/unstable/client-server-api/#mroomcreate)), if any.
|
||||||
|
String roomType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@_NameSource('generated')
|
||||||
|
class GetSpaceHierarchyResponse {
|
||||||
|
GetSpaceHierarchyResponse({
|
||||||
|
this.nextBatch,
|
||||||
|
required this.rooms,
|
||||||
|
});
|
||||||
|
|
||||||
|
GetSpaceHierarchyResponse.fromJson(Map<String, dynamic> json)
|
||||||
|
: nextBatch = ((v) => v != null ? v as String : null)(json['next_batch']),
|
||||||
|
rooms = (json['rooms'] as List)
|
||||||
|
.map((v) => SpaceRoomsChunk.fromJson(v))
|
||||||
|
.toList();
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final nextBatch = this.nextBatch;
|
||||||
|
return {
|
||||||
|
if (nextBatch != null) 'next_batch': nextBatch,
|
||||||
|
'rooms': rooms.map((v) => v.toJson()).toList(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A token to supply to `from` to keep paginating the responses. Not present when there are
|
||||||
|
/// no further results.
|
||||||
|
String? nextBatch;
|
||||||
|
|
||||||
|
/// The rooms for the current page, with the current filters.
|
||||||
|
List<SpaceRoomsChunk> rooms;
|
||||||
|
}
|
||||||
|
|
||||||
|
@_NameSource('rule override generated')
|
||||||
|
@EnhancedEnum()
|
||||||
|
enum ThirdPartyIdentifierMedium {
|
||||||
|
@EnhancedEnumValue(name: 'email')
|
||||||
|
email,
|
||||||
|
@EnhancedEnumValue(name: 'msisdn')
|
||||||
|
msisdn
|
||||||
|
}
|
||||||
|
|
||||||
@_NameSource('spec')
|
@_NameSource('spec')
|
||||||
class ThirdPartyIdentifier {
|
class ThirdPartyIdentifier {
|
||||||
|
|
@ -97,18 +329,12 @@ class ThirdPartyIdentifier {
|
||||||
ThirdPartyIdentifier.fromJson(Map<String, dynamic> json)
|
ThirdPartyIdentifier.fromJson(Map<String, dynamic> json)
|
||||||
: addedAt = json['added_at'] as int,
|
: addedAt = json['added_at'] as int,
|
||||||
address = json['address'] as String,
|
address = json['address'] as String,
|
||||||
medium = {
|
medium = ThirdPartyIdentifierMedium.values.fromString(json['medium'])!,
|
||||||
'email': ThirdPartyIdentifierMedium.email,
|
|
||||||
'msisdn': ThirdPartyIdentifierMedium.msisdn
|
|
||||||
}[json['medium']]!,
|
|
||||||
validatedAt = json['validated_at'] as int;
|
validatedAt = json['validated_at'] as int;
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
'added_at': addedAt,
|
'added_at': addedAt,
|
||||||
'address': address,
|
'address': address,
|
||||||
'medium': {
|
'medium': medium.name,
|
||||||
ThirdPartyIdentifierMedium.email: 'email',
|
|
||||||
ThirdPartyIdentifierMedium.msisdn: 'msisdn'
|
|
||||||
}[medium]!,
|
|
||||||
'validated_at': validatedAt,
|
'validated_at': validatedAt,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -163,7 +389,13 @@ class ThreePidCredentials {
|
||||||
}
|
}
|
||||||
|
|
||||||
@_NameSource('generated')
|
@_NameSource('generated')
|
||||||
enum IdServerUnbindResult { noSupport, success }
|
@EnhancedEnum()
|
||||||
|
enum IdServerUnbindResult {
|
||||||
|
@EnhancedEnumValue(name: 'no-support')
|
||||||
|
noSupport,
|
||||||
|
@EnhancedEnumValue(name: 'success')
|
||||||
|
success
|
||||||
|
}
|
||||||
|
|
||||||
@_NameSource('spec')
|
@_NameSource('spec')
|
||||||
class RequestTokenResponse {
|
class RequestTokenResponse {
|
||||||
|
|
@ -206,16 +438,20 @@ class RequestTokenResponse {
|
||||||
class TokenOwnerInfo {
|
class TokenOwnerInfo {
|
||||||
TokenOwnerInfo({
|
TokenOwnerInfo({
|
||||||
this.deviceId,
|
this.deviceId,
|
||||||
|
this.isGuest,
|
||||||
required this.userId,
|
required this.userId,
|
||||||
});
|
});
|
||||||
|
|
||||||
TokenOwnerInfo.fromJson(Map<String, dynamic> json)
|
TokenOwnerInfo.fromJson(Map<String, dynamic> json)
|
||||||
: deviceId = ((v) => v != null ? v as String : null)(json['device_id']),
|
: deviceId = ((v) => v != null ? v as String : null)(json['device_id']),
|
||||||
|
isGuest = ((v) => v != null ? v as bool : null)(json['is_guest']),
|
||||||
userId = json['user_id'] as String;
|
userId = json['user_id'] as String;
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final deviceId = this.deviceId;
|
final deviceId = this.deviceId;
|
||||||
|
final isGuest = this.isGuest;
|
||||||
return {
|
return {
|
||||||
if (deviceId != null) 'device_id': deviceId,
|
if (deviceId != null) 'device_id': deviceId,
|
||||||
|
if (isGuest != null) 'is_guest': isGuest,
|
||||||
'user_id': userId,
|
'user_id': userId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -226,6 +462,11 @@ class TokenOwnerInfo {
|
||||||
/// Otherwise this is required.
|
/// Otherwise this is required.
|
||||||
String? deviceId;
|
String? deviceId;
|
||||||
|
|
||||||
|
/// When `true`, the user is a [Guest User](#guest-access). When
|
||||||
|
/// not present or `false`, the user is presumed to be a non-guest
|
||||||
|
/// user.
|
||||||
|
bool? isGuest;
|
||||||
|
|
||||||
/// The user ID that owns the access token.
|
/// The user ID that owns the access token.
|
||||||
String userId;
|
String userId;
|
||||||
}
|
}
|
||||||
|
|
@ -355,7 +596,13 @@ class ChangePasswordCapability {
|
||||||
|
|
||||||
/// The stability of the room version.
|
/// The stability of the room version.
|
||||||
@_NameSource('rule override generated')
|
@_NameSource('rule override generated')
|
||||||
enum RoomVersionAvailable { stable, unstable }
|
@EnhancedEnum()
|
||||||
|
enum RoomVersionAvailable {
|
||||||
|
@EnhancedEnumValue(name: 'stable')
|
||||||
|
stable,
|
||||||
|
@EnhancedEnumValue(name: 'unstable')
|
||||||
|
unstable
|
||||||
|
}
|
||||||
|
|
||||||
@_NameSource('spec')
|
@_NameSource('spec')
|
||||||
class RoomVersionsCapability {
|
class RoomVersionsCapability {
|
||||||
|
|
@ -365,21 +612,11 @@ class RoomVersionsCapability {
|
||||||
});
|
});
|
||||||
|
|
||||||
RoomVersionsCapability.fromJson(Map<String, dynamic> json)
|
RoomVersionsCapability.fromJson(Map<String, dynamic> json)
|
||||||
: available = (json['available'] as Map<String, dynamic>).map((k, v) =>
|
: available = (json['available'] as Map<String, dynamic>).map(
|
||||||
MapEntry(
|
(k, v) => MapEntry(k, RoomVersionAvailable.values.fromString(v)!)),
|
||||||
k,
|
|
||||||
{
|
|
||||||
'stable': RoomVersionAvailable.stable,
|
|
||||||
'unstable': RoomVersionAvailable.unstable
|
|
||||||
}[v]!)),
|
|
||||||
default$ = json['default'] as String;
|
default$ = json['default'] as String;
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
'available': available.map((k, v) => MapEntry(
|
'available': available.map((k, v) => MapEntry(k, v.name)),
|
||||||
k,
|
|
||||||
{
|
|
||||||
RoomVersionAvailable.stable: 'stable',
|
|
||||||
RoomVersionAvailable.unstable: 'unstable'
|
|
||||||
}[v]!)),
|
|
||||||
'default': default$,
|
'default': default$,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -497,10 +734,24 @@ class Invite3pid {
|
||||||
}
|
}
|
||||||
|
|
||||||
@_NameSource('rule override generated')
|
@_NameSource('rule override generated')
|
||||||
enum CreateRoomPreset { privateChat, publicChat, trustedPrivateChat }
|
@EnhancedEnum()
|
||||||
|
enum CreateRoomPreset {
|
||||||
|
@EnhancedEnumValue(name: 'private_chat')
|
||||||
|
privateChat,
|
||||||
|
@EnhancedEnumValue(name: 'public_chat')
|
||||||
|
publicChat,
|
||||||
|
@EnhancedEnumValue(name: 'trusted_private_chat')
|
||||||
|
trustedPrivateChat
|
||||||
|
}
|
||||||
|
|
||||||
@_NameSource('generated')
|
@_NameSource('generated')
|
||||||
enum Visibility { private, public }
|
@EnhancedEnum()
|
||||||
|
enum Visibility {
|
||||||
|
@EnhancedEnumValue(name: 'private')
|
||||||
|
private,
|
||||||
|
@EnhancedEnumValue(name: 'public')
|
||||||
|
public
|
||||||
|
}
|
||||||
|
|
||||||
/// A client device
|
/// A client device
|
||||||
@_NameSource('spec')
|
@_NameSource('spec')
|
||||||
|
|
@ -576,15 +827,52 @@ class GetRoomIdByAliasResponse {
|
||||||
List<String>? servers;
|
List<String>? servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@_NameSource('rule override generated')
|
@_NameSource('generated')
|
||||||
class EventsSyncUpdate {
|
class GetEventsResponse {
|
||||||
EventsSyncUpdate({
|
GetEventsResponse({
|
||||||
this.chunk,
|
this.chunk,
|
||||||
this.end,
|
this.end,
|
||||||
this.start,
|
this.start,
|
||||||
});
|
});
|
||||||
|
|
||||||
EventsSyncUpdate.fromJson(Map<String, dynamic> json)
|
GetEventsResponse.fromJson(Map<String, dynamic> json)
|
||||||
|
: chunk = ((v) => v != null
|
||||||
|
? (v as List).map((v) => MatrixEvent.fromJson(v)).toList()
|
||||||
|
: null)(json['chunk']),
|
||||||
|
end = ((v) => v != null ? v as String : null)(json['end']),
|
||||||
|
start = ((v) => v != null ? v as String : null)(json['start']);
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final chunk = this.chunk;
|
||||||
|
final end = this.end;
|
||||||
|
final start = this.start;
|
||||||
|
return {
|
||||||
|
if (chunk != null) 'chunk': chunk.map((v) => v.toJson()).toList(),
|
||||||
|
if (end != null) 'end': end,
|
||||||
|
if (start != null) 'start': start,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// An array of events.
|
||||||
|
List<MatrixEvent>? chunk;
|
||||||
|
|
||||||
|
/// A token which correlates to the end of `chunk`. This
|
||||||
|
/// token should be used in the next request to `/events`.
|
||||||
|
String? end;
|
||||||
|
|
||||||
|
/// A token which correlates to the start of `chunk`. This
|
||||||
|
/// is usually the same token supplied to `from=`.
|
||||||
|
String? start;
|
||||||
|
}
|
||||||
|
|
||||||
|
@_NameSource('generated')
|
||||||
|
class PeekEventsResponse {
|
||||||
|
PeekEventsResponse({
|
||||||
|
this.chunk,
|
||||||
|
this.end,
|
||||||
|
this.start,
|
||||||
|
});
|
||||||
|
|
||||||
|
PeekEventsResponse.fromJson(Map<String, dynamic> json)
|
||||||
: chunk = ((v) => v != null
|
: chunk = ((v) => v != null
|
||||||
? (v as List).map((v) => MatrixEvent.fromJson(v)).toList()
|
? (v as List).map((v) => MatrixEvent.fromJson(v)).toList()
|
||||||
: null)(json['chunk']),
|
: null)(json['chunk']),
|
||||||
|
|
@ -727,6 +1015,9 @@ class ClaimKeysResponse {
|
||||||
///
|
///
|
||||||
/// See the [key algorithms](https://spec.matrix.org/unstable/client-server-api/#key-algorithms) section for information
|
/// See the [key algorithms](https://spec.matrix.org/unstable/client-server-api/#key-algorithms) section for information
|
||||||
/// on the Key Object format.
|
/// on the Key Object format.
|
||||||
|
///
|
||||||
|
/// If necessary, the claimed key might be a fallback key. Fallback
|
||||||
|
/// keys are re-used by the server until replaced by the device.
|
||||||
Map<String, Map<String, dynamic>> oneTimeKeys;
|
Map<String, Map<String, dynamic>> oneTimeKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -844,7 +1135,13 @@ class LoginFlow {
|
||||||
}
|
}
|
||||||
|
|
||||||
@_NameSource('rule override generated')
|
@_NameSource('rule override generated')
|
||||||
enum LoginType { mLoginPassword, mLoginToken }
|
@EnhancedEnum()
|
||||||
|
enum LoginType {
|
||||||
|
@EnhancedEnumValue(name: 'm.login.password')
|
||||||
|
mLoginPassword,
|
||||||
|
@EnhancedEnumValue(name: 'm.login.token')
|
||||||
|
mLoginToken
|
||||||
|
}
|
||||||
|
|
||||||
@_NameSource('generated')
|
@_NameSource('generated')
|
||||||
class LoginResponse {
|
class LoginResponse {
|
||||||
|
|
@ -990,7 +1287,15 @@ class GetNotificationsResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
@_NameSource('rule override generated')
|
@_NameSource('rule override generated')
|
||||||
enum PresenceType { offline, online, unavailable }
|
@EnhancedEnum()
|
||||||
|
enum PresenceType {
|
||||||
|
@EnhancedEnumValue(name: 'offline')
|
||||||
|
offline,
|
||||||
|
@EnhancedEnumValue(name: 'online')
|
||||||
|
online,
|
||||||
|
@EnhancedEnumValue(name: 'unavailable')
|
||||||
|
unavailable
|
||||||
|
}
|
||||||
|
|
||||||
@_NameSource('generated')
|
@_NameSource('generated')
|
||||||
class GetPresenceResponse {
|
class GetPresenceResponse {
|
||||||
|
|
@ -1006,11 +1311,7 @@ class GetPresenceResponse {
|
||||||
((v) => v != null ? v as bool : null)(json['currently_active']),
|
((v) => v != null ? v as bool : null)(json['currently_active']),
|
||||||
lastActiveAgo =
|
lastActiveAgo =
|
||||||
((v) => v != null ? v as int : null)(json['last_active_ago']),
|
((v) => v != null ? v as int : null)(json['last_active_ago']),
|
||||||
presence = {
|
presence = PresenceType.values.fromString(json['presence'])!,
|
||||||
'online': PresenceType.online,
|
|
||||||
'offline': PresenceType.offline,
|
|
||||||
'unavailable': PresenceType.unavailable
|
|
||||||
}[json['presence']]!,
|
|
||||||
statusMsg = ((v) => v != null ? v as String : null)(json['status_msg']);
|
statusMsg = ((v) => v != null ? v as String : null)(json['status_msg']);
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final currentlyActive = this.currentlyActive;
|
final currentlyActive = this.currentlyActive;
|
||||||
|
|
@ -1019,11 +1320,7 @@ class GetPresenceResponse {
|
||||||
return {
|
return {
|
||||||
if (currentlyActive != null) 'currently_active': currentlyActive,
|
if (currentlyActive != null) 'currently_active': currentlyActive,
|
||||||
if (lastActiveAgo != null) 'last_active_ago': lastActiveAgo,
|
if (lastActiveAgo != null) 'last_active_ago': lastActiveAgo,
|
||||||
'presence': {
|
'presence': presence.name,
|
||||||
PresenceType.online: 'online',
|
|
||||||
PresenceType.offline: 'offline',
|
|
||||||
PresenceType.unavailable: 'unavailable'
|
|
||||||
}[presence]!,
|
|
||||||
if (statusMsg != null) 'status_msg': statusMsg,
|
if (statusMsg != null) 'status_msg': statusMsg,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -1070,93 +1367,6 @@ class ProfileInformation {
|
||||||
String? displayname;
|
String? displayname;
|
||||||
}
|
}
|
||||||
|
|
||||||
@_NameSource('spec')
|
|
||||||
class PublicRoomsChunk {
|
|
||||||
PublicRoomsChunk({
|
|
||||||
this.aliases,
|
|
||||||
this.avatarUrl,
|
|
||||||
this.canonicalAlias,
|
|
||||||
required this.guestCanJoin,
|
|
||||||
this.joinRule,
|
|
||||||
this.name,
|
|
||||||
required this.numJoinedMembers,
|
|
||||||
required this.roomId,
|
|
||||||
this.topic,
|
|
||||||
required this.worldReadable,
|
|
||||||
});
|
|
||||||
|
|
||||||
PublicRoomsChunk.fromJson(Map<String, dynamic> json)
|
|
||||||
: aliases = ((v) => v != null
|
|
||||||
? (v as List).map((v) => v as String).toList()
|
|
||||||
: null)(json['aliases']),
|
|
||||||
avatarUrl =
|
|
||||||
((v) => v != null ? Uri.parse(v) : null)(json['avatar_url']),
|
|
||||||
canonicalAlias =
|
|
||||||
((v) => v != null ? v as String : null)(json['canonical_alias']),
|
|
||||||
guestCanJoin = json['guest_can_join'] as bool,
|
|
||||||
joinRule = ((v) => v != null ? v as String : null)(json['join_rule']),
|
|
||||||
name = ((v) => v != null ? v as String : null)(json['name']),
|
|
||||||
numJoinedMembers = json['num_joined_members'] as int,
|
|
||||||
roomId = json['room_id'] as String,
|
|
||||||
topic = ((v) => v != null ? v as String : null)(json['topic']),
|
|
||||||
worldReadable = json['world_readable'] as bool;
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
final aliases = this.aliases;
|
|
||||||
final avatarUrl = this.avatarUrl;
|
|
||||||
final canonicalAlias = this.canonicalAlias;
|
|
||||||
final joinRule = this.joinRule;
|
|
||||||
final name = this.name;
|
|
||||||
final topic = this.topic;
|
|
||||||
return {
|
|
||||||
if (aliases != null) 'aliases': aliases.map((v) => v).toList(),
|
|
||||||
if (avatarUrl != null) 'avatar_url': avatarUrl.toString(),
|
|
||||||
if (canonicalAlias != null) 'canonical_alias': canonicalAlias,
|
|
||||||
'guest_can_join': guestCanJoin,
|
|
||||||
if (joinRule != null) 'join_rule': joinRule,
|
|
||||||
if (name != null) 'name': name,
|
|
||||||
'num_joined_members': numJoinedMembers,
|
|
||||||
'room_id': roomId,
|
|
||||||
if (topic != null) 'topic': topic,
|
|
||||||
'world_readable': worldReadable,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Aliases of the room. May be empty.
|
|
||||||
List<String>? aliases;
|
|
||||||
|
|
||||||
/// The URL for the room's avatar, if one is set.
|
|
||||||
Uri? avatarUrl;
|
|
||||||
|
|
||||||
/// The canonical alias of the room, if any.
|
|
||||||
String? canonicalAlias;
|
|
||||||
|
|
||||||
/// Whether guest users may join the room and participate in it.
|
|
||||||
/// If they can, they will be subject to ordinary power level
|
|
||||||
/// rules like any other user.
|
|
||||||
bool guestCanJoin;
|
|
||||||
|
|
||||||
/// The room's join rule. When not present, the room is assumed to
|
|
||||||
/// be `public`. Note that rooms with `invite` join rules are not
|
|
||||||
/// expected here, but rooms with `knock` rules are given their
|
|
||||||
/// near-public nature.
|
|
||||||
String? joinRule;
|
|
||||||
|
|
||||||
/// The name of the room, if any.
|
|
||||||
String? name;
|
|
||||||
|
|
||||||
/// The number of members joined to the room.
|
|
||||||
int numJoinedMembers;
|
|
||||||
|
|
||||||
/// The ID of the room.
|
|
||||||
String roomId;
|
|
||||||
|
|
||||||
/// The topic of the room, if any.
|
|
||||||
String? topic;
|
|
||||||
|
|
||||||
/// Whether the room may be viewed by guest users without joining.
|
|
||||||
bool worldReadable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A list of the rooms on the server.
|
/// A list of the rooms on the server.
|
||||||
@_NameSource('generated')
|
@_NameSource('generated')
|
||||||
class GetPublicRoomsResponse {
|
class GetPublicRoomsResponse {
|
||||||
|
|
@ -1453,9 +1663,7 @@ class PushCondition {
|
||||||
String kind;
|
String kind;
|
||||||
|
|
||||||
/// Required for `event_match` conditions. The glob-style pattern to
|
/// Required for `event_match` conditions. The glob-style pattern to
|
||||||
/// match against. Patterns with no special glob characters should be
|
/// match against.
|
||||||
/// treated as having asterisks prepended and appended when testing the
|
|
||||||
/// condition.
|
|
||||||
String? pattern;
|
String? pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1570,10 +1778,28 @@ class PushRuleSet {
|
||||||
}
|
}
|
||||||
|
|
||||||
@_NameSource('rule override generated')
|
@_NameSource('rule override generated')
|
||||||
enum PushRuleKind { content, override, room, sender, underride }
|
@EnhancedEnum()
|
||||||
|
enum PushRuleKind {
|
||||||
|
@EnhancedEnumValue(name: 'content')
|
||||||
|
content,
|
||||||
|
@EnhancedEnumValue(name: 'override')
|
||||||
|
override,
|
||||||
|
@EnhancedEnumValue(name: 'room')
|
||||||
|
room,
|
||||||
|
@EnhancedEnumValue(name: 'sender')
|
||||||
|
sender,
|
||||||
|
@EnhancedEnumValue(name: 'underride')
|
||||||
|
underride
|
||||||
|
}
|
||||||
|
|
||||||
@_NameSource('rule override generated')
|
@_NameSource('rule override generated')
|
||||||
enum AccountKind { guest, user }
|
@EnhancedEnum()
|
||||||
|
enum AccountKind {
|
||||||
|
@EnhancedEnumValue(name: 'guest')
|
||||||
|
guest,
|
||||||
|
@EnhancedEnumValue(name: 'user')
|
||||||
|
user
|
||||||
|
}
|
||||||
|
|
||||||
@_NameSource('generated')
|
@_NameSource('generated')
|
||||||
class RegisterResponse {
|
class RegisterResponse {
|
||||||
|
|
@ -1725,7 +1951,11 @@ class RoomKeys {
|
||||||
}
|
}
|
||||||
|
|
||||||
@_NameSource('rule override generated')
|
@_NameSource('rule override generated')
|
||||||
enum BackupAlgorithm { mMegolmBackupV1Curve25519AesSha2 }
|
@EnhancedEnum()
|
||||||
|
enum BackupAlgorithm {
|
||||||
|
@EnhancedEnumValue(name: 'm.megolm_backup.v1.curve25519-aes-sha2')
|
||||||
|
mMegolmBackupV1Curve25519AesSha2
|
||||||
|
}
|
||||||
|
|
||||||
@_NameSource('generated')
|
@_NameSource('generated')
|
||||||
class GetRoomKeysVersionCurrentResponse {
|
class GetRoomKeysVersionCurrentResponse {
|
||||||
|
|
@ -1738,19 +1968,13 @@ class GetRoomKeysVersionCurrentResponse {
|
||||||
});
|
});
|
||||||
|
|
||||||
GetRoomKeysVersionCurrentResponse.fromJson(Map<String, dynamic> json)
|
GetRoomKeysVersionCurrentResponse.fromJson(Map<String, dynamic> json)
|
||||||
: algorithm = {
|
: algorithm = BackupAlgorithm.values.fromString(json['algorithm'])!,
|
||||||
'm.megolm_backup.v1.curve25519-aes-sha2':
|
|
||||||
BackupAlgorithm.mMegolmBackupV1Curve25519AesSha2
|
|
||||||
}[json['algorithm']]!,
|
|
||||||
authData = json['auth_data'] as Map<String, dynamic>,
|
authData = json['auth_data'] as Map<String, dynamic>,
|
||||||
count = json['count'] as int,
|
count = json['count'] as int,
|
||||||
etag = json['etag'] as String,
|
etag = json['etag'] as String,
|
||||||
version = json['version'] as String;
|
version = json['version'] as String;
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
'algorithm': {
|
'algorithm': algorithm.name,
|
||||||
BackupAlgorithm.mMegolmBackupV1Curve25519AesSha2:
|
|
||||||
'm.megolm_backup.v1.curve25519-aes-sha2'
|
|
||||||
}[algorithm]!,
|
|
||||||
'auth_data': authData,
|
'auth_data': authData,
|
||||||
'count': count,
|
'count': count,
|
||||||
'etag': etag,
|
'etag': etag,
|
||||||
|
|
@ -1789,19 +2013,13 @@ class GetRoomKeysVersionResponse {
|
||||||
});
|
});
|
||||||
|
|
||||||
GetRoomKeysVersionResponse.fromJson(Map<String, dynamic> json)
|
GetRoomKeysVersionResponse.fromJson(Map<String, dynamic> json)
|
||||||
: algorithm = {
|
: algorithm = BackupAlgorithm.values.fromString(json['algorithm'])!,
|
||||||
'm.megolm_backup.v1.curve25519-aes-sha2':
|
|
||||||
BackupAlgorithm.mMegolmBackupV1Curve25519AesSha2
|
|
||||||
}[json['algorithm']]!,
|
|
||||||
authData = json['auth_data'] as Map<String, dynamic>,
|
authData = json['auth_data'] as Map<String, dynamic>,
|
||||||
count = json['count'] as int,
|
count = json['count'] as int,
|
||||||
etag = json['etag'] as String,
|
etag = json['etag'] as String,
|
||||||
version = json['version'] as String;
|
version = json['version'] as String;
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
'algorithm': {
|
'algorithm': algorithm.name,
|
||||||
BackupAlgorithm.mMegolmBackupV1Curve25519AesSha2:
|
|
||||||
'm.megolm_backup.v1.curve25519-aes-sha2'
|
|
||||||
}[algorithm]!,
|
|
||||||
'auth_data': authData,
|
'auth_data': authData,
|
||||||
'count': count,
|
'count': count,
|
||||||
'etag': etag,
|
'etag': etag,
|
||||||
|
|
@ -1924,56 +2142,81 @@ class RoomMember {
|
||||||
}
|
}
|
||||||
|
|
||||||
@_NameSource('(generated, rule override generated)')
|
@_NameSource('(generated, rule override generated)')
|
||||||
enum Membership { ban, invite, join, knock, leave }
|
@EnhancedEnum()
|
||||||
|
enum Membership {
|
||||||
|
@EnhancedEnumValue(name: 'ban')
|
||||||
|
ban,
|
||||||
|
@EnhancedEnumValue(name: 'invite')
|
||||||
|
invite,
|
||||||
|
@EnhancedEnumValue(name: 'join')
|
||||||
|
join,
|
||||||
|
@EnhancedEnumValue(name: 'knock')
|
||||||
|
knock,
|
||||||
|
@EnhancedEnumValue(name: 'leave')
|
||||||
|
leave
|
||||||
|
}
|
||||||
|
|
||||||
@_NameSource('rule override generated')
|
@_NameSource('rule override generated')
|
||||||
enum Direction { b, f }
|
@EnhancedEnum()
|
||||||
|
enum Direction {
|
||||||
|
@EnhancedEnumValue(name: 'b')
|
||||||
|
b,
|
||||||
|
@EnhancedEnumValue(name: 'f')
|
||||||
|
f
|
||||||
|
}
|
||||||
|
|
||||||
/// A list of messages with a new token to request more.
|
/// A list of messages with a new token to request more.
|
||||||
@_NameSource('generated')
|
@_NameSource('generated')
|
||||||
class GetRoomEventsResponse {
|
class GetRoomEventsResponse {
|
||||||
GetRoomEventsResponse({
|
GetRoomEventsResponse({
|
||||||
this.chunk,
|
required this.chunk,
|
||||||
this.end,
|
this.end,
|
||||||
this.start,
|
required this.start,
|
||||||
this.state,
|
this.state,
|
||||||
});
|
});
|
||||||
|
|
||||||
GetRoomEventsResponse.fromJson(Map<String, dynamic> json)
|
GetRoomEventsResponse.fromJson(Map<String, dynamic> json)
|
||||||
: chunk = ((v) => v != null
|
: chunk = (json['chunk'] as List)
|
||||||
? (v as List).map((v) => MatrixEvent.fromJson(v)).toList()
|
.map((v) => MatrixEvent.fromJson(v))
|
||||||
: null)(json['chunk']),
|
.toList(),
|
||||||
end = ((v) => v != null ? v as String : null)(json['end']),
|
end = ((v) => v != null ? v as String : null)(json['end']),
|
||||||
start = ((v) => v != null ? v as String : null)(json['start']),
|
start = json['start'] as String,
|
||||||
state = ((v) => v != null
|
state = ((v) => v != null
|
||||||
? (v as List).map((v) => MatrixEvent.fromJson(v)).toList()
|
? (v as List).map((v) => MatrixEvent.fromJson(v)).toList()
|
||||||
: null)(json['state']);
|
: null)(json['state']);
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final chunk = this.chunk;
|
|
||||||
final end = this.end;
|
final end = this.end;
|
||||||
final start = this.start;
|
|
||||||
final state = this.state;
|
final state = this.state;
|
||||||
return {
|
return {
|
||||||
if (chunk != null) 'chunk': chunk.map((v) => v.toJson()).toList(),
|
'chunk': chunk.map((v) => v.toJson()).toList(),
|
||||||
if (end != null) 'end': end,
|
if (end != null) 'end': end,
|
||||||
if (start != null) 'start': start,
|
'start': start,
|
||||||
if (state != null) 'state': state.map((v) => v.toJson()).toList(),
|
if (state != null) 'state': state.map((v) => v.toJson()).toList(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A list of room events. The order depends on the `dir` parameter.
|
/// A list of room events. The order depends on the `dir` parameter.
|
||||||
/// For `dir=b` events will be in reverse-chronological order,
|
/// For `dir=b` events will be in reverse-chronological order,
|
||||||
/// for `dir=f` in chronological order, so that events start
|
/// for `dir=f` in chronological order. (The exact definition of `chronological`
|
||||||
/// at the `from` point.
|
/// is dependent on the server implementation.)
|
||||||
List<MatrixEvent>? chunk;
|
///
|
||||||
|
/// Note that an empty `chunk` does not *necessarily* imply that no more events
|
||||||
|
/// are available. Clients should continue to paginate until no `end` property
|
||||||
|
/// is returned.
|
||||||
|
List<MatrixEvent> chunk;
|
||||||
|
|
||||||
/// The token the pagination ends at. If `dir=b` this token should
|
/// A token corresponding to the end of `chunk`. This token can be passed
|
||||||
/// be used again to request even earlier events.
|
/// back to this endpoint to request further events.
|
||||||
|
///
|
||||||
|
/// If no further events are available (either because we have
|
||||||
|
/// reached the start of the timeline, or because the user does
|
||||||
|
/// not have permission to see any more events), this property
|
||||||
|
/// is omitted from the response.
|
||||||
String? end;
|
String? end;
|
||||||
|
|
||||||
/// The token the pagination starts from. If `dir=b` this will be
|
/// A token corresponding to the start of `chunk`. This will be the same as
|
||||||
/// the token supplied in `from`.
|
/// the value given in `from`.
|
||||||
String? start;
|
String start;
|
||||||
|
|
||||||
/// A list of state events relevant to showing the `chunk`. For example, if
|
/// A list of state events relevant to showing the `chunk`. For example, if
|
||||||
/// `lazy_load_members` is enabled in the filter then this may contain
|
/// `lazy_load_members` is enabled in the filter then this may contain
|
||||||
|
|
@ -1987,7 +2230,11 @@ class GetRoomEventsResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
@_NameSource('generated')
|
@_NameSource('generated')
|
||||||
enum ReceiptType { mRead }
|
@EnhancedEnum()
|
||||||
|
enum ReceiptType {
|
||||||
|
@EnhancedEnumValue(name: 'm.read')
|
||||||
|
mRead
|
||||||
|
}
|
||||||
|
|
||||||
@_NameSource('spec')
|
@_NameSource('spec')
|
||||||
class IncludeEventContext {
|
class IncludeEventContext {
|
||||||
|
|
@ -2250,7 +2497,13 @@ class SearchFilter implements EventFilter, RoomEventFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@_NameSource('rule override generated')
|
@_NameSource('rule override generated')
|
||||||
enum GroupKey { roomId, sender }
|
@EnhancedEnum()
|
||||||
|
enum GroupKey {
|
||||||
|
@EnhancedEnumValue(name: 'room_id')
|
||||||
|
roomId,
|
||||||
|
@EnhancedEnumValue(name: 'sender')
|
||||||
|
sender
|
||||||
|
}
|
||||||
|
|
||||||
/// Configuration for group.
|
/// Configuration for group.
|
||||||
@_NameSource('spec')
|
@_NameSource('spec')
|
||||||
|
|
@ -2260,14 +2513,12 @@ class Group {
|
||||||
});
|
});
|
||||||
|
|
||||||
Group.fromJson(Map<String, dynamic> json)
|
Group.fromJson(Map<String, dynamic> json)
|
||||||
: key = ((v) => v != null
|
: key = ((v) =>
|
||||||
? {'room_id': GroupKey.roomId, 'sender': GroupKey.sender}[v]!
|
v != null ? GroupKey.values.fromString(v)! : null)(json['key']);
|
||||||
: null)(json['key']);
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final key = this.key;
|
final key = this.key;
|
||||||
return {
|
return {
|
||||||
if (key != null)
|
if (key != null) 'key': key.name,
|
||||||
'key': {GroupKey.roomId: 'room_id', GroupKey.sender: 'sender'}[key]!,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2297,10 +2548,24 @@ class Groupings {
|
||||||
}
|
}
|
||||||
|
|
||||||
@_NameSource('rule override generated')
|
@_NameSource('rule override generated')
|
||||||
enum KeyKind { contentBody, contentName, contentTopic }
|
@EnhancedEnum()
|
||||||
|
enum KeyKind {
|
||||||
|
@EnhancedEnumValue(name: 'content.body')
|
||||||
|
contentBody,
|
||||||
|
@EnhancedEnumValue(name: 'content.name')
|
||||||
|
contentName,
|
||||||
|
@EnhancedEnumValue(name: 'content.topic')
|
||||||
|
contentTopic
|
||||||
|
}
|
||||||
|
|
||||||
@_NameSource('rule override generated')
|
@_NameSource('rule override generated')
|
||||||
enum SearchOrder { rank, recent }
|
@EnhancedEnum()
|
||||||
|
enum SearchOrder {
|
||||||
|
@EnhancedEnumValue(name: 'rank')
|
||||||
|
rank,
|
||||||
|
@EnhancedEnumValue(name: 'recent')
|
||||||
|
recent
|
||||||
|
}
|
||||||
|
|
||||||
@_NameSource('spec')
|
@_NameSource('spec')
|
||||||
class RoomEventsCriteria {
|
class RoomEventsCriteria {
|
||||||
|
|
@ -2325,17 +2590,10 @@ class RoomEventsCriteria {
|
||||||
includeState =
|
includeState =
|
||||||
((v) => v != null ? v as bool : null)(json['include_state']),
|
((v) => v != null ? v as bool : null)(json['include_state']),
|
||||||
keys = ((v) => v != null
|
keys = ((v) => v != null
|
||||||
? (v as List)
|
? (v as List).map((v) => KeyKind.values.fromString(v)!).toList()
|
||||||
.map((v) => {
|
|
||||||
'content.body': KeyKind.contentBody,
|
|
||||||
'content.name': KeyKind.contentName,
|
|
||||||
'content.topic': KeyKind.contentTopic
|
|
||||||
}[v]!)
|
|
||||||
.toList()
|
|
||||||
: null)(json['keys']),
|
: null)(json['keys']),
|
||||||
orderBy = ((v) => v != null
|
orderBy = ((v) => v != null ? SearchOrder.values.fromString(v)! : null)(
|
||||||
? {'recent': SearchOrder.recent, 'rank': SearchOrder.rank}[v]!
|
json['order_by']),
|
||||||
: null)(json['order_by']),
|
|
||||||
searchTerm = json['search_term'] as String;
|
searchTerm = json['search_term'] as String;
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final eventContext = this.eventContext;
|
final eventContext = this.eventContext;
|
||||||
|
|
@ -2349,19 +2607,8 @@ class RoomEventsCriteria {
|
||||||
if (filter != null) 'filter': filter.toJson(),
|
if (filter != null) 'filter': filter.toJson(),
|
||||||
if (groupings != null) 'groupings': groupings.toJson(),
|
if (groupings != null) 'groupings': groupings.toJson(),
|
||||||
if (includeState != null) 'include_state': includeState,
|
if (includeState != null) 'include_state': includeState,
|
||||||
if (keys != null)
|
if (keys != null) 'keys': keys.map((v) => v.name).toList(),
|
||||||
'keys': keys
|
if (orderBy != null) 'order_by': orderBy.name,
|
||||||
.map((v) => {
|
|
||||||
KeyKind.contentBody: 'content.body',
|
|
||||||
KeyKind.contentName: 'content.name',
|
|
||||||
KeyKind.contentTopic: 'content.topic'
|
|
||||||
}[v]!)
|
|
||||||
.toList(),
|
|
||||||
if (orderBy != null)
|
|
||||||
'order_by': {
|
|
||||||
SearchOrder.recent: 'recent',
|
|
||||||
SearchOrder.rank: 'rank'
|
|
||||||
}[orderBy]!,
|
|
||||||
'search_term': searchTerm,
|
'search_term': searchTerm,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -2872,7 +3119,13 @@ class ThirdPartyUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@_NameSource('generated')
|
@_NameSource('generated')
|
||||||
enum EventFormat { client, federation }
|
@EnhancedEnum()
|
||||||
|
enum EventFormat {
|
||||||
|
@EnhancedEnumValue(name: 'client')
|
||||||
|
client,
|
||||||
|
@EnhancedEnumValue(name: 'federation')
|
||||||
|
federation
|
||||||
|
}
|
||||||
|
|
||||||
@_NameSource('rule override generated')
|
@_NameSource('rule override generated')
|
||||||
class StateFilter implements EventFilter, RoomEventFilter {
|
class StateFilter implements EventFilter, RoomEventFilter {
|
||||||
|
|
@ -3065,10 +3318,7 @@ class Filter {
|
||||||
? (v as List).map((v) => v as String).toList()
|
? (v as List).map((v) => v as String).toList()
|
||||||
: null)(json['event_fields']),
|
: null)(json['event_fields']),
|
||||||
eventFormat = ((v) => v != null
|
eventFormat = ((v) => v != null
|
||||||
? {
|
? EventFormat.values.fromString(v)!
|
||||||
'client': EventFormat.client,
|
|
||||||
'federation': EventFormat.federation
|
|
||||||
}[v]!
|
|
||||||
: null)(json['event_format']),
|
: null)(json['event_format']),
|
||||||
presence = ((v) =>
|
presence = ((v) =>
|
||||||
v != null ? EventFilter.fromJson(v) : null)(json['presence']),
|
v != null ? EventFilter.fromJson(v) : null)(json['presence']),
|
||||||
|
|
@ -3083,11 +3333,7 @@ class Filter {
|
||||||
if (accountData != null) 'account_data': accountData.toJson(),
|
if (accountData != null) 'account_data': accountData.toJson(),
|
||||||
if (eventFields != null)
|
if (eventFields != null)
|
||||||
'event_fields': eventFields.map((v) => v).toList(),
|
'event_fields': eventFields.map((v) => v).toList(),
|
||||||
if (eventFormat != null)
|
if (eventFormat != null) 'event_format': eventFormat.name,
|
||||||
'event_format': {
|
|
||||||
EventFormat.client: 'client',
|
|
||||||
EventFormat.federation: 'federation'
|
|
||||||
}[eventFormat]!,
|
|
||||||
if (presence != null) 'presence': presence.toJson(),
|
if (presence != null) 'presence': presence.toJson(),
|
||||||
if (room != null) 'room': room.toJson(),
|
if (room != null) 'room': room.toJson(),
|
||||||
};
|
};
|
||||||
|
|
@ -3346,4 +3592,10 @@ class GetUrlPreviewResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
@_NameSource('generated')
|
@_NameSource('generated')
|
||||||
enum Method { crop, scale }
|
@EnhancedEnum()
|
||||||
|
enum Method {
|
||||||
|
@EnhancedEnumValue(name: 'crop')
|
||||||
|
crop,
|
||||||
|
@EnhancedEnumValue(name: 'scale')
|
||||||
|
scale
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,802 @@
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// EnhancedEnumGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
extension ThirdPartyIdentifierMediumFromStringExtension
|
||||||
|
on Iterable<ThirdPartyIdentifierMedium> {
|
||||||
|
ThirdPartyIdentifierMedium? fromString(String val) {
|
||||||
|
final override = {
|
||||||
|
'email': ThirdPartyIdentifierMedium.email,
|
||||||
|
'msisdn': ThirdPartyIdentifierMedium.msisdn,
|
||||||
|
}[val];
|
||||||
|
// ignore: unnecessary_this
|
||||||
|
return this.contains(override) ? override : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ThirdPartyIdentifierMediumEnhancedEnum on ThirdPartyIdentifierMedium {
|
||||||
|
@override
|
||||||
|
// ignore: override_on_non_overriding_member
|
||||||
|
String get name => {
|
||||||
|
ThirdPartyIdentifierMedium.email: 'email',
|
||||||
|
ThirdPartyIdentifierMedium.msisdn: 'msisdn',
|
||||||
|
}[this]!;
|
||||||
|
bool get isEmail => this == ThirdPartyIdentifierMedium.email;
|
||||||
|
bool get isMsisdn => this == ThirdPartyIdentifierMedium.msisdn;
|
||||||
|
T when<T>({
|
||||||
|
required T Function() email,
|
||||||
|
required T Function() msisdn,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
ThirdPartyIdentifierMedium.email: email,
|
||||||
|
ThirdPartyIdentifierMedium.msisdn: msisdn,
|
||||||
|
}[this]!();
|
||||||
|
T maybeWhen<T>({
|
||||||
|
T? Function()? email,
|
||||||
|
T? Function()? msisdn,
|
||||||
|
required T Function() orElse,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
ThirdPartyIdentifierMedium.email: email,
|
||||||
|
ThirdPartyIdentifierMedium.msisdn: msisdn,
|
||||||
|
}[this]
|
||||||
|
?.call() ??
|
||||||
|
orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
extension IdServerUnbindResultFromStringExtension
|
||||||
|
on Iterable<IdServerUnbindResult> {
|
||||||
|
IdServerUnbindResult? fromString(String val) {
|
||||||
|
final override = {
|
||||||
|
'no-support': IdServerUnbindResult.noSupport,
|
||||||
|
'success': IdServerUnbindResult.success,
|
||||||
|
}[val];
|
||||||
|
// ignore: unnecessary_this
|
||||||
|
return this.contains(override) ? override : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension IdServerUnbindResultEnhancedEnum on IdServerUnbindResult {
|
||||||
|
@override
|
||||||
|
// ignore: override_on_non_overriding_member
|
||||||
|
String get name => {
|
||||||
|
IdServerUnbindResult.noSupport: 'no-support',
|
||||||
|
IdServerUnbindResult.success: 'success',
|
||||||
|
}[this]!;
|
||||||
|
bool get isNoSupport => this == IdServerUnbindResult.noSupport;
|
||||||
|
bool get isSuccess => this == IdServerUnbindResult.success;
|
||||||
|
T when<T>({
|
||||||
|
required T Function() noSupport,
|
||||||
|
required T Function() success,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
IdServerUnbindResult.noSupport: noSupport,
|
||||||
|
IdServerUnbindResult.success: success,
|
||||||
|
}[this]!();
|
||||||
|
T maybeWhen<T>({
|
||||||
|
T? Function()? noSupport,
|
||||||
|
T? Function()? success,
|
||||||
|
required T Function() orElse,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
IdServerUnbindResult.noSupport: noSupport,
|
||||||
|
IdServerUnbindResult.success: success,
|
||||||
|
}[this]
|
||||||
|
?.call() ??
|
||||||
|
orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
extension RoomVersionAvailableFromStringExtension
|
||||||
|
on Iterable<RoomVersionAvailable> {
|
||||||
|
RoomVersionAvailable? fromString(String val) {
|
||||||
|
final override = {
|
||||||
|
'stable': RoomVersionAvailable.stable,
|
||||||
|
'unstable': RoomVersionAvailable.unstable,
|
||||||
|
}[val];
|
||||||
|
// ignore: unnecessary_this
|
||||||
|
return this.contains(override) ? override : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension RoomVersionAvailableEnhancedEnum on RoomVersionAvailable {
|
||||||
|
@override
|
||||||
|
// ignore: override_on_non_overriding_member
|
||||||
|
String get name => {
|
||||||
|
RoomVersionAvailable.stable: 'stable',
|
||||||
|
RoomVersionAvailable.unstable: 'unstable',
|
||||||
|
}[this]!;
|
||||||
|
bool get isStable => this == RoomVersionAvailable.stable;
|
||||||
|
bool get isUnstable => this == RoomVersionAvailable.unstable;
|
||||||
|
T when<T>({
|
||||||
|
required T Function() stable,
|
||||||
|
required T Function() unstable,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
RoomVersionAvailable.stable: stable,
|
||||||
|
RoomVersionAvailable.unstable: unstable,
|
||||||
|
}[this]!();
|
||||||
|
T maybeWhen<T>({
|
||||||
|
T? Function()? stable,
|
||||||
|
T? Function()? unstable,
|
||||||
|
required T Function() orElse,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
RoomVersionAvailable.stable: stable,
|
||||||
|
RoomVersionAvailable.unstable: unstable,
|
||||||
|
}[this]
|
||||||
|
?.call() ??
|
||||||
|
orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CreateRoomPresetFromStringExtension on Iterable<CreateRoomPreset> {
|
||||||
|
CreateRoomPreset? fromString(String val) {
|
||||||
|
final override = {
|
||||||
|
'private_chat': CreateRoomPreset.privateChat,
|
||||||
|
'public_chat': CreateRoomPreset.publicChat,
|
||||||
|
'trusted_private_chat': CreateRoomPreset.trustedPrivateChat,
|
||||||
|
}[val];
|
||||||
|
// ignore: unnecessary_this
|
||||||
|
return this.contains(override) ? override : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CreateRoomPresetEnhancedEnum on CreateRoomPreset {
|
||||||
|
@override
|
||||||
|
// ignore: override_on_non_overriding_member
|
||||||
|
String get name => {
|
||||||
|
CreateRoomPreset.privateChat: 'private_chat',
|
||||||
|
CreateRoomPreset.publicChat: 'public_chat',
|
||||||
|
CreateRoomPreset.trustedPrivateChat: 'trusted_private_chat',
|
||||||
|
}[this]!;
|
||||||
|
bool get isPrivateChat => this == CreateRoomPreset.privateChat;
|
||||||
|
bool get isPublicChat => this == CreateRoomPreset.publicChat;
|
||||||
|
bool get isTrustedPrivateChat => this == CreateRoomPreset.trustedPrivateChat;
|
||||||
|
T when<T>({
|
||||||
|
required T Function() privateChat,
|
||||||
|
required T Function() publicChat,
|
||||||
|
required T Function() trustedPrivateChat,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
CreateRoomPreset.privateChat: privateChat,
|
||||||
|
CreateRoomPreset.publicChat: publicChat,
|
||||||
|
CreateRoomPreset.trustedPrivateChat: trustedPrivateChat,
|
||||||
|
}[this]!();
|
||||||
|
T maybeWhen<T>({
|
||||||
|
T? Function()? privateChat,
|
||||||
|
T? Function()? publicChat,
|
||||||
|
T? Function()? trustedPrivateChat,
|
||||||
|
required T Function() orElse,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
CreateRoomPreset.privateChat: privateChat,
|
||||||
|
CreateRoomPreset.publicChat: publicChat,
|
||||||
|
CreateRoomPreset.trustedPrivateChat: trustedPrivateChat,
|
||||||
|
}[this]
|
||||||
|
?.call() ??
|
||||||
|
orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
extension VisibilityFromStringExtension on Iterable<Visibility> {
|
||||||
|
Visibility? fromString(String val) {
|
||||||
|
final override = {
|
||||||
|
'private': Visibility.private,
|
||||||
|
'public': Visibility.public,
|
||||||
|
}[val];
|
||||||
|
// ignore: unnecessary_this
|
||||||
|
return this.contains(override) ? override : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension VisibilityEnhancedEnum on Visibility {
|
||||||
|
@override
|
||||||
|
// ignore: override_on_non_overriding_member
|
||||||
|
String get name => {
|
||||||
|
Visibility.private: 'private',
|
||||||
|
Visibility.public: 'public',
|
||||||
|
}[this]!;
|
||||||
|
bool get isPrivate => this == Visibility.private;
|
||||||
|
bool get isPublic => this == Visibility.public;
|
||||||
|
T when<T>({
|
||||||
|
required T Function() private,
|
||||||
|
required T Function() public,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
Visibility.private: private,
|
||||||
|
Visibility.public: public,
|
||||||
|
}[this]!();
|
||||||
|
T maybeWhen<T>({
|
||||||
|
T? Function()? private,
|
||||||
|
T? Function()? public,
|
||||||
|
required T Function() orElse,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
Visibility.private: private,
|
||||||
|
Visibility.public: public,
|
||||||
|
}[this]
|
||||||
|
?.call() ??
|
||||||
|
orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
extension LoginTypeFromStringExtension on Iterable<LoginType> {
|
||||||
|
LoginType? fromString(String val) {
|
||||||
|
final override = {
|
||||||
|
'm.login.password': LoginType.mLoginPassword,
|
||||||
|
'm.login.token': LoginType.mLoginToken,
|
||||||
|
}[val];
|
||||||
|
// ignore: unnecessary_this
|
||||||
|
return this.contains(override) ? override : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension LoginTypeEnhancedEnum on LoginType {
|
||||||
|
@override
|
||||||
|
// ignore: override_on_non_overriding_member
|
||||||
|
String get name => {
|
||||||
|
LoginType.mLoginPassword: 'm.login.password',
|
||||||
|
LoginType.mLoginToken: 'm.login.token',
|
||||||
|
}[this]!;
|
||||||
|
bool get isMLoginPassword => this == LoginType.mLoginPassword;
|
||||||
|
bool get isMLoginToken => this == LoginType.mLoginToken;
|
||||||
|
T when<T>({
|
||||||
|
required T Function() mLoginPassword,
|
||||||
|
required T Function() mLoginToken,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
LoginType.mLoginPassword: mLoginPassword,
|
||||||
|
LoginType.mLoginToken: mLoginToken,
|
||||||
|
}[this]!();
|
||||||
|
T maybeWhen<T>({
|
||||||
|
T? Function()? mLoginPassword,
|
||||||
|
T? Function()? mLoginToken,
|
||||||
|
required T Function() orElse,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
LoginType.mLoginPassword: mLoginPassword,
|
||||||
|
LoginType.mLoginToken: mLoginToken,
|
||||||
|
}[this]
|
||||||
|
?.call() ??
|
||||||
|
orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
extension PresenceTypeFromStringExtension on Iterable<PresenceType> {
|
||||||
|
PresenceType? fromString(String val) {
|
||||||
|
final override = {
|
||||||
|
'offline': PresenceType.offline,
|
||||||
|
'online': PresenceType.online,
|
||||||
|
'unavailable': PresenceType.unavailable,
|
||||||
|
}[val];
|
||||||
|
// ignore: unnecessary_this
|
||||||
|
return this.contains(override) ? override : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension PresenceTypeEnhancedEnum on PresenceType {
|
||||||
|
@override
|
||||||
|
// ignore: override_on_non_overriding_member
|
||||||
|
String get name => {
|
||||||
|
PresenceType.offline: 'offline',
|
||||||
|
PresenceType.online: 'online',
|
||||||
|
PresenceType.unavailable: 'unavailable',
|
||||||
|
}[this]!;
|
||||||
|
bool get isOffline => this == PresenceType.offline;
|
||||||
|
bool get isOnline => this == PresenceType.online;
|
||||||
|
bool get isUnavailable => this == PresenceType.unavailable;
|
||||||
|
T when<T>({
|
||||||
|
required T Function() offline,
|
||||||
|
required T Function() online,
|
||||||
|
required T Function() unavailable,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
PresenceType.offline: offline,
|
||||||
|
PresenceType.online: online,
|
||||||
|
PresenceType.unavailable: unavailable,
|
||||||
|
}[this]!();
|
||||||
|
T maybeWhen<T>({
|
||||||
|
T? Function()? offline,
|
||||||
|
T? Function()? online,
|
||||||
|
T? Function()? unavailable,
|
||||||
|
required T Function() orElse,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
PresenceType.offline: offline,
|
||||||
|
PresenceType.online: online,
|
||||||
|
PresenceType.unavailable: unavailable,
|
||||||
|
}[this]
|
||||||
|
?.call() ??
|
||||||
|
orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
extension PushRuleKindFromStringExtension on Iterable<PushRuleKind> {
|
||||||
|
PushRuleKind? fromString(String val) {
|
||||||
|
final override = {
|
||||||
|
'content': PushRuleKind.content,
|
||||||
|
'override': PushRuleKind.override,
|
||||||
|
'room': PushRuleKind.room,
|
||||||
|
'sender': PushRuleKind.sender,
|
||||||
|
'underride': PushRuleKind.underride,
|
||||||
|
}[val];
|
||||||
|
// ignore: unnecessary_this
|
||||||
|
return this.contains(override) ? override : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension PushRuleKindEnhancedEnum on PushRuleKind {
|
||||||
|
@override
|
||||||
|
// ignore: override_on_non_overriding_member
|
||||||
|
String get name => {
|
||||||
|
PushRuleKind.content: 'content',
|
||||||
|
PushRuleKind.override: 'override',
|
||||||
|
PushRuleKind.room: 'room',
|
||||||
|
PushRuleKind.sender: 'sender',
|
||||||
|
PushRuleKind.underride: 'underride',
|
||||||
|
}[this]!;
|
||||||
|
bool get isContent => this == PushRuleKind.content;
|
||||||
|
bool get isOverride => this == PushRuleKind.override;
|
||||||
|
bool get isRoom => this == PushRuleKind.room;
|
||||||
|
bool get isSender => this == PushRuleKind.sender;
|
||||||
|
bool get isUnderride => this == PushRuleKind.underride;
|
||||||
|
T when<T>({
|
||||||
|
required T Function() content,
|
||||||
|
required T Function() override,
|
||||||
|
required T Function() room,
|
||||||
|
required T Function() sender,
|
||||||
|
required T Function() underride,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
PushRuleKind.content: content,
|
||||||
|
PushRuleKind.override: override,
|
||||||
|
PushRuleKind.room: room,
|
||||||
|
PushRuleKind.sender: sender,
|
||||||
|
PushRuleKind.underride: underride,
|
||||||
|
}[this]!();
|
||||||
|
T maybeWhen<T>({
|
||||||
|
T? Function()? content,
|
||||||
|
T? Function()? override,
|
||||||
|
T? Function()? room,
|
||||||
|
T? Function()? sender,
|
||||||
|
T? Function()? underride,
|
||||||
|
required T Function() orElse,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
PushRuleKind.content: content,
|
||||||
|
PushRuleKind.override: override,
|
||||||
|
PushRuleKind.room: room,
|
||||||
|
PushRuleKind.sender: sender,
|
||||||
|
PushRuleKind.underride: underride,
|
||||||
|
}[this]
|
||||||
|
?.call() ??
|
||||||
|
orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
extension AccountKindFromStringExtension on Iterable<AccountKind> {
|
||||||
|
AccountKind? fromString(String val) {
|
||||||
|
final override = {
|
||||||
|
'guest': AccountKind.guest,
|
||||||
|
'user': AccountKind.user,
|
||||||
|
}[val];
|
||||||
|
// ignore: unnecessary_this
|
||||||
|
return this.contains(override) ? override : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension AccountKindEnhancedEnum on AccountKind {
|
||||||
|
@override
|
||||||
|
// ignore: override_on_non_overriding_member
|
||||||
|
String get name => {
|
||||||
|
AccountKind.guest: 'guest',
|
||||||
|
AccountKind.user: 'user',
|
||||||
|
}[this]!;
|
||||||
|
bool get isGuest => this == AccountKind.guest;
|
||||||
|
bool get isUser => this == AccountKind.user;
|
||||||
|
T when<T>({
|
||||||
|
required T Function() guest,
|
||||||
|
required T Function() user,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
AccountKind.guest: guest,
|
||||||
|
AccountKind.user: user,
|
||||||
|
}[this]!();
|
||||||
|
T maybeWhen<T>({
|
||||||
|
T? Function()? guest,
|
||||||
|
T? Function()? user,
|
||||||
|
required T Function() orElse,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
AccountKind.guest: guest,
|
||||||
|
AccountKind.user: user,
|
||||||
|
}[this]
|
||||||
|
?.call() ??
|
||||||
|
orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
extension BackupAlgorithmFromStringExtension on Iterable<BackupAlgorithm> {
|
||||||
|
BackupAlgorithm? fromString(String val) {
|
||||||
|
final override = {
|
||||||
|
'm.megolm_backup.v1.curve25519-aes-sha2':
|
||||||
|
BackupAlgorithm.mMegolmBackupV1Curve25519AesSha2,
|
||||||
|
}[val];
|
||||||
|
// ignore: unnecessary_this
|
||||||
|
return this.contains(override) ? override : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension BackupAlgorithmEnhancedEnum on BackupAlgorithm {
|
||||||
|
@override
|
||||||
|
// ignore: override_on_non_overriding_member
|
||||||
|
String get name => {
|
||||||
|
BackupAlgorithm.mMegolmBackupV1Curve25519AesSha2:
|
||||||
|
'm.megolm_backup.v1.curve25519-aes-sha2',
|
||||||
|
}[this]!;
|
||||||
|
bool get isMMegolmBackupV1Curve25519AesSha2 =>
|
||||||
|
this == BackupAlgorithm.mMegolmBackupV1Curve25519AesSha2;
|
||||||
|
T when<T>({
|
||||||
|
required T Function() mMegolmBackupV1Curve25519AesSha2,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
BackupAlgorithm.mMegolmBackupV1Curve25519AesSha2:
|
||||||
|
mMegolmBackupV1Curve25519AesSha2,
|
||||||
|
}[this]!();
|
||||||
|
T maybeWhen<T>({
|
||||||
|
T? Function()? mMegolmBackupV1Curve25519AesSha2,
|
||||||
|
required T Function() orElse,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
BackupAlgorithm.mMegolmBackupV1Curve25519AesSha2:
|
||||||
|
mMegolmBackupV1Curve25519AesSha2,
|
||||||
|
}[this]
|
||||||
|
?.call() ??
|
||||||
|
orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
extension MembershipFromStringExtension on Iterable<Membership> {
|
||||||
|
Membership? fromString(String val) {
|
||||||
|
final override = {
|
||||||
|
'ban': Membership.ban,
|
||||||
|
'invite': Membership.invite,
|
||||||
|
'join': Membership.join,
|
||||||
|
'knock': Membership.knock,
|
||||||
|
'leave': Membership.leave,
|
||||||
|
}[val];
|
||||||
|
// ignore: unnecessary_this
|
||||||
|
return this.contains(override) ? override : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension MembershipEnhancedEnum on Membership {
|
||||||
|
@override
|
||||||
|
// ignore: override_on_non_overriding_member
|
||||||
|
String get name => {
|
||||||
|
Membership.ban: 'ban',
|
||||||
|
Membership.invite: 'invite',
|
||||||
|
Membership.join: 'join',
|
||||||
|
Membership.knock: 'knock',
|
||||||
|
Membership.leave: 'leave',
|
||||||
|
}[this]!;
|
||||||
|
bool get isBan => this == Membership.ban;
|
||||||
|
bool get isInvite => this == Membership.invite;
|
||||||
|
bool get isJoin => this == Membership.join;
|
||||||
|
bool get isKnock => this == Membership.knock;
|
||||||
|
bool get isLeave => this == Membership.leave;
|
||||||
|
T when<T>({
|
||||||
|
required T Function() ban,
|
||||||
|
required T Function() invite,
|
||||||
|
required T Function() join,
|
||||||
|
required T Function() knock,
|
||||||
|
required T Function() leave,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
Membership.ban: ban,
|
||||||
|
Membership.invite: invite,
|
||||||
|
Membership.join: join,
|
||||||
|
Membership.knock: knock,
|
||||||
|
Membership.leave: leave,
|
||||||
|
}[this]!();
|
||||||
|
T maybeWhen<T>({
|
||||||
|
T? Function()? ban,
|
||||||
|
T? Function()? invite,
|
||||||
|
T? Function()? join,
|
||||||
|
T? Function()? knock,
|
||||||
|
T? Function()? leave,
|
||||||
|
required T Function() orElse,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
Membership.ban: ban,
|
||||||
|
Membership.invite: invite,
|
||||||
|
Membership.join: join,
|
||||||
|
Membership.knock: knock,
|
||||||
|
Membership.leave: leave,
|
||||||
|
}[this]
|
||||||
|
?.call() ??
|
||||||
|
orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
extension DirectionFromStringExtension on Iterable<Direction> {
|
||||||
|
Direction? fromString(String val) {
|
||||||
|
final override = {
|
||||||
|
'b': Direction.b,
|
||||||
|
'f': Direction.f,
|
||||||
|
}[val];
|
||||||
|
// ignore: unnecessary_this
|
||||||
|
return this.contains(override) ? override : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension DirectionEnhancedEnum on Direction {
|
||||||
|
@override
|
||||||
|
// ignore: override_on_non_overriding_member
|
||||||
|
String get name => {
|
||||||
|
Direction.b: 'b',
|
||||||
|
Direction.f: 'f',
|
||||||
|
}[this]!;
|
||||||
|
bool get isB => this == Direction.b;
|
||||||
|
bool get isF => this == Direction.f;
|
||||||
|
T when<T>({
|
||||||
|
required T Function() b,
|
||||||
|
required T Function() f,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
Direction.b: b,
|
||||||
|
Direction.f: f,
|
||||||
|
}[this]!();
|
||||||
|
T maybeWhen<T>({
|
||||||
|
T? Function()? b,
|
||||||
|
T? Function()? f,
|
||||||
|
required T Function() orElse,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
Direction.b: b,
|
||||||
|
Direction.f: f,
|
||||||
|
}[this]
|
||||||
|
?.call() ??
|
||||||
|
orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ReceiptTypeFromStringExtension on Iterable<ReceiptType> {
|
||||||
|
ReceiptType? fromString(String val) {
|
||||||
|
final override = {
|
||||||
|
'm.read': ReceiptType.mRead,
|
||||||
|
}[val];
|
||||||
|
// ignore: unnecessary_this
|
||||||
|
return this.contains(override) ? override : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ReceiptTypeEnhancedEnum on ReceiptType {
|
||||||
|
@override
|
||||||
|
// ignore: override_on_non_overriding_member
|
||||||
|
String get name => {
|
||||||
|
ReceiptType.mRead: 'm.read',
|
||||||
|
}[this]!;
|
||||||
|
bool get isMRead => this == ReceiptType.mRead;
|
||||||
|
T when<T>({
|
||||||
|
required T Function() mRead,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
ReceiptType.mRead: mRead,
|
||||||
|
}[this]!();
|
||||||
|
T maybeWhen<T>({
|
||||||
|
T? Function()? mRead,
|
||||||
|
required T Function() orElse,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
ReceiptType.mRead: mRead,
|
||||||
|
}[this]
|
||||||
|
?.call() ??
|
||||||
|
orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
extension GroupKeyFromStringExtension on Iterable<GroupKey> {
|
||||||
|
GroupKey? fromString(String val) {
|
||||||
|
final override = {
|
||||||
|
'room_id': GroupKey.roomId,
|
||||||
|
'sender': GroupKey.sender,
|
||||||
|
}[val];
|
||||||
|
// ignore: unnecessary_this
|
||||||
|
return this.contains(override) ? override : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension GroupKeyEnhancedEnum on GroupKey {
|
||||||
|
@override
|
||||||
|
// ignore: override_on_non_overriding_member
|
||||||
|
String get name => {
|
||||||
|
GroupKey.roomId: 'room_id',
|
||||||
|
GroupKey.sender: 'sender',
|
||||||
|
}[this]!;
|
||||||
|
bool get isRoomId => this == GroupKey.roomId;
|
||||||
|
bool get isSender => this == GroupKey.sender;
|
||||||
|
T when<T>({
|
||||||
|
required T Function() roomId,
|
||||||
|
required T Function() sender,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
GroupKey.roomId: roomId,
|
||||||
|
GroupKey.sender: sender,
|
||||||
|
}[this]!();
|
||||||
|
T maybeWhen<T>({
|
||||||
|
T? Function()? roomId,
|
||||||
|
T? Function()? sender,
|
||||||
|
required T Function() orElse,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
GroupKey.roomId: roomId,
|
||||||
|
GroupKey.sender: sender,
|
||||||
|
}[this]
|
||||||
|
?.call() ??
|
||||||
|
orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
extension KeyKindFromStringExtension on Iterable<KeyKind> {
|
||||||
|
KeyKind? fromString(String val) {
|
||||||
|
final override = {
|
||||||
|
'content.body': KeyKind.contentBody,
|
||||||
|
'content.name': KeyKind.contentName,
|
||||||
|
'content.topic': KeyKind.contentTopic,
|
||||||
|
}[val];
|
||||||
|
// ignore: unnecessary_this
|
||||||
|
return this.contains(override) ? override : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension KeyKindEnhancedEnum on KeyKind {
|
||||||
|
@override
|
||||||
|
// ignore: override_on_non_overriding_member
|
||||||
|
String get name => {
|
||||||
|
KeyKind.contentBody: 'content.body',
|
||||||
|
KeyKind.contentName: 'content.name',
|
||||||
|
KeyKind.contentTopic: 'content.topic',
|
||||||
|
}[this]!;
|
||||||
|
bool get isContentBody => this == KeyKind.contentBody;
|
||||||
|
bool get isContentName => this == KeyKind.contentName;
|
||||||
|
bool get isContentTopic => this == KeyKind.contentTopic;
|
||||||
|
T when<T>({
|
||||||
|
required T Function() contentBody,
|
||||||
|
required T Function() contentName,
|
||||||
|
required T Function() contentTopic,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
KeyKind.contentBody: contentBody,
|
||||||
|
KeyKind.contentName: contentName,
|
||||||
|
KeyKind.contentTopic: contentTopic,
|
||||||
|
}[this]!();
|
||||||
|
T maybeWhen<T>({
|
||||||
|
T? Function()? contentBody,
|
||||||
|
T? Function()? contentName,
|
||||||
|
T? Function()? contentTopic,
|
||||||
|
required T Function() orElse,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
KeyKind.contentBody: contentBody,
|
||||||
|
KeyKind.contentName: contentName,
|
||||||
|
KeyKind.contentTopic: contentTopic,
|
||||||
|
}[this]
|
||||||
|
?.call() ??
|
||||||
|
orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
extension SearchOrderFromStringExtension on Iterable<SearchOrder> {
|
||||||
|
SearchOrder? fromString(String val) {
|
||||||
|
final override = {
|
||||||
|
'rank': SearchOrder.rank,
|
||||||
|
'recent': SearchOrder.recent,
|
||||||
|
}[val];
|
||||||
|
// ignore: unnecessary_this
|
||||||
|
return this.contains(override) ? override : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension SearchOrderEnhancedEnum on SearchOrder {
|
||||||
|
@override
|
||||||
|
// ignore: override_on_non_overriding_member
|
||||||
|
String get name => {
|
||||||
|
SearchOrder.rank: 'rank',
|
||||||
|
SearchOrder.recent: 'recent',
|
||||||
|
}[this]!;
|
||||||
|
bool get isRank => this == SearchOrder.rank;
|
||||||
|
bool get isRecent => this == SearchOrder.recent;
|
||||||
|
T when<T>({
|
||||||
|
required T Function() rank,
|
||||||
|
required T Function() recent,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
SearchOrder.rank: rank,
|
||||||
|
SearchOrder.recent: recent,
|
||||||
|
}[this]!();
|
||||||
|
T maybeWhen<T>({
|
||||||
|
T? Function()? rank,
|
||||||
|
T? Function()? recent,
|
||||||
|
required T Function() orElse,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
SearchOrder.rank: rank,
|
||||||
|
SearchOrder.recent: recent,
|
||||||
|
}[this]
|
||||||
|
?.call() ??
|
||||||
|
orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
extension EventFormatFromStringExtension on Iterable<EventFormat> {
|
||||||
|
EventFormat? fromString(String val) {
|
||||||
|
final override = {
|
||||||
|
'client': EventFormat.client,
|
||||||
|
'federation': EventFormat.federation,
|
||||||
|
}[val];
|
||||||
|
// ignore: unnecessary_this
|
||||||
|
return this.contains(override) ? override : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension EventFormatEnhancedEnum on EventFormat {
|
||||||
|
@override
|
||||||
|
// ignore: override_on_non_overriding_member
|
||||||
|
String get name => {
|
||||||
|
EventFormat.client: 'client',
|
||||||
|
EventFormat.federation: 'federation',
|
||||||
|
}[this]!;
|
||||||
|
bool get isClient => this == EventFormat.client;
|
||||||
|
bool get isFederation => this == EventFormat.federation;
|
||||||
|
T when<T>({
|
||||||
|
required T Function() client,
|
||||||
|
required T Function() federation,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
EventFormat.client: client,
|
||||||
|
EventFormat.federation: federation,
|
||||||
|
}[this]!();
|
||||||
|
T maybeWhen<T>({
|
||||||
|
T? Function()? client,
|
||||||
|
T? Function()? federation,
|
||||||
|
required T Function() orElse,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
EventFormat.client: client,
|
||||||
|
EventFormat.federation: federation,
|
||||||
|
}[this]
|
||||||
|
?.call() ??
|
||||||
|
orElse();
|
||||||
|
}
|
||||||
|
|
||||||
|
extension MethodFromStringExtension on Iterable<Method> {
|
||||||
|
Method? fromString(String val) {
|
||||||
|
final override = {
|
||||||
|
'crop': Method.crop,
|
||||||
|
'scale': Method.scale,
|
||||||
|
}[val];
|
||||||
|
// ignore: unnecessary_this
|
||||||
|
return this.contains(override) ? override : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension MethodEnhancedEnum on Method {
|
||||||
|
@override
|
||||||
|
// ignore: override_on_non_overriding_member
|
||||||
|
String get name => {
|
||||||
|
Method.crop: 'crop',
|
||||||
|
Method.scale: 'scale',
|
||||||
|
}[this]!;
|
||||||
|
bool get isCrop => this == Method.crop;
|
||||||
|
bool get isScale => this == Method.scale;
|
||||||
|
T when<T>({
|
||||||
|
required T Function() crop,
|
||||||
|
required T Function() scale,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
Method.crop: crop,
|
||||||
|
Method.scale: scale,
|
||||||
|
}[this]!();
|
||||||
|
T maybeWhen<T>({
|
||||||
|
T? Function()? crop,
|
||||||
|
T? Function()? scale,
|
||||||
|
required T Function() orElse,
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
Method.crop: crop,
|
||||||
|
Method.scale: scale,
|
||||||
|
}[this]
|
||||||
|
?.call() ??
|
||||||
|
orElse();
|
||||||
|
}
|
||||||
|
|
@ -91,7 +91,7 @@ class MatrixApi extends Api {
|
||||||
}
|
}
|
||||||
dynamic json;
|
dynamic json;
|
||||||
(!(data is String)) ? json = jsonEncode(data) : json = data;
|
(!(data is String)) ? json = jsonEncode(data) : json = data;
|
||||||
if (data is List<int> || action.startsWith('/media/r0/upload')) json = data;
|
if (data is List<int> || action.startsWith('/media/v3/upload')) json = data;
|
||||||
|
|
||||||
final url = homeserver!
|
final url = homeserver!
|
||||||
.resolveUri(Uri(path: '_matrix$action', queryParameters: query));
|
.resolveUri(Uri(path: '_matrix$action', queryParameters: query));
|
||||||
|
|
@ -154,7 +154,7 @@ class MatrixApi extends Api {
|
||||||
Map<String, dynamic>? fallbackKeys}) async {
|
Map<String, dynamic>? fallbackKeys}) async {
|
||||||
final response = await request(
|
final response = await request(
|
||||||
RequestType.POST,
|
RequestType.POST,
|
||||||
'/client/r0/keys/upload',
|
'/client/v3/keys/upload',
|
||||||
data: {
|
data: {
|
||||||
if (deviceKeys != null) 'device_keys': deviceKeys.toJson(),
|
if (deviceKeys != null) 'device_keys': deviceKeys.toJson(),
|
||||||
if (oneTimeKeys != null) 'one_time_keys': oneTimeKeys,
|
if (oneTimeKeys != null) 'one_time_keys': oneTimeKeys,
|
||||||
|
|
@ -181,7 +181,7 @@ class MatrixApi extends Api {
|
||||||
}
|
}
|
||||||
await request(
|
await request(
|
||||||
RequestType.POST,
|
RequestType.POST,
|
||||||
'/client/r0/pushers/set',
|
'/client/v3/pushers/set',
|
||||||
data: data,
|
data: data,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
|
@ -195,7 +195,7 @@ class MatrixApi extends Api {
|
||||||
data['kind'] = null;
|
data['kind'] = null;
|
||||||
await request(
|
await request(
|
||||||
RequestType.POST,
|
RequestType.POST,
|
||||||
'/client/r0/pushers/set',
|
'/client/v3/pushers/set',
|
||||||
data: data,
|
data: data,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
|
@ -205,7 +205,7 @@ class MatrixApi extends Api {
|
||||||
/// calls.
|
/// calls.
|
||||||
@override
|
@override
|
||||||
Future<TurnServerCredentials> getTurnServer() async {
|
Future<TurnServerCredentials> getTurnServer() async {
|
||||||
final json = await request(RequestType.GET, '/client/r0/voip/turnServer');
|
final json = await request(RequestType.GET, '/client/v3/voip/turnServer');
|
||||||
|
|
||||||
// fix invalid responses from synapse
|
// fix invalid responses from synapse
|
||||||
// https://github.com/matrix-org/synapse/pull/10922
|
// https://github.com/matrix-org/synapse/pull/10922
|
||||||
|
|
@ -213,4 +213,22 @@ class MatrixApi extends Api {
|
||||||
|
|
||||||
return TurnServerCredentials.fromJson(json);
|
return TurnServerCredentials.fromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated('Use [deleteRoomKeyBySessionId] instead')
|
||||||
|
Future<RoomKeysUpdateResponse> deleteRoomKeysBySessionId(
|
||||||
|
String roomId, String sessionId, String version) async {
|
||||||
|
return deleteRoomKeyBySessionId(roomId, sessionId, version);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated('Use [deleteRoomKeyBySessionId] instead')
|
||||||
|
Future<RoomKeysUpdateResponse> putRoomKeysBySessionId(String roomId,
|
||||||
|
String sessionId, String version, KeyBackupData data) async {
|
||||||
|
return putRoomKeyBySessionId(roomId, sessionId, version, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated('Use [getRoomKeyBySessionId] instead')
|
||||||
|
Future<KeyBackupData> getRoomKeysBySessionId(
|
||||||
|
String roomId, String sessionId, String version) async {
|
||||||
|
return getRoomKeyBySessionId(roomId, sessionId, version);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,12 @@ environment:
|
||||||
sdk: ">=2.12.0 <3.0.0"
|
sdk: ">=2.12.0 <3.0.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
|
enhanced_enum: ^0.1.1
|
||||||
http: ^0.13.0
|
http: ^0.13.0
|
||||||
mime: ^1.0.0
|
mime: ^1.0.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
build_runner: ^2.1.8
|
||||||
|
enhanced_enum_generator: ^0.1.1
|
||||||
pedantic: ^1.11.0
|
pedantic: ^1.11.0
|
||||||
test: ^1.14.4
|
test: ^1.14.4
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ void main() {
|
||||||
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
||||||
final loginTypes = await matrixApi.getLoginFlows();
|
final loginTypes = await matrixApi.getLoginFlows();
|
||||||
expect(loginTypes?.first.type, 'm.login.password');
|
expect(loginTypes?.first.type, 'm.login.password');
|
||||||
expect(FakeMatrixApi.api['GET'],
|
expect(FakeMatrixApi.api['GET'],
|
||||||
{'flows': loginTypes?.map((x) => x.toJson()).toList()});
|
{'flows': loginTypes?.map((x) => x.toJson()).toList()});
|
||||||
matrixApi.homeserver = null;
|
matrixApi.homeserver = null;
|
||||||
});
|
});
|
||||||
|
|
@ -156,7 +156,7 @@ void main() {
|
||||||
LoginType.mLoginPassword,
|
LoginType.mLoginPassword,
|
||||||
identifier: AuthenticationUserIdentifier(user: 'username'),
|
identifier: AuthenticationUserIdentifier(user: 'username'),
|
||||||
);
|
);
|
||||||
expect(FakeMatrixApi.api['POST'],
|
expect(FakeMatrixApi.api['POST'],
|
||||||
loginResponse.toJson());
|
loginResponse.toJson());
|
||||||
matrixApi.homeserver = null;
|
matrixApi.homeserver = null;
|
||||||
});
|
});
|
||||||
|
|
@ -176,7 +176,7 @@ void main() {
|
||||||
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
||||||
final registerResponse =
|
final registerResponse =
|
||||||
await matrixApi.register(kind: AccountKind.guest, username: 'test');
|
await matrixApi.register(kind: AccountKind.guest, username: 'test');
|
||||||
expect(FakeMatrixApi.api['POST'],
|
expect(FakeMatrixApi.api['POST'],
|
||||||
registerResponse.toJson());
|
registerResponse.toJson());
|
||||||
matrixApi.homeserver = null;
|
matrixApi.homeserver = null;
|
||||||
});
|
});
|
||||||
|
|
@ -193,7 +193,7 @@ void main() {
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi
|
FakeMatrixApi
|
||||||
.api['POST'],
|
.api['POST'],
|
||||||
response.toJson());
|
response.toJson());
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
});
|
});
|
||||||
|
|
@ -211,7 +211,7 @@ void main() {
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi
|
FakeMatrixApi
|
||||||
.api['POST'],
|
.api['POST'],
|
||||||
response.toJson());
|
response.toJson());
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
});
|
});
|
||||||
|
|
@ -280,7 +280,7 @@ void main() {
|
||||||
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
||||||
matrixApi.accessToken = '1234';
|
matrixApi.accessToken = '1234';
|
||||||
final response = await matrixApi.getAccount3PIDs();
|
final response = await matrixApi.getAccount3PIDs();
|
||||||
expect(FakeMatrixApi.api['GET'],
|
expect(FakeMatrixApi.api['GET'],
|
||||||
{'threepids': response?.map((t) => t.toJson()).toList()});
|
{'threepids': response?.map((t) => t.toJson()).toList()});
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
});
|
});
|
||||||
|
|
@ -362,7 +362,7 @@ void main() {
|
||||||
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
||||||
matrixApi.accessToken = '1234';
|
matrixApi.accessToken = '1234';
|
||||||
final response = await matrixApi.getCapabilities();
|
final response = await matrixApi.getCapabilities();
|
||||||
expect(FakeMatrixApi.api['GET'],
|
expect(FakeMatrixApi.api['GET'],
|
||||||
{'capabilities': response.toJson()});
|
{'capabilities': response.toJson()});
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
});
|
});
|
||||||
|
|
@ -497,7 +497,7 @@ void main() {
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']![
|
FakeMatrixApi.api['GET'] as Map?,
|
{}) as Map?,
|
||||||
response.toJson());
|
response.toJson());
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
|
|
@ -575,7 +575,7 @@ void main() {
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']![
|
FakeMatrixApi.api['GET'] as Map?,
|
{}) as Map?,
|
||||||
timelineHistoryResponse.toJson());
|
timelineHistoryResponse.toJson());
|
||||||
|
|
||||||
|
|
@ -666,7 +666,7 @@ void main() {
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']![
|
FakeMatrixApi.api['GET'],
|
'/client/v3/directory/room/%23testalias%3Aexample.com']({}),
|
||||||
roomAliasInformation.toJson());
|
roomAliasInformation.toJson());
|
||||||
|
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
|
|
@ -828,7 +828,7 @@ void main() {
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']![
|
FakeMatrixApi.api['GET'],
|
'/client/v3/publicRooms?limit=10&since=1234&server=example.com']({}),
|
||||||
response.toJson());
|
response.toJson());
|
||||||
|
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
|
|
@ -850,7 +850,7 @@ void main() {
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi
|
FakeMatrixApi
|
||||||
.api['POST'],
|
.api['POST'],
|
||||||
response.toJson());
|
response.toJson());
|
||||||
|
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
|
|
@ -864,7 +864,7 @@ void main() {
|
||||||
limit: 10,
|
limit: 10,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(FakeMatrixApi.api['POST'],
|
expect(FakeMatrixApi.api['POST'],
|
||||||
response.toJson());
|
response.toJson());
|
||||||
|
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
|
|
@ -912,7 +912,7 @@ void main() {
|
||||||
final response = await matrixApi.getUserProfile('@alice:example.com');
|
final response = await matrixApi.getUserProfile('@alice:example.com');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi
|
FakeMatrixApi
|
||||||
.api['GET'],
|
.api['GET'],
|
||||||
response.toJson());
|
response.toJson());
|
||||||
|
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
|
|
@ -922,7 +922,7 @@ void main() {
|
||||||
matrixApi.accessToken = '1234';
|
matrixApi.accessToken = '1234';
|
||||||
|
|
||||||
final response = await matrixApi.getTurnServer();
|
final response = await matrixApi.getTurnServer();
|
||||||
expect(FakeMatrixApi.api['GET'],
|
expect(FakeMatrixApi.api['GET'],
|
||||||
response.toJson());
|
response.toJson());
|
||||||
|
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
|
|
@ -986,7 +986,7 @@ void main() {
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']![
|
FakeMatrixApi.api['GET'],
|
'/client/v3/presence/${Uri.encodeComponent('@alice:example.com')}/status']({}),
|
||||||
response.toJson());
|
response.toJson());
|
||||||
|
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
|
|
@ -1016,7 +1016,7 @@ void main() {
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']![
|
FakeMatrixApi.api['GET'],
|
'/media/v3/preview_url?url=https%3A%2F%2Fmatrix.org&ts=10']({}),
|
||||||
openGraphData.toJson());
|
openGraphData.toJson());
|
||||||
|
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
|
|
@ -1047,7 +1047,7 @@ void main() {
|
||||||
matrixApi.accessToken = '1234';
|
matrixApi.accessToken = '1234';
|
||||||
|
|
||||||
final devices = await matrixApi.getDevices();
|
final devices = await matrixApi.getDevices();
|
||||||
expect(FakeMatrixApi.api['GET']['devices'],
|
expect(FakeMatrixApi.api['GET']['devices'],
|
||||||
devices?.map((i) => i.toJson()).toList());
|
devices?.map((i) => i.toJson()).toList());
|
||||||
|
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
|
|
@ -1118,7 +1118,7 @@ void main() {
|
||||||
'Alices mobile phone');
|
'Alices mobile phone');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi
|
FakeMatrixApi
|
||||||
.api['POST'],
|
.api['POST'],
|
||||||
response.toJson());
|
response.toJson());
|
||||||
|
|
||||||
matrixApi.homeserver = matrixApi.accessToken = null;
|
matrixApi.homeserver = matrixApi.accessToken = null;
|
||||||
|
|
@ -1134,7 +1134,7 @@ void main() {
|
||||||
timeout: 10,
|
timeout: 10,
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['POST'] {
|
||||||
|
|
||||||
final response = await matrixApi.getPushers();
|
final response = await matrixApi.getPushers();
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET'],
|
FakeMatrixApi.api['GET'],
|
||||||
{'pushers': response?.map((i) => i.toJson()).toList()},
|
{'pushers': response?.map((i) => i.toJson()).toList()},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1231,7 +1231,7 @@ void main() {
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']![
|
FakeMatrixApi.api['GET'],
|
'/client/v3/notifications?from=1234&limit=10&only=1234']({}),
|
||||||
response.toJson(),
|
response.toJson(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1243,7 +1243,7 @@ void main() {
|
||||||
|
|
||||||
final response = await matrixApi.getPushRules();
|
final response = await matrixApi.getPushRules();
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET'],
|
FakeMatrixApi.api['GET'],
|
||||||
{'global': response.toJson()},
|
{'global': response.toJson()},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1257,7 +1257,7 @@ void main() {
|
||||||
await matrixApi.getPushRule('global', PushRuleKind.content, 'nocake');
|
await matrixApi.getPushRule('global', PushRuleKind.content, 'nocake');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi
|
FakeMatrixApi
|
||||||
.api['GET'],
|
.api['GET'],
|
||||||
response.toJson(),
|
response.toJson(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1357,7 +1357,7 @@ void main() {
|
||||||
from: '1234', roomId: '!1234', timeout: 10);
|
from: '1234', roomId: '!1234', timeout: 10);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']![
|
FakeMatrixApi.api['GET'],
|
'/client/v3/events?from=1234&timeout=10&room_id=%211234']({}),
|
||||||
response.toJson(),
|
response.toJson(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1371,7 +1371,7 @@ void main() {
|
||||||
'@alice:example.com', '!localpart:example.com');
|
'@alice:example.com', '!localpart:example.com');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']![
|
FakeMatrixApi.api['GET'],
|
'/client/v3/user/%40alice%3Aexample.com/rooms/!localpart%3Aexample.com/tags']({}),
|
||||||
{'tags': response?.map((k, v) => MapEntry(k, v.toJson()))},
|
{'tags': response?.map((k, v) => MapEntry(k, v.toJson()))},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1457,7 +1457,7 @@ void main() {
|
||||||
final response = await matrixApi.getWhoIs('@alice:example.com');
|
final response = await matrixApi.getWhoIs('@alice:example.com');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi
|
FakeMatrixApi
|
||||||
.api['GET'],
|
.api['GET'],
|
||||||
response.toJson(),
|
response.toJson(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1471,7 +1471,7 @@ void main() {
|
||||||
limit: 10, filter: '{}');
|
limit: 10, filter: '{}');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']![
|
FakeMatrixApi.api['GET'],
|
'/client/v3/rooms/1234/context/1234?limit=10&filter=%7B%7D']({}),
|
||||||
response.toJson(),
|
response.toJson(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1496,7 +1496,7 @@ void main() {
|
||||||
|
|
||||||
final response = await matrixApi.getProtocols();
|
final response = await matrixApi.getProtocols();
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET'],
|
FakeMatrixApi.api['GET'],
|
||||||
response.map((k, v) => MapEntry(k, v.toJson())),
|
response.map((k, v) => MapEntry(k, v.toJson())),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1508,7 +1508,7 @@ void main() {
|
||||||
|
|
||||||
final response = await matrixApi.getProtocolMetadata('irc');
|
final response = await matrixApi.getProtocolMetadata('irc');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET'],
|
FakeMatrixApi.api['GET'],
|
||||||
response.toJson(),
|
response.toJson(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1520,7 +1520,7 @@ void main() {
|
||||||
|
|
||||||
final response = await matrixApi.queryLocationByProtocol('irc');
|
final response = await matrixApi.queryLocationByProtocol('irc');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET'],
|
FakeMatrixApi.api['GET'],
|
||||||
response.map((i) => i.toJson()).toList(),
|
response.map((i) => i.toJson()).toList(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1532,7 +1532,7 @@ void main() {
|
||||||
|
|
||||||
final response = await matrixApi.queryUserByProtocol('irc');
|
final response = await matrixApi.queryUserByProtocol('irc');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET'],
|
FakeMatrixApi.api['GET'],
|
||||||
response.map((i) => i.toJson()).toList(),
|
response.map((i) => i.toJson()).toList(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1545,7 +1545,7 @@ void main() {
|
||||||
final response = await matrixApi.queryLocationByAlias('1234');
|
final response = await matrixApi.queryLocationByAlias('1234');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi
|
FakeMatrixApi
|
||||||
.api['GET'],
|
.api['GET'],
|
||||||
response.map((i) => i.toJson()).toList(),
|
response.map((i) => i.toJson()).toList(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1557,7 +1557,7 @@ void main() {
|
||||||
|
|
||||||
final response = await matrixApi.queryUserByID('1234');
|
final response = await matrixApi.queryUserByID('1234');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET'],
|
FakeMatrixApi.api['GET'],
|
||||||
response.map((i) => i.toJson()).toList(),
|
response.map((i) => i.toJson()).toList(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1570,7 +1570,7 @@ void main() {
|
||||||
final response = await matrixApi.requestOpenIdToken('1234', {});
|
final response = await matrixApi.requestOpenIdToken('1234', {});
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi
|
FakeMatrixApi
|
||||||
.api['POST'],
|
.api['POST'],
|
||||||
response.toJson(),
|
response.toJson(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1595,8 +1595,8 @@ void main() {
|
||||||
};
|
};
|
||||||
final ret = await matrixApi.postRoomKeysVersion(algorithm, authData);
|
final ret = await matrixApi.postRoomKeysVersion(algorithm, authData);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['POST']['version'],
|
.api['POST']['version'],
|
||||||
ret);
|
ret);
|
||||||
});
|
});
|
||||||
test('getRoomKeysVersionCurrent', () async {
|
test('getRoomKeysVersionCurrent', () async {
|
||||||
|
|
@ -1604,8 +1604,7 @@ void main() {
|
||||||
matrixApi.accessToken = '1234';
|
matrixApi.accessToken = '1234';
|
||||||
|
|
||||||
final ret = await matrixApi.getRoomKeysVersionCurrent();
|
final ret = await matrixApi.getRoomKeysVersionCurrent();
|
||||||
expect(
|
expect(FakeMatrixApi.api['GET'],
|
||||||
FakeMatrixApi.api['GET'],
|
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
test('putRoomKeysVersion', () async {
|
test('putRoomKeysVersion', () async {
|
||||||
|
|
@ -1625,7 +1624,7 @@ void main() {
|
||||||
|
|
||||||
await matrixApi.deleteRoomKeys('5');
|
await matrixApi.deleteRoomKeys('5');
|
||||||
});
|
});
|
||||||
test('putRoomKeysBySessionId', () async {
|
test('putRoomKeyBySessionId', () async {
|
||||||
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
||||||
matrixApi.accessToken = '1234';
|
matrixApi.accessToken = '1234';
|
||||||
|
|
||||||
|
|
@ -1642,37 +1641,36 @@ void main() {
|
||||||
'mac': 'QzKV/fgAs4U',
|
'mac': 'QzKV/fgAs4U',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
final ret = await matrixApi.putRoomKeysBySessionId(
|
final ret = await matrixApi.putRoomKeyBySessionId(
|
||||||
roomId, sessionId, '5', session);
|
roomId, sessionId, '5', session);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['PUT']![
|
FakeMatrixApi.api['PUT'],
|
'/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}/${Uri.encodeComponent('ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU')}?version=5']({}),
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
test('getRoomKeysBySessionId', () async {
|
test('getRoomKeyBySessionId', () async {
|
||||||
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
||||||
matrixApi.accessToken = '1234';
|
matrixApi.accessToken = '1234';
|
||||||
|
|
||||||
final roomId = '!726s6s6q:example.com';
|
final roomId = '!726s6s6q:example.com';
|
||||||
final sessionId = 'ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU';
|
final sessionId = 'ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU';
|
||||||
final ret =
|
final ret = await matrixApi.getRoomKeyBySessionId(roomId, sessionId, '5');
|
||||||
await matrixApi.getRoomKeysBySessionId(roomId, sessionId, '5');
|
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']![
|
FakeMatrixApi.api['GET'],
|
'/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}/${Uri.encodeComponent('ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU')}?version=5']({}),
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
test('deleteRoomKeysBySessionId', () async {
|
test('deleteRoomKeyBySessionId', () async {
|
||||||
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting');
|
||||||
matrixApi.accessToken = '1234';
|
matrixApi.accessToken = '1234';
|
||||||
|
|
||||||
final roomId = '!726s6s6q:example.com';
|
final roomId = '!726s6s6q:example.com';
|
||||||
final sessionId = 'ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU';
|
final sessionId = 'ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU';
|
||||||
final ret =
|
final ret =
|
||||||
await matrixApi.deleteRoomKeysBySessionId(roomId, sessionId, '5');
|
await matrixApi.deleteRoomKeyBySessionId(roomId, sessionId, '5');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['DELETE']![
|
FakeMatrixApi.api['DELETE'],
|
'/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}/${Uri.encodeComponent('ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU')}?version=5']({}),
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
test('putRoomKeysByRoomId', () async {
|
test('putRoomKeysByRoomId', () async {
|
||||||
|
|
@ -1699,7 +1697,7 @@ void main() {
|
||||||
final ret = await matrixApi.putRoomKeysByRoomId(roomId, '5', session);
|
final ret = await matrixApi.putRoomKeysByRoomId(roomId, '5', session);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['PUT']![
|
FakeMatrixApi.api['PUT'],
|
'/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}?version=5']({}),
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
test('getRoomKeysByRoomId', () async {
|
test('getRoomKeysByRoomId', () async {
|
||||||
|
|
@ -1710,7 +1708,7 @@ void main() {
|
||||||
final ret = await matrixApi.getRoomKeysByRoomId(roomId, '5');
|
final ret = await matrixApi.getRoomKeysByRoomId(roomId, '5');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['GET']![
|
FakeMatrixApi.api['GET'],
|
'/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}?version=5']({}),
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
test('deleteRoomKeysByRoomId', () async {
|
test('deleteRoomKeysByRoomId', () async {
|
||||||
|
|
@ -1721,7 +1719,7 @@ void main() {
|
||||||
final ret = await matrixApi.deleteRoomKeysByRoomId(roomId, '5');
|
final ret = await matrixApi.deleteRoomKeysByRoomId(roomId, '5');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi.api['DELETE']![
|
FakeMatrixApi.api['DELETE'],
|
'/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}?version=5']({}),
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
test('putRoomKeys', () async {
|
test('putRoomKeys', () async {
|
||||||
|
|
@ -1751,8 +1749,7 @@ void main() {
|
||||||
});
|
});
|
||||||
final ret = await matrixApi.putRoomKeys('5', session);
|
final ret = await matrixApi.putRoomKeys('5', session);
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi
|
FakeMatrixApi.api['PUT'],
|
||||||
.api['PUT'],
|
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
test('getRoomKeys', () async {
|
test('getRoomKeys', () async {
|
||||||
|
|
@ -1761,8 +1758,7 @@ void main() {
|
||||||
|
|
||||||
final ret = await matrixApi.getRoomKeys('5');
|
final ret = await matrixApi.getRoomKeys('5');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi
|
FakeMatrixApi.api['GET'],
|
||||||
.api['GET'],
|
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
test('deleteRoomKeys', () async {
|
test('deleteRoomKeys', () async {
|
||||||
|
|
@ -1772,7 +1768,7 @@ void main() {
|
||||||
final ret = await matrixApi.deleteRoomKeys('5');
|
final ret = await matrixApi.deleteRoomKeys('5');
|
||||||
expect(
|
expect(
|
||||||
FakeMatrixApi
|
FakeMatrixApi
|
||||||
.api['DELETE'],
|
.api['DELETE'],
|
||||||
ret.toJson());
|
ret.toJson());
|
||||||
});
|
});
|
||||||
test('AuthenticationData', () {
|
test('AuthenticationData', () {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue