wordpress_client library

A library for interacting with Wordpress REST API with support for Authorization using JWT and Basic Auth.

Responses can contain statistical data such as Time taken for the request to finish as Duration, Any errors that might have occured, and the raw response from the server.

Classes

ApplicationPassword
AppPasswordAuth
Authentication using Application Passwords which are supported on all Wordpress installations version 5.6 or higher.
AuthorizationBuilder
Creates a new instance of AuthorizationBuilder.
BasicAuth
The most basic authentication system using username and password.
BasicJwtAuth
Most widely used authentication system, which is most easy to integrate and secure (when compared with basic auth)
BootstrapConfiguration
Category
Comment
CreateApplicationPasswordRequest
CreateCategoryRequest
CreateCommentRequest
CreateMediaRequest
CreatePageRequest
CreatePostRequest
CreateTagRequest
CreateUserRequest
DelegatedMiddleware
DeleteApplicationPasswordRequest
DeleteCategoryRequest
DeleteCommentRequest
DeleteMediaRequest
DeleteMeRequest
DeletePageRequest
DeletePostRequest
DeleteTagRequest
DeleteUserRequest
IAuthorization
Base class for all authorization types.
IDisposable
IRequest
Base class of all requests.
IRequestInterface
The base of all request interfaces. You must extend from this interface to define custom requests.
IWordpressMiddleware
ListApplicationPasswordRequest
ListCategoryRequest
ListCommentRequest
ListMediaRequest
ListPageRequest
ListPostRequest
ListSearchRequest
ListTagRequest
ListUserRequest
Media
Page
ParallelRequest<T>
ParallelResult<T>
ParallelWordpress
ParallelWordpress is a class that uses a WordpressClient to fetch data from a WordPress site. It provides a method to fetch a list of items in parallel, which can significantly speed up the fetching process.
Post
RequestUrl
An helper class which wraps around URI to provide a more flexible way of building request URLs.
RetrieveCategoryRequest
RetrieveCommentRequest
RetrieveMediaRequest
RetrieveMeRequest
RetrievePageRequest
RetrievePostRequest
RetrieveTagRequest
RetrieveUserRequest
RetriveApplicationPasswordRequest
Tag
UpdateApplicationPasswordRequest
UpdateCategoryRequest
UpdateCommentRequest
UpdateMediaRequest
UpdateMeRequest
UpdatePageRequest
UpdatePostRequest
UpdateTagRequest
UpdateUserRequest
UsefulJwtAuth
Similar to BasicJwtAuth, this plugin is in active development and has much more features than the previous one. It is recommended to use this plugin instead of the previous one.
User
WordpressClient
The main class for WordpressClient.
WordpressDiscovery
WordpressEvents
WordpressFailureResponse<T>
Represents a failure response.
WordpressRawResponse
Represents a raw response from the WordPress API.
WordpressRequest
Represents a request to the Wordpress REST API.
WordpressResponse<T>
WordpressSuccessResponse<T>
Represents a successful response.

Mixins

CreateOperation<T, R extends IRequest>
Represents the create operation.
CustomOperation<T, R extends IRequest>
Represents the custom operation. This mixin is used to create custom operations.
DeleteOperation<R extends IRequest>
Represents the delete operation.
ListOperation<T, R extends IRequest>
Represents the list operation.
RetrieveOperation<T, R extends IRequest>
Represents the retrive operation.
UpdateOperation<T, R extends IRequest>
Represents the update operation.

Functions

castOrElse<T>(dynamic json, {T? transformer(Object value)?, T orElse()?}) → T?
Casts the given dynamic JSON value to the specified type T.
decodeByMultiKeys<T>(Map<String, dynamic> map, List<String> keys, {T? transformer(Object value)?, T orElse()?}) → T?
Decodes a value from the given map by matching aganist given set of keys.
deserialize<T>(dynamic object) → T
Deserializes a JSON object by getting its decoder from CodableMap
executeGuarded<T>({required Future<T> function(), required Future<T> onError(Object error, StackTrace stackTrace)}) Future<T>
A convenience method to execute a function and handle any errors via onError callback.
getCommentStatusFromValue(String? value) CommentStatus
getContentStatusFromValue(String? value) ContentStatus
getFormatFromValue(String? value) PostFormat
getMediaFilterStatusFromValue(String? value) MediaFilterStatus
getMIMETypeFromExtension(String extension) String
Returns the MIME type for the given file extension.
getStatusFromValue(String? value) Status
mapGuarded<T>({required T mapper(Map<String, dynamic> json), required dynamic json}) → T?
A convenience method to map a JSON object to a Dart object with error handling.
parseDateIfNotNull(dynamic json) DateTime?
A convenience method to parse a date from a JSON object with error handling.
serialize<T>(T object) Map<String, dynamic>
Serializes a Dart object by getting its encoder from CodableMap
using<T, E extends IDisposable>(E disposable, FutureOr<T?> delegate(E instance)) FutureOr<T?>
A convenience method to execute a function and dispose the given IDisposable object.

Typedefs

InitializeDelegate = Future<void> Function()
JsonDecoderCallback<T> = T Function(dynamic json)
JsonEncoderCallback = Map<String, dynamic> Function(dynamic instance)
OnFailure<T> = WordpressFailureResponse<T> Function(WordpressRawResponse response)
Represents a failure response from the WordPress API.
OnRemovedDelegate = Future<void> Function()
OnRequestDelegate = Future<WordpressRequest> Function(WordpressRequest request)
OnResponseDelegate = Future<WordpressRawResponse> Function(WordpressRawResponse response)
OnSuccess<T> = WordpressSuccessResponse<T> Function(WordpressRawResponse response)
Represents a success response from the WordPress API.
ParallelExceptionHandler<T> = FutureOr<ParallelResult<T>> Function(Object error)
ParallelInitialItems<T> = FutureOr<List<T>> Function()
ParallelResultTransformer<T> = FutureOr<ParallelResult<T>> Function(WordpressResponse<List<T>> response)
ReceiveProgressCallback = void Function(int received, int total)
RequestBuilder<T> = FutureOr<List<ParallelRequest<T>>> Function()
SendProgressCallback = void Function(int sent, int total)
StatisticsCallback = void Function(String requestUrl, int requestCount)
ValidatorCallback = bool Function(dynamic response)