wordpress_api 1.2.0 wordpress_api: ^1.2.0 copied to clipboard
A WordPress REST API client for dart with support for WooCommerce and custom namespaces.
Changelog #
[1.2.0] #
What's New #
- A new utility abstract class
WPUtils
has been introduced. This class contains some useful functions. - Added
EmbedModel
thanks Ankii
What Changed #
- In response to issue #26, the HTML tags have been preserved. In order to parse the html, a utility function from
WPUtils
is now available as shown in the example below.
void main() async {
final api = WordPressAPI('site.com');
final res = await api.posts.fetch();
for (final post in res.data as List<Post>) {
// This will provide the content as it is without stripping the HTML tags.
print(post.content);
// This will strip all the HTML tags using parseHtml from WPUtils
print(WPUtils.parseHtml(post.content));
}
}
Other contributions #
- Thanks NemesisX1 for prefixing the
Utils
class - Updated
Logger
tov1.1.0
[1.1.0] #
- Changed the
get
method on endpoints tofetch
. This has been done to preserve thedart
keywordget
. - Changed the return turn for each endpoint to
WPResponse
. This changed was made to enable more control over the response returned and also get the necessary meta data returned from the response. Refer toexample
orREADME.md
[1.0.0] #
Breaking Changes/ What's New #
As of v1+, every api endpoint
is set to a getter
. For example,
final WordPressAPI api = WordPressAPI('wp-site.domain');
// Getting posts the OLD WAY
final List<Post> posts = await api.getPosts();
// The new way as of v1.0+
final List<Post> posts = await api.posts.get();
The new way is applicable to categories
, pages
, users
, tags
, taxonomies
, media
, application-passwords
and any other endpoints to be added.
[0.3.1] #
- Fixed return value in
Media Model
forcaption
anddescription
[0.3.0] #
What's new? #
- Added null-safety support. issue #20
- An option to intiailize a custom
Dio
instance. Thanks kellvembarbosa - Added support for a
Job
model to render WP Job Manager - Added support for
Application Passwords
model introduced in WordPress 5.6 - Added WooCommerce Models for
Product
,Orders
and others.
What's changed? #
- Refactored codebase in preparation for the stable version 1.0
- Renamed all schemas to match endpoint, e.g
PostSchema
is nowPost
[0.2.1+1] #
[0.2.0] #
[0.1.4] #
- Add models for Category, Comment, Media, Post, Tag and User.
- Each model has a 'BASE' prefix and 'MODEL' suffix with all the default response params, e.g BaseUserModel
[0.1.3+2] #
- Removed explicit
null
variable initializations as suggested by dart analyzer
[0.1.3] #
[0.1.2+3] #
- Minor fixes
[0.1.2+2] #
- Added endpoint query handler
[0.1.2+1] #
- Added getAsyc exception
[0.1.2] #
- Fixed the error in JSON endpoint retrieval
[0.1.1+2] #
- Changed getAsync return raw json body
- Changed example code url
[0.1.1+1] #
- Changed getAsync return data to a map.
[0.1.1] #
- Updated example and readme
[0.1.0] #
- Added an example
[0.0.2] #
- Updated documentation
[0.0.1] #
- Initial release.