Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dhmgroup/dart-wp
A WordPress API client for dart with support for WooCommerce and custom namespaces.
https://github.com/dhmgroup/dart-wp
dart dart-package dart-vm dartlang flutter flutter-plugin woocommerce wordpress
Last synced: 4 days ago
JSON representation
A WordPress API client for dart with support for WooCommerce and custom namespaces.
- Host: GitHub
- URL: https://github.com/dhmgroup/dart-wp
- Owner: dhmgroup
- License: bsd-3-clause
- Created: 2018-12-30T13:40:46.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2024-07-29T23:54:27.000Z (5 months ago)
- Last Synced: 2024-12-15T06:04:57.477Z (11 days ago)
- Topics: dart, dart-package, dart-vm, dartlang, flutter, flutter-plugin, woocommerce, wordpress
- Language: Dart
- Homepage: https://pub.dev/packages/wordpress_api
- Size: 297 KB
- Stars: 78
- Watchers: 6
- Forks: 28
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# WordPress REST API client for [Dart](https://dart.dev/) | [Flutter](https://flutter.dev)
[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-)
[![GitHub stars](https://img.shields.io/github/stars/dhmgroup/dart-wp.svg?style=social&label=Star&maxAge=2592000)](https://github.com/dhmgroup/dart-wp/stargazers/)
[![Pub](https://img.shields.io/pub/v/wordpress_api.svg?style=flat-square)](https://pub.dartlang.org/packages/wordpress_api)
[![Build Status](https://travis-ci.org/dhmgroup/dart-wp.svg?branch=master)](https://travis-ci.org/dhmgroup/dart-wp)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/dhmgroup/dart-wp/graphs/commit-activity)## Description
A WordPress REST API client for dart with support for WooCommerce and custom namespaces/endpoints.
## Features
- Retrieve data from standard WordPress endpoints.
- Retrieve data from any custom namespace## Installation
In the `dependencies:` section of your `pubspec.yaml`, add the following line:
```yaml
dependencies:
wordpress_api:
```## Usage
- Import the package
```dart
import 'package:wordpress_api/wordpress_api';
```- Initialize WPAPI
```dart
WordPressAPI api = WordPressAPI('wp-site.com');
```- Retrieve posts from `.posts` getter
- You can fetch a list of posts by simply calling `.posts`. More arguments can be passed to further filter the data returned
```dart
void main() async {
final api = WordPressAPI('wp-site.com');
final WPResponse res = await api.posts.fetch();
for (final post in res.data) {
print(post.title);
}
}
```- As of `v0.3.0`, you can query a single post from the same endpoint by passing an `id`
```dart
void main() async {
final api = WordPressAPI('wp-site.com');
final WPResponse res = await api.posts.fetch(id: 1);
print(res.data.title);
}
```- Retrieve data from a custom endpoint
```dart
void main() async {
final api = WordPressAPI('wp-site.com');
final WPResponse res = await api.get(endpoint: 'your-custom-endpoint');
print(res.data);
}
```## ToDo
- Authentication using `Application Passwords`. *WordPress 5.6+ only*
- Fully integrated WooCommerce support.
- Full CRUD operations.
- Support for other popular WordPress Plugins.Contributions are welcome, report any issues [here](https://github.com/dhmgroup/dart-wp/issues)
## Special Thanks
- [WordPress REST API Handbook](https://developer.wordpress.org/rest-api/reference/) - Read the Handbank for additional arguments/query parameter.
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
anKii
💻
Kellvem Barbosa
💻
NKlage
💻 🐛
Elikem (Junior) Medehou
💻
Okan Demir
💻
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!