chore: Make path configurable in uiaLogin
This commit is contained in:
parent
d09ed915bc
commit
d22c200b5c
|
|
@ -8,6 +8,8 @@ import 'package:matrix/matrix.dart';
|
||||||
extension UiaLogin on Client {
|
extension UiaLogin on Client {
|
||||||
/// Implementation of MSC2835:
|
/// Implementation of MSC2835:
|
||||||
/// https://github.com/Sorunome/matrix-doc/blob/soru/uia-on-login/proposals/2835-uia-on-login.md
|
/// https://github.com/Sorunome/matrix-doc/blob/soru/uia-on-login/proposals/2835-uia-on-login.md
|
||||||
|
/// Set `pathVersion` to `r0` if you need to use the previous
|
||||||
|
/// version of the login endpoint.
|
||||||
Future<LoginResponse> uiaLogin(
|
Future<LoginResponse> uiaLogin(
|
||||||
LoginType type, {
|
LoginType type, {
|
||||||
String? address,
|
String? address,
|
||||||
|
|
@ -19,8 +21,9 @@ extension UiaLogin on Client {
|
||||||
String? token,
|
String? token,
|
||||||
String? user,
|
String? user,
|
||||||
AuthenticationData? auth,
|
AuthenticationData? auth,
|
||||||
|
String pathVersion = 'v3',
|
||||||
}) async {
|
}) async {
|
||||||
final requestUri = Uri(path: '_matrix/client/v3/login');
|
final requestUri = Uri(path: '_matrix/client/$pathVersion/login');
|
||||||
final request = Request('POST', baseUri!.resolveUri(requestUri));
|
final request = Request('POST', baseUri!.resolveUri(requestUri));
|
||||||
request.headers['content-type'] = 'application/json';
|
request.headers['content-type'] = 'application/json';
|
||||||
request.bodyBytes = utf8.encode(jsonEncode({
|
request.bodyBytes = utf8.encode(jsonEncode({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue