wordpress_client 8.0.10 copy "wordpress_client: ^8.0.10" to clipboard
wordpress_client: ^8.0.10 copied to clipboard

outdated

A library to interact with the Wordpress REST API. Supports most of the common endpoints and all of the CRUD operations on the endpoints.

wordpress_client

Pub Version
Dart Flutter WordPress
Easily interact with the Wordpress REST API. Get support for most common endpoints & CRUD operations.

πŸš€ Features #

  • πŸ›‘οΈ 3 Popular authorization methods.
  • 🎣 Events for preprocessing response operations.
  • ⏲️ Measures request completion time.
  • 🎨 Custom Requests & Authorization systems.
  • πŸ”„ Request Synchronization.
  • ✨ And much more!

πŸ“– How to Use #

1. Setup #

Add wordpress_client in your pubspec.yaml:

dependencies:
 wordpress_client: ^8.0.10

πŸ’‘ Ensure you get the latest version here.

Import the package where you need:

import 'package:wordpress_client/wordpress_client.dart';

2. Initialization #

You can initialize WordpressClient in two methods:

  • Default (Simple Method)
  • Advanced (with Bootstrapper for additional configurations)

Simple Method:

final baseUrl = Uri.parse('https://example.com/wp-json/wp/v2');
final client = WordpressClient(baseUrl: baseUrl);

client.initialize();

πŸ“˜ Learn more about the Advanced Method here.

3. Sending Requests #

Example to retrieve 20 recent WordPress posts in ascending order:

final request = ListPostRequest(
  page: 1,
  perPage: 20,
  order = Order.asc,
);

final wpResponse = await client.posts.list(request);

// Dart 3 style
switch (wpResponse) {
    case WordpressSuccessResponse():
      final data = wpResponse.data; // List<Post>
      break;
    case WordpressFailureResponse():
      final error = wpResponse.error; // WordpressError
      break;
}

// or
// wordpress_client style
final result = postsResponse.map(
    onSuccess: (response) {
      print(response.message);
      return response.data;
    },
    onFailure: (response) {
      print(response.error.toString());
      return <Post>[];
    },
);

Refer to the documentation for more request examples.

πŸ”’ Supported Authorization #

1. AppPasswordAuth #

By the WordPress Team, this method uses basic HTTP authentication where credentials are passed with every request. Details

2. BasicJwtAuth #

Developed by Enrique Chavez, it involves JSON Web Token (JWT) authentication where a token is issued and then used in subsequent requests. Details

3. UsefulJwtAuth #

By Useful Team, this is another implementation using JWT for authentication purposes. Details

For custom authorization, check the Authorization Wiki.

πŸ“‹ Supported REST Methods #

Endpoint Create Read Update Delete
Posts βœ… βœ… βœ… βœ…
Comments βœ… βœ… βœ… βœ…
Categories βœ… βœ… βœ… βœ…
Tags βœ… βœ… βœ… βœ…
Users βœ… βœ… βœ… βœ…
Me βœ… βœ… βœ… βœ…
Media βœ… βœ… βœ… βœ…
Search ❌ βœ… ❌ ❌
Post Revisions ❌ ❌ ❌ ❌
Pages ❌ ❌ ❌ ❌
Taxonomies ❌ ❌ ❌ ❌
Post Types ❌ ❌ ❌ ❌
Post Statuses ❌ ❌ ❌ ❌
Settings ❌ ❌ ❌ ❌

πŸ“’ Custom Response Types #

Learn how to implement Custom Requests here.

πŸ“£ Feedback #

  • πŸ› For bugs or feature requests, use the issue tracker.
  • πŸ’‘ Contributions are always appreciated. PRs are welcome!

πŸ“œ License #

Licensed under MIT.


Support Me:

Buy Me A Coffee

37
likes
0
points
1.33k
downloads

Publisher

verified publisherarunprakashg.com

Weekly Downloads

A library to interact with the Wordpress REST API. Supports most of the common endpoints and all of the CRUD operations on the endpoints.

Repository (GitHub)
View/report issues

Topics

#wordpress #fluent #crud #rest

Documentation

Documentation

Funding

Consider supporting this project:

www.buymeacoffee.com

License

unknown (license)

Dependencies

collection, dio, http_parser, meta, path, synchronized

More

Packages that depend on wordpress_client