-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d5ae90
commit 32dbfe9
Showing
24 changed files
with
2,570 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Files and directories created by pub | ||
.dart_tool/ | ||
.packages | ||
# Remove the following pattern if you wish to check in your lock file | ||
pubspec.lock | ||
# Do not version the sdk versions | ||
.DS_Store | ||
|
||
# Conventional directory for build outputs | ||
build/ | ||
|
||
# Directory created by dartdoc | ||
doc/api/ | ||
|
||
# Test Coverage | ||
test/.test_coverage.dart | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# Visual Studio Code related | ||
.classpath | ||
.project | ||
.settings/ | ||
.vscode/ | ||
coverage/lcov.info | ||
|
||
# FVM during tests | ||
.fvm | ||
.vscode/settings.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## 1.0.3 | ||
|
||
- Added user-agent to requests | ||
|
||
## 1.0.2 | ||
|
||
- Further improvements | ||
|
||
## 1.0.1 | ||
|
||
- Test improvements and API clean up | ||
|
||
## 1.0.0 | ||
|
||
- Initial version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,79 @@ | ||
# pubdev_api | ||
API Client for Pub.dev | ||
<img src="https://github.com/leoafarias/pub_api_client/blob/main/assets/logo.png?raw=true" alt="drawing" width="320"/> | ||
|
||
[![Pub Version](https://img.shields.io/pub/v/pub_api_client?label=version&style=flat-square)](https://pub.dev/packages/pub_api_client/changelog) [![Health](https://img.shields.io/badge/dynamic/json?color=blue&label=health&query=pub_points&url=http://www.pubscore.gq/pub-points?package=pub_api_client&style=flat-square&cacheSeconds=90000)](https://pub.dev/packages/pub_api_client/score) [![Coverage Status](https://coveralls.io/repos/github/leoafarias/pub_api_client/badge.svg?branch=main)](https://coveralls.io/github/leoafarias/pub_api_client?branch=main) [![MIT Licence](https://img.shields.io/github/license/leoafarias/pub_api_client?style=flat-square&longCache=true)](https://opensource.org/licenses/mit-license.php) | ||
|
||
## An unofficial API client for [Pub.dev](https://www.pub.dev) | ||
|
||
Implements all `known` endpoints available on pub.dev. If any particular endpoint is missing please [open an issue][tracker]. | ||
|
||
## Usage | ||
|
||
A simple usage example: | ||
|
||
```dart | ||
import 'package:pub_api_client/pub_api_client.dart'; | ||
main() { | ||
final client = PubClient(); | ||
} | ||
``` | ||
|
||
## Get Package Info | ||
|
||
Retrieves all available information about an specific package. | ||
|
||
```dart | ||
final package = await client.getPackage('pkg_name'); | ||
``` | ||
|
||
## Get Package Score | ||
|
||
Returns the following score information about a package. | ||
|
||
- Pub Points | ||
- Popularity | ||
- Likes | ||
|
||
```dart | ||
final score = await client.getScore('pkg_name'); | ||
``` | ||
|
||
## Get Package Versions | ||
|
||
The method `getPackage` also returns the versions. However if all you need is versions use this method since it's lighter. | ||
|
||
```dart | ||
final package = await client.getVersions('pkg_name'); | ||
``` | ||
|
||
## Search Packages | ||
|
||
Allows you to search for packages on pub.dev. Will return the packages that match the query. | ||
|
||
```dart | ||
final results = await client.search('query'); | ||
// Returns the packages that match the query | ||
print(results.packages) | ||
``` | ||
|
||
### Paging Search Results | ||
|
||
You are able to page search results. | ||
|
||
```dart | ||
final results = await client.search('query'); | ||
final nextResults = await results.nextPage(); | ||
print(nextResults.packages) | ||
``` | ||
|
||
If you want to retrieve a specific result page you can call the `page` parameter directly. | ||
|
||
```dart | ||
final results = await client.search('query',page:2); | ||
print(results.packages) | ||
``` | ||
|
||
Please file feature requests and bugs at the [issue tracker][tracker]. | ||
|
||
[tracker]: https://github.com/leoafarias/pub_api_client/issues |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Defines a default set of lint rules enforced for | ||
# projects at Google. For details and rationale, | ||
# see https://github.com/dart-lang/pedantic#enabled-lints. | ||
include: package:pedantic/analysis_options.yaml | ||
|
||
# For lint rules and documentation, see http://dart-lang.github.io/linter/lints. | ||
# Uncomment to specify additional rules. | ||
# linter: | ||
# rules: | ||
# - camel_case_types | ||
|
||
analyzer: | ||
exclude: | ||
- "**/*.g.dart" | ||
- "**/*.freezed.dart" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
```dart | ||
import 'package:pub_api_client/pub_api_client.dart'; | ||
void main() async { | ||
final client = PubClient(); | ||
final packageInfo = await client.getPackage('fvm'); | ||
print('Package Info: $packageInfo'); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/// Support for doing something awesome. | ||
/// | ||
/// More dartdocs go here. | ||
library pubdev_api; | ||
|
||
export 'src/pub_api_client_base.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
|
||
part 'package_score_model.freezed.dart'; | ||
part 'package_score_model.g.dart'; | ||
|
||
@freezed | ||
abstract class PackageScore with _$PackageScore { | ||
factory PackageScore({ | ||
final int grantedPoints, | ||
final int maxPoints, | ||
final int likeCount, | ||
final double popularityScore, | ||
final DateTime lastUpdated, | ||
}) = _PackageScore; | ||
|
||
factory PackageScore.fromJson(Map<String, dynamic> json) => | ||
_$PackageScoreFromJson(json); | ||
} |
Oops, something went wrong.