diff --git a/MatrixSDK/MXEnumConstants.m b/MatrixSDK/MXEnumConstants.m index 88cb32e17..a743d122b 100644 --- a/MatrixSDK/MXEnumConstants.m +++ b/MatrixSDK/MXEnumConstants.m @@ -22,7 +22,7 @@ Matrix content respository path */ NSString *const kMXContentUriScheme = @"mxc://"; -NSString *const kMXContentPrefixPath = @"_matrix/media/r0"; +NSString *const kMXContentPrefixPath = @"_matrix/media/v3"; /** Prefix used in path of antivirus server API requests. diff --git a/MatrixSDK/MXRestClient.m b/MatrixSDK/MXRestClient.m index 6a9c92971..5efb6dae4 100644 --- a/MatrixSDK/MXRestClient.m +++ b/MatrixSDK/MXRestClient.m @@ -195,7 +195,7 @@ -(id)initWithCredentials:(MXCredentials*)inCredentials self = [super init]; if (self) { - apiPathPrefix = kMXAPIPrefixPathR0; + apiPathPrefix = kMXAPIPrefixPathV3; antivirusServerPathPrefix = kMXAntivirusAPIPrefixPathUnstable; contentPathPrefix = kMXContentPrefixPath; @@ -4817,7 +4817,7 @@ - (MXHTTPOperation*)uploadKeys:(NSDictionary*)deviceKeys success:(void (^)(MXKeysUploadResponse *keysUploadResponse))success failure:(void (^)(NSError *error))failure { - NSString *path = deviceId ? [NSString stringWithFormat:@"%@/keys/upload/%@", kMXAPIPrefixPathR0, [deviceId stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]]] : [NSString stringWithFormat:@"%@/keys/upload", kMXAPIPrefixPathR0]; + NSString *path = deviceId ? [NSString stringWithFormat:@"%@/keys/upload/%@", kMXAPIPrefixPathV3, [deviceId stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]]] : [NSString stringWithFormat:@"%@/keys/upload", kMXAPIPrefixPathV3]; NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; if (deviceKeys) @@ -4862,7 +4862,7 @@ - (MXHTTPOperation*)uploadKeySignatures:(NSDictionary*)signatures { MXWeakify(self); return [httpClient requestWithMethod:@"POST" - path:[NSString stringWithFormat:@"%@/keys/signatures/upload", kMXAPIPrefixPathR0] + path:[NSString stringWithFormat:@"%@/keys/signatures/upload", kMXAPIPrefixPathV3] parameters:signatures success:^(NSDictionary *JSONResponse) { MXStrongifyAndReturnIfNil(self); @@ -4885,7 +4885,7 @@ - (MXHTTPOperation*)downloadKeysForUsers:(NSArray*)userIds success:(void (^)(MXKeysQueryResponse *keysQueryResponse))success failure:(void (^)(NSError *error))failure { - NSString *path = [NSString stringWithFormat:@"%@/keys/query", kMXAPIPrefixPathR0]; + NSString *path = [NSString stringWithFormat:@"%@/keys/query", kMXAPIPrefixPathV3]; NSMutableDictionary *downloadQuery = [NSMutableDictionary dictionary]; for (NSString *userID in userIds) @@ -4927,7 +4927,7 @@ - (MXHTTPOperation*)downloadKeysForUsers:(NSArray*)userIds - (MXHTTPOperation *)claimOneTimeKeysForUsersDevices:(MXUsersDevicesMap *)usersDevicesKeyTypesMap success:(void (^)(MXKeysClaimResponse *))success failure:(void (^)(NSError *))failure { - NSString *path = [NSString stringWithFormat:@"%@/keys/claim", kMXAPIPrefixPathR0]; + NSString *path = [NSString stringWithFormat:@"%@/keys/claim", kMXAPIPrefixPathV3]; NSDictionary *parameters = @{ @"one_time_keys": usersDevicesKeyTypesMap.map @@ -4963,7 +4963,7 @@ - (MXHTTPOperation *)keyChangesFrom:(NSString *)fromToken to:(NSString *)toToken { MXWeakify(self); return [httpClient requestWithMethod:@"GET" - path:[NSString stringWithFormat:@"%@/keys/changes", kMXAPIPrefixPathR0] + path:[NSString stringWithFormat:@"%@/keys/changes", kMXAPIPrefixPathV3] parameters:@{ @"from": fromToken, @"to": toToken @@ -5065,7 +5065,7 @@ - (MXHTTPOperation*)createKeyBackupVersion:(MXKeyBackupVersion*)keyBackupVersion { MXWeakify(self); return [httpClient requestWithMethod:@"POST" - path:[NSString stringWithFormat:@"%@/room_keys/version", kMXAPIPrefixPathR0] + path:[NSString stringWithFormat:@"%@/room_keys/version", kMXAPIPrefixPathV3] parameters:keyBackupVersion.JSONDictionary success:^(NSDictionary *JSONResponse) { MXStrongifyAndReturnIfNil(self); @@ -5089,7 +5089,7 @@ - (MXHTTPOperation*)updateKeyBackupVersion:(MXKeyBackupVersion*)keyBackupVersion success:(void (^)(void))success failure:(void (^)(NSError *error))failure { - return [self updateKeyBackupVersion:keyBackupVersion withPath:kMXAPIPrefixPathR0 success:success failure:failure]; + return [self updateKeyBackupVersion:keyBackupVersion withPath:kMXAPIPrefixPathV3 success:success failure:failure]; } - (MXHTTPOperation*)updateKeyBackupVersion:(MXKeyBackupVersion*)keyBackupVersion @@ -5121,7 +5121,7 @@ - (MXHTTPOperation*)deleteKeyBackupVersion:(NSString*)version success:(void (^)(void))success failure:(void (^)(NSError *error))failure { - NSMutableString *path = [NSMutableString stringWithFormat:@"%@/room_keys/version", kMXAPIPrefixPathR0]; + NSMutableString *path = [NSMutableString stringWithFormat:@"%@/room_keys/version", kMXAPIPrefixPathV3]; if (version) { [path appendFormat:@"/%@", version]; @@ -5151,7 +5151,7 @@ - (MXHTTPOperation*)keyBackupVersion:(NSString*)version success:(void (^)(MXKeyBackupVersion *keyBackupVersion))success failure:(void (^)(NSError *error))failure; { - NSMutableString *path = [NSMutableString stringWithFormat:@"%@/room_keys/version", kMXAPIPrefixPathR0]; + NSMutableString *path = [NSMutableString stringWithFormat:@"%@/room_keys/version", kMXAPIPrefixPathV3]; if (version) { [path appendFormat:@"/%@", version]; @@ -5470,7 +5470,7 @@ - (NSString*)keyBackupPath:(NSString*)roomId session:(NSString*)sessionId versio return nil; } - NSMutableString *path = [NSMutableString stringWithFormat:@"%@/room_keys/keys", kMXAPIPrefixPathR0]; + NSMutableString *path = [NSMutableString stringWithFormat:@"%@/room_keys/keys", kMXAPIPrefixPathV3]; if (sessionId) { @@ -5504,7 +5504,7 @@ - (MXHTTPOperation*)sendToDevice:(MXToDevicePayload *)payload { // Prepare the path by adding a random transaction id (This id is used to prevent duplicated event). - NSString *path = [NSString stringWithFormat:@"%@/sendToDevice/%@/%@", kMXAPIPrefixPathR0, payload.eventType, payload.transactionId]; + NSString *path = [NSString stringWithFormat:@"%@/sendToDevice/%@/%@", kMXAPIPrefixPathV3, payload.eventType, payload.transactionId]; NSDictionary *content = @{ @"messages": payload.messages @@ -5530,7 +5530,7 @@ - (MXHTTPOperation*)devices:(void (^)(NSArray *))success { MXWeakify(self); return [httpClient requestWithMethod:@"GET" - path:[NSString stringWithFormat:@"%@/devices", kMXAPIPrefixPathR0] + path:[NSString stringWithFormat:@"%@/devices", kMXAPIPrefixPathV3] parameters:nil success:^(NSDictionary *JSONResponse) { MXStrongifyAndReturnIfNil(self); @@ -5556,7 +5556,7 @@ - (MXHTTPOperation*)deviceByDeviceId:(NSString *)deviceId { MXWeakify(self); return [httpClient requestWithMethod:@"GET" - path:[NSString stringWithFormat:@"%@/devices/%@", kMXAPIPrefixPathR0, deviceId] + path:[NSString stringWithFormat:@"%@/devices/%@", kMXAPIPrefixPathV3, deviceId] parameters:nil success:^(NSDictionary *JSONResponse) { MXStrongifyAndReturnIfNil(self); @@ -5589,7 +5589,7 @@ - (MXHTTPOperation*)setDeviceName:(NSString *)deviceName MXWeakify(self); return [httpClient requestWithMethod:@"PUT" - path:[NSString stringWithFormat:@"%@/devices/%@", kMXAPIPrefixPathR0, deviceId] + path:[NSString stringWithFormat:@"%@/devices/%@", kMXAPIPrefixPathV3, deviceId] parameters:parameters success:^(NSDictionary *JSONResponse) { MXStrongifyAndReturnIfNil(self); @@ -5608,7 +5608,7 @@ - (MXHTTPOperation*)getSessionToDeleteDeviceByDeviceId:(NSString *)deviceId // The request will fail with Unauthorized status code, but the auth session will be available in response data. MXWeakify(self); return [httpClient requestWithMethod:@"DELETE" - path:[NSString stringWithFormat:@"%@/devices/%@", kMXAPIPrefixPathR0, [MXTools encodeURIComponent:deviceId]] + path:[NSString stringWithFormat:@"%@/devices/%@", kMXAPIPrefixPathV3, [MXTools encodeURIComponent:deviceId]] parameters:nil success:^(NSDictionary *JSONResponse) { MXStrongifyAndReturnIfNil(self); @@ -5665,7 +5665,7 @@ - (MXHTTPOperation*)deleteDeviceByDeviceId:(NSString *)deviceId MXWeakify(self); return [httpClient requestWithMethod:@"DELETE" - path:[NSString stringWithFormat:@"%@/devices/%@", kMXAPIPrefixPathR0, [MXTools encodeURIComponent:deviceId]] + path:[NSString stringWithFormat:@"%@/devices/%@", kMXAPIPrefixPathV3, [MXTools encodeURIComponent:deviceId]] parameters:nil data:payloadData headers:@{@"Content-Type": @"application/json"} @@ -5693,7 +5693,7 @@ - (MXHTTPOperation*)deleteDevicesByDeviceIds:(NSArray*)deviceIds MXWeakify(self); return [httpClient requestWithMethod:@"POST" - path:[NSString stringWithFormat:@"%@/delete_devices", kMXAPIPrefixPathR0] + path:[NSString stringWithFormat:@"%@/delete_devices", kMXAPIPrefixPathV3] parameters:nil data:payloadData headers:@{@"Content-Type": @"application/json"} @@ -6266,7 +6266,7 @@ - (MXHTTPOperation*)getSpaceChildrenForSpaceWithId:(NSString*)spaceId - (MXHTTPOperation*)homeServerCapabilitiesWithSuccess:(void (^)(MXHomeserverCapabilities *capabilities))success failure:(void (^)(NSError *error))failure { - NSString *path = [NSString stringWithFormat:@"%@/capabilities", kMXAPIPrefixPathR0]; + NSString *path = [NSString stringWithFormat:@"%@/capabilities", kMXAPIPrefixPathV3]; MXWeakify(self); return [httpClient requestWithMethod:@"GET" diff --git a/changelog.d/7557.change b/changelog.d/7557.change new file mode 100644 index 000000000..7799fa1ac --- /dev/null +++ b/changelog.d/7557.change @@ -0,0 +1 @@ +Updating crypto API endpoint to v3. \ No newline at end of file