diff --git a/packages/shorebird_code_push_client/lib/src/code_push_client.dart b/packages/shorebird_code_push_client/lib/src/code_push_client.dart index 0e400593..bbc0f24a 100644 --- a/packages/shorebird_code_push_client/lib/src/code_push_client.dart +++ b/packages/shorebird_code_push_client/lib/src/code_push_client.dart @@ -253,8 +253,8 @@ class CodePushClient { required String channel, }) async { final response = await _httpClient.post( - Uri.parse('$_v1/channels'), - body: json.encode({'app_id': appId, 'channel': channel}), + Uri.parse('$_v1/apps/$appId/channels'), + body: json.encode({'channel': channel}), ); if (response.statusCode != HttpStatus.ok) { @@ -401,9 +401,7 @@ class CodePushClient { /// List all channels for the provided [appId]. Future> getChannels({required String appId}) async { final response = await _httpClient.get( - Uri.parse('$_v1/channels').replace( - queryParameters: {'appId': appId}, - ), + Uri.parse('$_v1/apps/$appId/channels'), ); if (response.statusCode != HttpStatus.ok) { diff --git a/packages/shorebird_code_push_client/test/src/code_push_client_test.dart b/packages/shorebird_code_push_client/test/src/code_push_client_test.dart index 5dc8f698..accf98db 100644 --- a/packages/shorebird_code_push_client/test/src/code_push_client_test.dart +++ b/packages/shorebird_code_push_client/test/src/code_push_client_test.dart @@ -510,8 +510,10 @@ void main() { .captured .single as http.BaseRequest; expect(request.method, equals('POST')); - expect(request.url, - equals(v1('apps/$appId/releases/$releaseId/artifacts'))); + expect( + request.url, + equals(v1('apps/$appId/releases/$releaseId/artifacts')), + ); expect(request.hasStandardHeaders, isTrue); }); @@ -849,7 +851,7 @@ void main() { .captured .single as http.BaseRequest; expect(request.method, equals('POST')); - expect(request.url, equals(v1('channels'))); + expect(request.url, equals(v1('apps/$appId/channels'))); expect(request.hasStandardHeaders, isTrue); }); @@ -926,7 +928,9 @@ void main() { expect( request.url, - codePushClient.hostedUri.replace(path: '/api/v1/channels'), + codePushClient.hostedUri.replace( + path: '/api/v1/apps/$appId/channels', + ), ); }); }); @@ -1590,7 +1594,7 @@ void main() { .captured .single as http.BaseRequest; expect(request.method, equals('GET')); - expect(request.url, equals(v1('channels?appId=$appId'))); + expect(request.url, equals(v1('apps/$appId/channels'))); expect(request.hasStandardHeaders, isTrue); });