From 3eaf4ef99abce41452c7f3fc5ca8460a2b64fb67 Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Fri, 7 May 2021 13:43:06 +0200 Subject: [PATCH] feat!: operation names from OpenAPI spec --- lib/src/matrix_api.dart | 154 ++++++++++++++++++------------------ test/matrix_api_test.dart | 162 +++++++++++++++++++------------------- 2 files changed, 157 insertions(+), 159 deletions(-) diff --git a/lib/src/matrix_api.dart b/lib/src/matrix_api.dart index 07d59273..9e601ef7 100644 --- a/lib/src/matrix_api.dart +++ b/lib/src/matrix_api.dart @@ -219,7 +219,7 @@ class MatrixApi { /// Gets the versions of the specification supported by the server. /// https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-versions - Future requestSupportedVersions() async { + Future getVersions() async { final response = await request( RequestType.GET, '/client/versions', @@ -229,14 +229,14 @@ class MatrixApi { /// Gets discovery information about the domain. The file may include additional keys. /// https://matrix.org/docs/spec/client_server/r0.6.0#get-well-known-matrix-client - Future requestWellKnownInformation() async { + Future getWellknown() async { final response = await httpClient.get(homeserver.resolve('.well-known/matrix/client')); final rawJson = json.decode(response.body); return WellKnownInformation.fromJson(rawJson); } - Future requestLoginTypes() async { + Future getLoginFlows() async { final response = await request( RequestType.GET, '/client/r0/login', @@ -473,7 +473,7 @@ class MatrixApi { ); } - Future usernameAvailable(String username) async { + Future checkUsernameAvailability(String username) async { final response = await request( RequestType.GET, '/client/r0/register/available', @@ -487,7 +487,7 @@ class MatrixApi { /// Gets a list of the third party identifiers that the homeserver has /// associated with the user's account. /// https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-register-available - Future> requestThirdPartyIdentifiers() async { + Future> getAccount3PIDs() async { final response = await request( RequestType.GET, '/client/r0/account/3pid', @@ -501,7 +501,7 @@ class MatrixApi { /// should use 3PIDs added through this endpoint for password resets /// instead of relying on the identity server. /// https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-account-3pid-add - Future addThirdPartyIdentifier( + Future add3PID( String clientSecret, String sid, { AuthenticationData auth, @@ -516,7 +516,7 @@ class MatrixApi { /// Binds a 3PID to the user's account through the specified identity server. /// https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-account-3pid-bind - Future bindThirdPartyIdentifier( + Future bind3PID( String clientSecret, String sid, String idServer, @@ -533,7 +533,7 @@ class MatrixApi { /// Removes a third party identifier from the user's account. This might not cause an unbind of the identifier from the identity server. /// https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-account-3pid-delete - Future deleteThirdPartyIdentifier( + Future delete3pidFromAccount( String address, ThirdPartyIdentifierMedium medium, { String idServer, @@ -552,7 +552,7 @@ class MatrixApi { /// Removes a user's third party identifier from the provided identity server without removing it from the homeserver. /// https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-account-3pid-unbind - Future unbindThirdPartyIdentifier( + Future unbind3pidFromAccount( String address, ThirdPartyIdentifierMedium medium, String idServer, @@ -619,7 +619,7 @@ class MatrixApi { /// Gets information about the owner of a given access token. /// https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-account-whoami - Future whoAmI() async { + Future getTokenOwner() async { final response = await request( RequestType.GET, '/client/r0/account/whoami', @@ -629,7 +629,7 @@ class MatrixApi { /// Gets information about the server's supported feature set and other relevant capabilities. /// https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-capabilities - Future requestServerCapabilities() async { + Future getCapabilities() async { final response = await request( RequestType.GET, '/client/r0/capabilities', @@ -640,7 +640,7 @@ class MatrixApi { /// Uploads a new filter definition to the homeserver. Returns a filter ID that may be used /// in future requests to restrict which events are returned to the client. /// https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-user-userid-filter - Future uploadFilter( + Future defineFilter( String userId, Filter filter, ) async { @@ -654,7 +654,7 @@ class MatrixApi { /// Download a filter /// https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-user-userid-filter - Future downloadFilter(String userId, String filterId) async { + Future getFilter(String userId, String filterId) async { final response = await request( RequestType.GET, '/client/r0/user/${Uri.encodeComponent(userId)}/filter/${Uri.encodeComponent(filterId)}', @@ -690,7 +690,7 @@ class MatrixApi { /// Get a single event based on roomId/eventId. You must have permission to /// retrieve this event e.g. by being a member in the room for this event. /// https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-rooms-roomid-event-eventid - Future requestEvent(String roomId, String eventId) async { + Future getOneRoomEvent(String roomId, String eventId) async { final response = await request( RequestType.GET, '/client/r0/rooms/${Uri.encodeComponent(roomId)}/event/${Uri.encodeComponent(eventId)}', @@ -719,7 +719,7 @@ class MatrixApi { /// Get the state events for the current state of a room. /// https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-rooms-roomid-state - Future> requestStates(String roomId) async { + Future> getRoomState(String roomId) async { final response = await request( RequestType.GET, '/client/r0/rooms/${Uri.encodeComponent(roomId)}/state', @@ -731,7 +731,7 @@ class MatrixApi { /// Get the list of members for this room. /// https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-rooms-roomid-members - Future> requestMembers( + Future> getMembersByRoom( String roomId, { String at, Membership membership, @@ -754,7 +754,7 @@ class MatrixApi { /// This API returns a map of MXIDs to member info objects for members of the room. /// https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-rooms-roomid-joined-members - Future> requestJoinedMembers(String roomId) async { + Future> getJoinedMembersByRoom(String roomId) async { final response = await request( RequestType.GET, '/client/r0/rooms/${Uri.encodeComponent(roomId)}/joined_members', @@ -767,7 +767,7 @@ class MatrixApi { /// This API returns a list of message and state events for a room. It uses pagination query /// parameters to paginate history in the room. /// https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-rooms-roomid-messages - Future requestMessages( + Future getRoomEvents( String roomId, String from, Direction dir, { @@ -789,7 +789,7 @@ class MatrixApi { /// State events can be sent using this endpoint. /// https://matrix.org/docs/spec/client_server/r0.6.0#put-matrix-client-r0-rooms-roomid-state-eventtype-statekey - Future sendState( + Future setRoomStateWithKey( String roomId, String eventType, Map content, [ @@ -820,7 +820,7 @@ class MatrixApi { /// Strips all information out of an event which isn't critical to the integrity of /// the server-side representation of the room. /// https://matrix.org/docs/spec/client_server/r0.6.0#put-matrix-client-r0-rooms-roomid-redact-eventid-txnid - Future redact( + Future redactEvent( String roomId, String eventId, String txnId, { @@ -869,7 +869,7 @@ class MatrixApi { /// Create a new mapping from room alias to room ID. /// https://matrix.org/docs/spec/client_server/r0.6.1#put-matrix-client-r0-directory-room-roomalias - Future createRoomAlias(String alias, String roomId) async { + Future setRoomAlias(String alias, String roomId) async { await request( RequestType.PUT, '/client/r0/directory/room/${Uri.encodeComponent(alias)}', @@ -880,7 +880,7 @@ class MatrixApi { /// Requests that the server resolve a room alias to a room ID. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-directory-room-roomalias - Future requestRoomAliasInformation(String alias) async { + Future getRoomIdByAlias(String alias) async { final response = await request( RequestType.GET, '/client/r0/directory/room/${Uri.encodeComponent(alias)}', @@ -890,7 +890,7 @@ class MatrixApi { /// Remove a mapping of room alias to room ID. /// https://matrix.org/docs/spec/client_server/r0.6.1#delete-matrix-client-r0-directory-room-roomalias - Future removeRoomAlias(String alias) async { + Future deleteRoomAlias(String alias) async { await request( RequestType.DELETE, '/client/r0/directory/room/${Uri.encodeComponent(alias)}', @@ -900,7 +900,7 @@ class MatrixApi { /// Get a list of aliases maintained by the local server for the given room. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-rooms-roomid-aliases - Future> requestRoomAliases(String roomId) async { + Future> getLocalAliases(String roomId) async { final response = await request( RequestType.GET, '/client/r0/rooms/${Uri.encodeComponent(roomId)}/aliases', @@ -910,7 +910,7 @@ class MatrixApi { /// This API returns a list of the user's current rooms. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-joined-rooms - Future> requestJoinedRooms() async { + Future> getJoinedRooms() async { final response = await request( RequestType.GET, '/client/r0/joined_rooms', @@ -933,7 +933,7 @@ class MatrixApi { /// This API starts a user participating in a particular room, if that user is allowed to participate in that room. /// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-rooms-roomid-invite - Future joinRoom( + Future joinRoomById( String roomId, { String thirdPidSignedSender, String thirdPidSignedmxid, @@ -958,7 +958,7 @@ class MatrixApi { /// This API starts a user participating in a particular room, if that user is allowed to participate in that room. /// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-join-roomidoralias - Future joinRoomOrAlias( + Future joinRoom( String roomIdOrAlias, { List servers, String thirdPidSignedSender, @@ -1006,8 +1006,7 @@ class MatrixApi { /// Kick a user from the room. /// The caller must have the required power level in order to perform this operation. /// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-rooms-roomid-kick - Future kickFromRoom(String roomId, String userId, - {String reason}) async { + Future kick(String roomId, String userId, {String reason}) async { await request(RequestType.POST, '/client/r0/rooms/${Uri.encodeComponent(roomId)}/kick', data: { @@ -1019,8 +1018,7 @@ class MatrixApi { /// Ban a user in the room. If the user is currently in the room, also kick them. /// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-rooms-roomid-ban - Future banFromRoom(String roomId, String userId, - {String reason}) async { + Future ban(String roomId, String userId, {String reason}) async { await request( RequestType.POST, '/client/r0/rooms/${Uri.encodeComponent(roomId)}/ban', data: { @@ -1033,7 +1031,7 @@ class MatrixApi { /// Unban a user from the room. This allows them to be invited to the room, and join if they /// would otherwise be allowed to join according to its join rules. /// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-rooms-roomid-unban - Future unbanInRoom(String roomId, String userId) async { + Future unban(String roomId, String userId) async { await request(RequestType.POST, '/client/r0/rooms/${Uri.encodeComponent(roomId)}/unban', data: { @@ -1044,7 +1042,7 @@ class MatrixApi { /// Gets the visibility of a given room on the server's public room directory. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-directory-list-room-roomid - Future requestRoomVisibility(String roomId) async { + Future getRoomVisibilityOnDirectory(String roomId) async { final response = await request( RequestType.GET, '/client/r0/directory/list/room/${Uri.encodeComponent(roomId)}', @@ -1055,7 +1053,8 @@ class MatrixApi { /// Sets the visibility of a given room in the server's public room directory. /// https://matrix.org/docs/spec/client_server/r0.6.1#put-matrix-client-r0-directory-list-room-roomid - Future setRoomVisibility(String roomId, Visibility visibility) async { + Future setRoomVisibilityOnDirectory( + String roomId, Visibility visibility) async { await request( RequestType.PUT, '/client/r0/directory/list/room/${Uri.encodeComponent(roomId)}', @@ -1068,7 +1067,7 @@ class MatrixApi { /// Lists the public rooms on the server. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-publicrooms - Future requestPublicRooms({ + Future getPublicRooms({ int limit, String since, String server, @@ -1087,7 +1086,7 @@ class MatrixApi { /// Lists the public rooms on the server, with optional filter. /// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-publicrooms - Future searchPublicRooms({ + Future queryPublicRooms({ String genericSearchTerm, int limit, String since, @@ -1122,7 +1121,7 @@ class MatrixApi { /// room with and those who reside in public rooms (known to the homeserver). The search MUST /// consider local users to the homeserver, and SHOULD query remote users as part of the search. /// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-user-directory-search - Future searchUser( + Future searchUserDirectory( String searchTerm, { int limit, }) async { @@ -1140,7 +1139,7 @@ class MatrixApi { /// This API sets the given user's display name. You must have permission to /// set this user's display name, e.g. you need to have their access_token. /// https://matrix.org/docs/spec/client_server/r0.6.1#put-matrix-client-r0-profile-userid-displayname - Future setDisplayname(String userId, String displayname) async { + Future setDisplayName(String userId, String displayname) async { await request( RequestType.PUT, '/client/r0/profile/${Uri.encodeComponent(userId)}/displayname', @@ -1154,7 +1153,7 @@ class MatrixApi { /// Get the user's display name. This API may be used to fetch the user's own /// displayname or to query the name of other users; either locally or on remote homeservers. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-profile-userid-displayname - Future requestDisplayname(String userId) async { + Future getDisplayName(String userId) async { final response = await request( RequestType.GET, '/client/r0/profile/${Uri.encodeComponent(userId)}/displayname', @@ -1179,7 +1178,7 @@ class MatrixApi { /// Get the user's avatar URL. This API may be used to fetch the user's own avatar URL or to /// query the URL of other users; either locally or on remote homeservers. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-profile-userid-avatar-url - Future requestAvatarUrl(String userId) async { + Future getAvatarUrl(String userId) async { final response = await request( RequestType.GET, '/client/r0/profile/${Uri.encodeComponent(userId)}/avatar_url', @@ -1190,7 +1189,7 @@ class MatrixApi { /// Get the combined profile information for this user. This API may be used to fetch the user's /// own profile information or other users; either locally or on remote homeservers. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-profile-userid-avatar-url - Future requestProfile(String userId) async { + Future getUserProfile(String userId) async { final response = await request( RequestType.GET, '/client/r0/profile/${Uri.encodeComponent(userId)}', @@ -1200,7 +1199,7 @@ class MatrixApi { /// This API provides credentials for the client to use when initiating calls. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-voip-turnserver - Future requestTurnServerCredentials() async { + Future getTurnServer() async { final response = await request( RequestType.GET, '/client/r0/voip/turnServer', @@ -1212,7 +1211,7 @@ class MatrixApi { /// where N is the value specified in the timeout key. Alternatively, if typing is false, /// it tells the server that the user has stopped typing. /// https://matrix.org/docs/spec/client_server/r0.6.1#put-matrix-client-r0-rooms-roomid-typing-userid - Future sendTypingNotification( + Future setTyping( String userId, String roomId, bool typing, { @@ -1230,7 +1229,7 @@ class MatrixApi { /// This API updates the marker for the given receipt type to the event ID specified. /// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-rooms-roomid-receipt-receipttype-eventid /// - Future sendReceiptMarker(String roomId, String eventId) async { + Future postReceipt(String roomId, String eventId) async { await request( RequestType.POST, '/client/r0/rooms/${Uri.encodeComponent(roomId)}/receipt/m.read/${Uri.encodeComponent(eventId)}', @@ -1240,7 +1239,7 @@ class MatrixApi { /// Sets the position of the read marker for a given room, and optionally the read receipt's location. /// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-rooms-roomid-read-markers - Future sendReadMarker(String roomId, String eventId, + Future setReadMarker(String roomId, String eventId, {String readReceiptLocationEventId}) async { await request( RequestType.POST, @@ -1258,7 +1257,7 @@ class MatrixApi { /// the activity time is updated to reflect that activity; the client does not need /// to specify the last_active_ago field. You cannot set the presence state of another user. /// https://matrix.org/docs/spec/client_server/r0.6.1#put-matrix-client-r0-presence-userid-status - Future sendPresence( + Future setPresence( String userId, PresenceType presenceType, { String statusMsg, @@ -1276,7 +1275,7 @@ class MatrixApi { /// Get the given user's presence state. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-presence-userid-status - Future requestPresence(String userId) async { + Future getPresence(String userId) async { final response = await request( RequestType.GET, '/client/r0/presence/${Uri.encodeComponent(userId)}/status', @@ -1287,7 +1286,7 @@ class MatrixApi { /// Uploads a file with the name [fileName] as base64 encoded to the server /// and returns the mxc url as a string. /// https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-media-r0-upload - Future upload(Uint8List file, String fileName, + Future uploadContent(Uint8List file, String fileName, {String contentType}) async { fileName = fileName.split('/').last; final length = file.length; @@ -1324,7 +1323,7 @@ class MatrixApi { /// Get information about a URL for the client. Typically this is called when a client sees a /// URL in a message and wants to render a preview for the user. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-media-r0-preview-url - Future requestOpenGraphDataForUrl(Uri url, {int ts}) async { + Future getUrlPreview(Uri url, {int ts}) async { final action = homeserver .resolveUri(Uri(path: '_matrix/media/r0/preview_url', queryParameters: { 'url': url.toString(), @@ -1337,7 +1336,7 @@ class MatrixApi { /// This endpoint allows clients to retrieve the configuration of the content repository, such as upload limitations. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-media-r0-config - Future requestMaxUploadSize() async { + Future getConfig() async { final action = homeserver.resolve('_matrix/media/r0/config'); final response = await httpClient.get(action); final rawJson = json.decode(response.body.isEmpty ? '{}' : response.body); @@ -1363,7 +1362,7 @@ class MatrixApi { /// Gets information about all devices for the current user. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-devices - Future> requestDevices() async { + Future> getDevices() async { final response = await request( RequestType.GET, '/client/r0/devices', @@ -1375,7 +1374,7 @@ class MatrixApi { /// Gets information on a single device, by device id. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-devices-deviceid - Future requestDevice(String deviceId) async { + Future getDevice(String deviceId) async { final response = await request( RequestType.GET, '/client/r0/devices/${Uri.encodeComponent(deviceId)}', @@ -1385,7 +1384,7 @@ class MatrixApi { /// Updates the metadata on the given device. /// https://matrix.org/docs/spec/client_server/r0.6.1#put-matrix-client-r0-devices-deviceid - Future setDeviceMetadata(String deviceId, {String displayName}) async { + Future updateDevice(String deviceId, {String displayName}) async { await request( RequestType.PUT, '/client/r0/devices/${Uri.encodeComponent(deviceId)}', data: { @@ -1418,7 +1417,7 @@ class MatrixApi { /// Publishes end-to-end encryption keys for the device. /// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-keys-query - Future> uploadDeviceKeys( + Future> uploadKeys( {MatrixDeviceKeys deviceKeys, Map oneTimeKeys, Map fallbackKeys}) async { @@ -1439,7 +1438,7 @@ class MatrixApi { /// Returns the current devices and identity keys for the given users. /// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-keys-query - Future requestDeviceKeys( + Future queryKeys( Map deviceKeys, { int timeout, String token, @@ -1458,7 +1457,7 @@ class MatrixApi { /// Claims one-time keys for use in pre-key messages. /// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-keys-claim - Future requestOneTimeKeys( + Future claimKeys( Map> oneTimeKeys, { int timeout, }) async { @@ -1475,8 +1474,7 @@ class MatrixApi { /// Gets a list of users who have updated their device identity keys since a previous sync token. /// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-keys-upload - Future requestDeviceListsUpdate( - String from, String to) async { + Future getKeysChanges(String from, String to) async { final response = await request(RequestType.GET, '/client/r0/keys/changes', query: { 'from': from, @@ -1538,7 +1536,7 @@ class MatrixApi { /// Gets all currently active pushers for the authenticated user. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-pushers - Future> requestPushers() async { + Future> getPushers() async { final response = await request( RequestType.GET, '/client/r0/pushers', @@ -1552,7 +1550,7 @@ class MatrixApi { /// for this user ID. The behaviour of this endpoint varies depending on the /// values in the JSON body. /// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-pushers-set - Future setPusher(Pusher pusher, {bool append}) async { + Future postPusher(Pusher pusher, {bool append}) async { final data = pusher.toJson(); if (append != null) { data['append'] = append; @@ -1568,7 +1566,7 @@ class MatrixApi { /// This API is used to paginate through the list of events that the user has /// been, or would have been notified about. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-notifications - Future requestNotifications({ + Future getNotifications({ String from, int limit, String only, @@ -1589,7 +1587,7 @@ class MatrixApi { /// on the rulesets by suffixing a scope to this path e.g. /pushrules/global/. /// This will return a subset of this data under the specified key e.g. the global key. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-pushrules - Future requestPushRules() async { + Future getPushRules() async { final response = await request( RequestType.GET, '/client/r0/pushrules', @@ -1599,7 +1597,7 @@ class MatrixApi { /// Retrieve a single specified push rule. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-pushrules-scope-kind-ruleid - Future requestPushRule( + Future getPushRule( String scope, PushRuleKind kind, String ruleId, @@ -1655,7 +1653,7 @@ class MatrixApi { /// This endpoint gets whether the specified push rule is enabled. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-pushrules-scope-kind-ruleid-enabled - Future requestPushRuleEnabled( + Future isPushRuleEnabled( String scope, PushRuleKind kind, String ruleId, @@ -1669,7 +1667,7 @@ class MatrixApi { /// This endpoint allows clients to enable or disable the specified push rule. /// https://matrix.org/docs/spec/client_server/r0.6.1#put-matrix-client-r0-pushrules-scope-kind-ruleid-enabled - Future enablePushRule( + Future setPushRuleEnabled( String scope, PushRuleKind kind, String ruleId, @@ -1685,7 +1683,7 @@ class MatrixApi { /// This endpoint get the actions for the specified push rule. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-pushrules-scope-kind-ruleid-actions - Future> requestPushRuleActions( + Future> getPushRuleActions( String scope, PushRuleKind kind, String ruleId, @@ -1720,7 +1718,7 @@ class MatrixApi { /// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-search /// Please note: The specification is not 100% clear what it is expecting and sending here. /// So we stick with pure json until we have more information. - Future> globalSearch(Map query) async { + Future> search(Map query) async { return await request( RequestType.POST, '/client/r0/search', @@ -1731,7 +1729,7 @@ class MatrixApi { /// This will listen for new events related to a particular room and return them to the /// caller. This will block until an event is received, or until the timeout is reached. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-events - Future requestEvents({ + Future getEvents({ String from, int timeout, String roomId, @@ -1747,7 +1745,7 @@ class MatrixApi { /// List the tags set by a user on a room. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-user-userid-rooms-roomid-tags - Future> requestRoomTags(String userId, String roomId) async { + Future> getRoomTags(String userId, String roomId) async { final response = await request( RequestType.GET, '/client/r0/user/${Uri.encodeComponent(userId)}/rooms/${Uri.encodeComponent(roomId)}/tags', @@ -1759,7 +1757,7 @@ class MatrixApi { /// Add a tag to the room. /// https://matrix.org/docs/spec/client_server/r0.6.1#put-matrix-client-r0-user-userid-rooms-roomid-tags-tag - Future addRoomTag( + Future setRoomTag( String userId, String roomId, String tag, { @@ -1775,7 +1773,7 @@ class MatrixApi { /// Remove a tag from the room. /// https://matrix.org/docs/spec/client_server/r0.6.1#put-matrix-client-r0-user-userid-rooms-roomid-tags-tag - Future removeRoomTag(String userId, String roomId, String tag) async { + Future deleteRoomTag(String userId, String roomId, String tag) async { await request( RequestType.DELETE, '/client/r0/user/${Uri.encodeComponent(userId)}/rooms/${Uri.encodeComponent(roomId)}/tags/${Uri.encodeComponent(tag)}', @@ -1801,7 +1799,7 @@ class MatrixApi { /// Get some account_data for the client. This config is only visible to the user that set the account_data. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-user-userid-account-data-type - Future> requestAccountData( + Future> getAccountData( String userId, String type, ) async { @@ -1814,7 +1812,7 @@ class MatrixApi { /// Set some account_data for the client on a given room. This config is only visible to the user that set /// the account_data. The config will be synced to clients in the per-room account_data. /// https://matrix.org/docs/spec/client_server/r0.6.1#put-matrix-client-r0-user-userid-rooms-roomid-account-data-type - Future setRoomAccountData( + Future setAccountDataPerRoom( String userId, String roomId, String type, @@ -1830,7 +1828,7 @@ class MatrixApi { /// Get some account_data for the client on a given room. This config is only visible to the user that set the account_data. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-user-userid-rooms-roomid-account-data-type - Future> requestRoomAccountData( + Future> getAccountDataPerRoom( String userId, String roomId, String type, @@ -1843,7 +1841,7 @@ class MatrixApi { /// Gets information about a particular user. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-admin-whois-userid - Future requestWhoIsInfo(String userId) async { + Future getWhoIs(String userId) async { final response = await request( RequestType.GET, '/client/r0/admin/whois/${Uri.encodeComponent(userId)}', @@ -1854,7 +1852,7 @@ class MatrixApi { /// This API returns a number of events that happened just before and after the specified event. /// This allows clients to get the context surrounding an event. /// https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-rooms-roomid-context-eventid - Future requestEventContext( + Future getEventContext( String roomId, String eventId, { int limit, @@ -1871,7 +1869,7 @@ class MatrixApi { /// Reports an event as inappropriate to the server, which may then notify the appropriate people. /// https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-rooms-roomid-report-eventid - Future reportEvent( + Future reportContent( String roomId, String eventId, String reason, @@ -1961,7 +1959,7 @@ class MatrixApi { .toList(); } - Future requestOpenIdCredentials(String userId) async { + Future requestOpenIdToken(String userId) async { final response = await request( RequestType.POST, '/client/r0/user/${Uri.encodeComponent(userId)}/openid/request_token', diff --git a/test/matrix_api_test.dart b/test/matrix_api_test.dart index c25f8430..31b54564 100644 --- a/test/matrix_api_test.dart +++ b/test/matrix_api_test.dart @@ -122,7 +122,7 @@ void main() { }); test('getSupportedVersions', () async { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); - final supportedVersions = await matrixApi.requestSupportedVersions(); + final supportedVersions = await matrixApi.getVersions(); expect(supportedVersions.versions.contains('r0.5.0'), true); expect(supportedVersions.unstableFeatures['m.lazy_load_members'], true); expect(FakeMatrixApi.api['GET']['/client/versions']({}), @@ -131,8 +131,7 @@ void main() { }); test('getWellKnownInformation', () async { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); - final wellKnownInformation = - await matrixApi.requestWellKnownInformation(); + final wellKnownInformation = await matrixApi.getWellknown(); expect(wellKnownInformation.mHomeserver.baseUrl, 'https://fakeserver.notexisting'); expect(wellKnownInformation.toJson(), { @@ -147,7 +146,7 @@ void main() { }); test('getLoginTypes', () async { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); - final loginTypes = await matrixApi.requestLoginTypes(); + final loginTypes = await matrixApi.getLoginFlows(); expect(loginTypes.flows.first.type, 'm.login.password'); expect(FakeMatrixApi.api['GET']['/client/r0/login']({}), loginTypes.toJson()); @@ -273,14 +272,15 @@ void main() { }); test('usernameAvailable', () async { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); - final loginResponse = await matrixApi.usernameAvailable('testuser'); + final loginResponse = + await matrixApi.checkUsernameAvailability('testuser'); expect(loginResponse, true); matrixApi.homeserver = null; }); test('getThirdPartyIdentifiers', () async { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestThirdPartyIdentifiers(); + final response = await matrixApi.getAccount3PIDs(); expect(FakeMatrixApi.api['GET']['/client/r0/account/3pid']({}), {'threepids': response.map((t) => t.toJson()).toList()}); matrixApi.homeserver = matrixApi.accessToken = null; @@ -288,14 +288,14 @@ void main() { test('addThirdPartyIdentifier', () async { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.addThirdPartyIdentifier('1234', '1234', + await matrixApi.add3PID('1234', '1234', auth: AuthenticationData.fromJson({'type': 'm.login.dummy'})); matrixApi.homeserver = matrixApi.accessToken = null; }); test('bindThirdPartyIdentifier', () async { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.bindThirdPartyIdentifier( + await matrixApi.bind3PID( '1234', '1234', 'https://example.com', @@ -306,7 +306,7 @@ void main() { test('deleteThirdPartyIdentifier', () async { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.deleteThirdPartyIdentifier( + final response = await matrixApi.delete3pidFromAccount( 'alice@example.com', ThirdPartyIdentifierMedium.email, idServer: 'https://example.com', @@ -317,7 +317,7 @@ void main() { test('unbindThirdPartyIdentifier', () async { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.unbindThirdPartyIdentifier( + final response = await matrixApi.unbind3pidFromAccount( 'alice@example.com', ThirdPartyIdentifierMedium.email, 'https://example.com', @@ -355,14 +355,14 @@ void main() { test('requestMsisdnValidationToken', () async { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.whoAmI(); + final response = await matrixApi.getTokenOwner(); expect(response, 'alice@example.com'); matrixApi.homeserver = matrixApi.accessToken = null; }); test('getServerCapabilities', () async { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestServerCapabilities(); + final response = await matrixApi.getCapabilities(); expect(FakeMatrixApi.api['GET']['/client/r0/capabilities']({}), {'capabilities': response.toJson()}); matrixApi.homeserver = matrixApi.accessToken = null; @@ -371,7 +371,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; final response = - await matrixApi.uploadFilter('alice@example.com', Filter()); + await matrixApi.defineFilter('alice@example.com', Filter()); expect(response, '1234'); final filter = Filter( room: RoomFilter( @@ -442,7 +442,7 @@ void main() { 'not_senders': ['@alice:example.com'] }, }); - await matrixApi.uploadFilter( + await matrixApi.defineFilter( 'alice@example.com', filter, ); @@ -481,7 +481,7 @@ void main() { test('downloadFilter', () async { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.downloadFilter('alice@example.com', '1234'); + await matrixApi.getFilter('alice@example.com', '1234'); matrixApi.homeserver = matrixApi.accessToken = null; }); test('sync', () async { @@ -506,7 +506,7 @@ void main() { matrixApi.accessToken = '1234'; final event = - await matrixApi.requestEvent('!localpart:server.abc', '1234'); + await matrixApi.getOneRoomEvent('!localpart:server.abc', '1234'); expect(event.eventId, '143273582443PhrSn:example.org'); matrixApi.homeserver = matrixApi.accessToken = null; }); @@ -525,7 +525,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final states = await matrixApi.requestStates('!localpart:server.abc'); + final states = await matrixApi.getRoomState('!localpart:server.abc'); expect(states.length, 4); matrixApi.homeserver = matrixApi.accessToken = null; @@ -534,7 +534,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final states = await matrixApi.requestMembers( + final states = await matrixApi.getMembersByRoom( '!localpart:server.abc', at: '1234', membership: Membership.join, @@ -548,7 +548,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final states = await matrixApi.requestJoinedMembers( + final states = await matrixApi.getJoinedMembersByRoom( '!localpart:server.abc', ); expect(states.length, 1); @@ -563,7 +563,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final timelineHistoryResponse = await matrixApi.requestMessages( + final timelineHistoryResponse = await matrixApi.getRoomEvents( '!localpart:server.abc', '1234', Direction.b, @@ -584,7 +584,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final eventId = await matrixApi.sendState( + final eventId = await matrixApi.setRoomStateWithKey( '!localpart:server.abc', 'm.room.avatar', {'url': 'mxc://1234'}); expect(eventId, 'YUwRidLecu:example.com'); @@ -610,7 +610,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final eventId = await matrixApi.redact( + final eventId = await matrixApi.redactEvent( '!localpart:server.abc', '1234', '1234', @@ -648,7 +648,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.createRoomAlias( + await matrixApi.setRoomAlias( '#testalias:example.com', '!1234:example.com', ); @@ -659,7 +659,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final roomAliasInformation = await matrixApi.requestRoomAliasInformation( + final roomAliasInformation = await matrixApi.getRoomIdByAlias( '#testalias:example.com', ); @@ -674,7 +674,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.removeRoomAlias('#testalias:example.com'); + await matrixApi.deleteRoomAlias('#testalias:example.com'); matrixApi.homeserver = matrixApi.accessToken = null; }); @@ -682,7 +682,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final list = await matrixApi.requestRoomAliases('!localpart:example.com'); + final list = await matrixApi.getLocalAliases('!localpart:example.com'); expect(list.length, 3); matrixApi.homeserver = matrixApi.accessToken = null; @@ -691,7 +691,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final list = await matrixApi.requestJoinedRooms(); + final list = await matrixApi.getJoinedRooms(); expect(list.length, 1); matrixApi.homeserver = matrixApi.accessToken = null; @@ -710,7 +710,7 @@ void main() { matrixApi.accessToken = '1234'; final roomId = '!localpart:example.com'; - final response = await matrixApi.joinRoom( + final response = await matrixApi.joinRoomById( roomId, thirdPidSignedSender: '@bob:example.com', thirdPidSignedmxid: '@alice:example.com', @@ -728,7 +728,7 @@ void main() { matrixApi.accessToken = '1234'; final roomId = '!localpart:example.com'; - final response = await matrixApi.joinRoomOrAlias( + final response = await matrixApi.joinRoom( roomId, servers: ['example.com', 'example.abc'], thirdPidSignedSender: '@bob:example.com', @@ -762,7 +762,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.kickFromRoom( + await matrixApi.kick( '!localpart:example.com', '@bob:example.com', reason: 'test', @@ -774,7 +774,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.banFromRoom( + await matrixApi.ban( '!localpart:example.com', '@bob:example.com', reason: 'test', @@ -786,7 +786,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.unbanInRoom( + await matrixApi.unban( '!localpart:example.com', '@bob:example.com', ); @@ -797,8 +797,8 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final visibility = - await matrixApi.requestRoomVisibility('!localpart:example.com'); + final visibility = await matrixApi + .getRoomVisibilityOnDirectory('!localpart:example.com'); expect(visibility, Visibility.public); matrixApi.homeserver = matrixApi.accessToken = null; @@ -807,7 +807,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.setRoomVisibility( + await matrixApi.setRoomVisibilityOnDirectory( '!localpart:example.com', Visibility.private); matrixApi.homeserver = matrixApi.accessToken = null; @@ -816,7 +816,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestPublicRooms( + final response = await matrixApi.getPublicRooms( limit: 10, since: '1234', server: 'example.com', @@ -833,7 +833,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.searchPublicRooms( + final response = await matrixApi.queryPublicRooms( limit: 10, since: '1234', server: 'example.com', @@ -853,7 +853,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.searchUser( + final response = await matrixApi.searchUserDirectory( 'test', limit: 10, ); @@ -867,7 +867,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.setDisplayname('@alice:example.com', 'Alice M'); + await matrixApi.setDisplayName('@alice:example.com', 'Alice M'); matrixApi.homeserver = matrixApi.accessToken = null; }); @@ -875,7 +875,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.requestDisplayname('@alice:example.com'); + await matrixApi.getDisplayName('@alice:example.com'); matrixApi.homeserver = matrixApi.accessToken = null; }); @@ -894,7 +894,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestAvatarUrl('@alice:example.com'); + final response = await matrixApi.getAvatarUrl('@alice:example.com'); expect(response, Uri.parse('mxc://test')); matrixApi.homeserver = matrixApi.accessToken = null; @@ -903,7 +903,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestProfile('@alice:example.com'); + final response = await matrixApi.getUserProfile('@alice:example.com'); expect( FakeMatrixApi.api['GET'] ['/client/r0/profile/%40alice%3Aexample.com']({}), @@ -915,7 +915,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestTurnServerCredentials(); + final response = await matrixApi.getTurnServer(); expect(FakeMatrixApi.api['GET']['/client/r0/voip/turnServer']({}), response.toJson()); @@ -925,7 +925,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.sendTypingNotification( + await matrixApi.setTyping( '@alice:example.com', '!localpart:example.com', true, @@ -938,7 +938,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.sendReceiptMarker( + await matrixApi.postReceipt( '!localpart:example.com', '\$1234:example.com', ); @@ -949,7 +949,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.sendReadMarker( + await matrixApi.setReadMarker( '!localpart:example.com', '\$1234:example.com', readReceiptLocationEventId: '\$1234:example.com', @@ -961,7 +961,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.sendPresence( + await matrixApi.setPresence( '@alice:example.com', PresenceType.offline, statusMsg: 'test', @@ -973,7 +973,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestPresence( + final response = await matrixApi.getPresence( '@alice:example.com', ); expect( @@ -985,11 +985,11 @@ void main() { }); test('upload', () async { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); - final response = await matrixApi.upload(Uint8List(0), 'file.jpeg'); + final response = await matrixApi.uploadContent(Uint8List(0), 'file.jpeg'); expect(response, 'mxc://example.com/AQwafuaFswefuhsfAFAgsw'); var throwsException = false; try { - await matrixApi.upload(Uint8List(0), 'file.jpg'); + await matrixApi.uploadContent(Uint8List(0), 'file.jpg'); } on MatrixException catch (_) { throwsException = true; } @@ -1000,7 +1000,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final openGraphData = await matrixApi.requestOpenGraphDataForUrl( + final openGraphData = await matrixApi.getUrlPreview( Uri.parse('https://matrix.org'), ts: 10, ); @@ -1015,7 +1015,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestMaxUploadSize(); + final response = await matrixApi.getConfig(); expect(response, 50000000); matrixApi.homeserver = matrixApi.accessToken = null; @@ -1036,7 +1036,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final devices = await matrixApi.requestDevices(); + final devices = await matrixApi.getDevices(); expect(FakeMatrixApi.api['GET']['/client/r0/devices']({})['devices'], devices.map((i) => i.toJson()).toList()); @@ -1046,7 +1046,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.requestDevice('QBUAZIFURK'); + await matrixApi.getDevice('QBUAZIFURK'); matrixApi.homeserver = matrixApi.accessToken = null; }); @@ -1054,7 +1054,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.setDeviceMetadata('QBUAZIFURK', displayName: 'test'); + await matrixApi.updateDevice('QBUAZIFURK', displayName: 'test'); matrixApi.homeserver = matrixApi.accessToken = null; }); @@ -1080,7 +1080,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.uploadDeviceKeys( + await matrixApi.uploadKeys( deviceKeys: MatrixDeviceKeys( '@alice:example.com', 'ABCD', @@ -1097,7 +1097,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestDeviceKeys( + final response = await matrixApi.queryKeys( { '@alice:example.com': [], }, @@ -1119,7 +1119,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestOneTimeKeys( + final response = await matrixApi.claimKeys( { '@alice:example.com': {'JLAFKJWSCS': 'signed_curve25519'} }, @@ -1139,7 +1139,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.requestDeviceListsUpdate('1234', '1234'); + await matrixApi.getKeysChanges('1234', '1234'); matrixApi.homeserver = matrixApi.accessToken = null; }); @@ -1230,7 +1230,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestPushers(); + final response = await matrixApi.getPushers(); expect( FakeMatrixApi.api['GET']['/client/r0/pushers']({}), {'pushers': response.map((i) => i.toJson()).toList()}, @@ -1242,7 +1242,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.setPusher( + await matrixApi.postPusher( Pusher( '1234', 'app.id', @@ -1263,7 +1263,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestNotifications( + final response = await matrixApi.getNotifications( from: '1234', limit: 10, only: '1234', @@ -1280,7 +1280,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestPushRules(); + final response = await matrixApi.getPushRules(); expect( FakeMatrixApi.api['GET']['/client/r0/pushrules']({}), {'global': response.toJson()}, @@ -1292,8 +1292,8 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestPushRule( - 'global', PushRuleKind.content, 'nocake'); + final response = + await matrixApi.getPushRule('global', PushRuleKind.content, 'nocake'); expect( FakeMatrixApi.api['GET'] ['/client/r0/pushrules/global/content/nocake']({}), @@ -1338,7 +1338,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final enabled = await matrixApi.requestPushRuleEnabled( + final enabled = await matrixApi.isPushRuleEnabled( 'global', PushRuleKind.content, 'nocake'); expect(enabled, true); @@ -1348,7 +1348,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.enablePushRule( + await matrixApi.setPushRuleEnabled( 'global', PushRuleKind.content, 'nocake', @@ -1361,7 +1361,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final actions = await matrixApi.requestPushRuleActions( + final actions = await matrixApi.getPushRuleActions( 'global', PushRuleKind.content, 'nocake'); expect(actions.first, PushRuleAction.notify); @@ -1384,7 +1384,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.globalSearch({}); + await matrixApi.search({}); matrixApi.homeserver = matrixApi.accessToken = null; }); @@ -1392,8 +1392,8 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestEvents( - from: '1234', roomId: '!1234', timeout: 10); + final response = + await matrixApi.getEvents(from: '1234', roomId: '!1234', timeout: 10); expect( FakeMatrixApi.api['GET'] ['/client/r0/events?from=1234&timeout=10&roomId=%211234']({}), @@ -1406,7 +1406,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestRoomTags( + final response = await matrixApi.getRoomTags( '@alice:example.com', '!localpart:example.com'); expect( FakeMatrixApi.api['GET'][ @@ -1420,7 +1420,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.addRoomTag( + await matrixApi.setRoomTag( '@alice:example.com', '!localpart:example.com', 'testtag', @@ -1433,7 +1433,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.removeRoomTag( + await matrixApi.deleteRoomTag( '@alice:example.com', '!localpart:example.com', 'testtag', @@ -1457,7 +1457,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.requestAccountData( + await matrixApi.getAccountData( '@alice:example.com', 'test.account.data', ); @@ -1468,7 +1468,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.setRoomAccountData( + await matrixApi.setAccountDataPerRoom( '@alice:example.com', '1234', 'test.account.data', @@ -1481,7 +1481,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.requestRoomAccountData( + await matrixApi.getAccountDataPerRoom( '@alice:example.com', '1234', 'test.account.data', @@ -1493,7 +1493,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestWhoIsInfo('@alice:example.com'); + final response = await matrixApi.getWhoIs('@alice:example.com'); expect( FakeMatrixApi.api['GET'] ['/client/r0/admin/whois/%40alice%3Aexample.com']({}), @@ -1506,7 +1506,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestEventContext('1234', '1234', + final response = await matrixApi.getEventContext('1234', '1234', limit: 10, filter: '{}'); expect( FakeMatrixApi.api['GET'] @@ -1520,7 +1520,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - await matrixApi.reportEvent( + await matrixApi.reportContent( '1234', '1234', 'test', @@ -1607,7 +1607,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; - final response = await matrixApi.requestOpenIdCredentials('1234'); + final response = await matrixApi.requestOpenIdToken('1234'); expect( FakeMatrixApi.api['POST'] ['/client/r0/user/1234/openid/request_token']({}),