refactor(code_push_client)!: use new channels endpoint (#863)
This commit is contained in:
@@ -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<List<Channel>> 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) {
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user