https://github.com/sterrenb/pihole-api
A Flutter library for the Pi-hole API.
https://github.com/sterrenb/pihole-api
api flutter pihole
Last synced: 3 months ago
JSON representation
A Flutter library for the Pi-hole API.
- Host: GitHub
- URL: https://github.com/sterrenb/pihole-api
- Owner: sterrenb
- License: bsd-3-clause
- Created: 2021-11-30T22:12:58.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-28T20:32:00.000Z (over 2 years ago)
- Last Synced: 2025-04-02T21:18:20.516Z (3 months ago)
- Topics: api, flutter, pihole
- Language: Dart
- Homepage:
- Size: 273 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Pi-hole API
[](https://pub.dartlang.org/packages/pihole_api)
[](https://github.com/sterrenburg/pihole-api/actions/workflows/build.yaml)
[](https://codecov.io/gh/sterrenburg/pihole-api)
[](https://opensource.org/licenses/BSD-3-Clause)A Flutter library for the [Pi-hole](https://pi-hole.net/) API.
## Example
The following example prints the summary information after fetching it.
**Note**: Do not forget to add your own API token if you use authenticated requests.
```dart
import 'package:pihole_api/pihole_api.dart';final pihole = PiholeRepositoryDio(PiholeRepositoryParams(
baseUrl: "http://pi.hole",
apiPath: "/admin/api.php",
apiTokenRequired: true,
// Find the API token from your Pi-hole admin dashboard while signed in,
// e.g. from http://pi.hole/admin/scripts/pi-hole/php/api_token.php.
apiToken: const String.fromEnvironment(
"PIHOLE_API_TOKEN",
defaultValue: "MY_TOKEN",
),
allowSelfSignedCertificates: false,
adminHome: "/admin",
));
pihole.fetchSummary(CancelToken()).then((summary) => print(summary.toString()));
```## Development
The models are built by [freezed](https://pub.dev/packages/freezed). To build the models, use `build_runner`:
```sh
flutter pub run build_runner build
# or
flutter pub run build_runner build --delete-conflicting-outputs
```### Changelog
```sh
standard-version --release-as x.y.z
```