Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkgs/firehose/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.25

- Switch to pub.dev API in `package:firehose`.

## 0.3.24

- Fix [#137](https://github.com/dart-lang/ecosystem/issues/137).
Expand Down
10 changes: 6 additions & 4 deletions pkgs/firehose/lib/src/pub.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ class Pub {

Future<bool> hasPublishedVersion(String name, String version) async {
var response =
await httpClient.get(Uri.parse('https://pub.dev/packages/$name.json'));
await httpClient.get(Uri.parse('https://pub.dev/api/packages/$name'));
if (response.statusCode != 200) {
return false;
}

var json = jsonDecode(response.body) as Map;
var versions = json['versions'] as List;
return versions.contains(version);
var json = jsonDecode(response.body) as Map<String, dynamic>;
return (json['versions'] as List)
.map((versionObject) =>
(versionObject as Map<String, dynamic>)['version'])
.contains(version);
}

void close() {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/firehose/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: firehose
description: A tool to automate publishing of Pub packages from GitHub actions.
version: 0.3.24
version: 0.3.25
repository: https://github.com/dart-lang/ecosystem/tree/main/pkgs/firehose

environment:
Expand Down