WordpressCore 1.2.0
.NET 5.0
This package targets .NET 5.0. The package is compatible with this framework or higher.
.NET Core 3.0
This package targets .NET Core 3.0. The package is compatible with this framework or higher.
.NET Standard 2.1
This package targets .NET Standard 2.1. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package WordpressCore --version 1.2.0
NuGet\Install-Package WordpressCore -Version 1.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WordpressCore" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WordpressCore --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: WordpressCore, 1.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WordpressCore as a Cake Addin #addin nuget:?package=WordpressCore&version=1.2.0 // Install WordpressCore as a Cake Tool #tool nuget:?package=WordpressCore&version=1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
WordpressSharp
Library to interact with Wordpress REST API in a fluent pattern.
Supported Platforms
- .net standard 2.1
- .net 5
- .net core 3.0
- .net core 3.1
Note
This library was developed for one of my client projects to fix many limitations of existing libraries. Library is not yet complete by any means. I have only implemented basic requests and structure. i hope to complete this soon as my time allows me.
Example
You can checkout full sample Here
CookieContainer container = new CookieContainer();
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
WordpressClient client = new WordpressClient("http://demo.wp-api.org/wp-json/", maxConcurrentRequestsPerInstance: 8, timeout: 60)
// add default user agent
.WithDefaultUserAgent("SampleUserAgent")
// use pre configured cookie container
.WithCookieContainer(ref container)
// pass custom json serializer settings if required
.WithJsonSerializerSetting(new JsonSerializerSettings() {
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
MissingMemberHandling = MissingMemberHandling.Ignore
})
// pre process responses received from the api (can be used for custom validation logic etc)
.WithGlobalResponseProcessor((responseReceived) => {
if (string.IsNullOrEmpty(responseReceived)) {
return false;
}
// keep in mind that, returning true here completes the request by deserilizing internally, and then returning the response object.
// returning false will terminate the request and returns a Response object with error status to the caller.
return true;
})
// add default request headers
.WithDefaultRequestHeaders(new KeyValuePair<string, string>("X-Client", "Mobile"), // allows to add custom headers for requests send from this instance
new KeyValuePair<string, string>("X-Version", "1.0"));
// create a Posts request
Response<IEnumerable<Post>> posts = await client.GetPostsAsync((request) => request.OrderResultBy(Order.Ascending)
// only get posts with published status
.SetAllowedStatus(Status.Published)
// specifys the response should contain embed field
.SetEmbeded(true)
// set scope of the request, default is view, set scope as edit for edit requests
.SetScope(Scope.View)
// set allowed categories of post. only posts in these categories will be in response. should be category id.
.AllowCategories(51, 32)
// set allowed authors of post. only posts by these authors will be in response. should be author id.
.AllowAuthors(47, 32, 13, 53)
// adds a cancellation token to the request, allowing to cancel the request anytime as needed
.WithCancellationToken(cancellationTokenSource.Token)
// sets the maximum number of posts in a single page
.WithPerPage(20)
// gets the first page of posts containg 20 posts, specifying 2 here will get next page. used for pagenation
.WithPageNumber(1)
// adds request specific authorization. can be BasicAuth or Jwt Authentication methods. Use plugin for Jwt
.WithAuthorization(new WordpressAuthorization("username", "password", type: WordpressClient.AuthorizationType.Jwt))
// specifiys a response validator/processor for current request
.WithResponseValidationOverride((response) => {
if (string.IsNullOrEmpty(response)) {
return false;
}
// returning true completes the request by returning deserialized response
// returning false terminates the request with an error message
return true;
})
// Should be called at the end of the builder to build the request as a Request object
// pass a Callback container to get events on internal activity for this request
.CreateWithCallback(new Callback(OnException, OnResponseReceived, OnRequestStatus))).ConfigureAwait(false);
if (!posts.Status) {
// Request failed
Console.WriteLine(posts.Message);
return -1;
}
foreach (Post post in posts.Value) {
// do yer magic!
}
Goals
- Implement rest of the endpoints of REST API
- Reduce memory consumption further internally
- Replace
IAsyncEnumerable
with an alternative to support more platforms
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 is compatible. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.0
- HtmlSanitizer (>= 5.0.376)
- Newtonsoft.Json (>= 12.0.3)
-
.NETCoreApp 3.1
- HtmlSanitizer (>= 5.0.376)
- Newtonsoft.Json (>= 12.0.3)
-
.NETStandard 2.1
- HtmlSanitizer (>= 5.0.376)
- Newtonsoft.Json (>= 12.0.3)
-
net5.0
- HtmlSanitizer (>= 5.0.376)
- Newtonsoft.Json (>= 12.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
1.3.8.10 | 449 | 4/11/2021 | |
1.3.8.9 | 306 | 4/11/2021 | |
1.3.8.8 | 329 | 4/11/2021 | |
1.3.8.7 | 332 | 4/11/2021 | |
1.3.8.6 | 290 | 4/6/2021 | |
1.3.8.5 | 315 | 4/6/2021 | |
1.3.8.4 | 302 | 4/4/2021 | |
1.3.8.3 | 310 | 3/29/2021 | |
1.3.8.2 | 320 | 3/29/2021 | |
1.3.8.1 | 364 | 3/27/2021 | |
1.3.8 | 362 | 3/27/2021 | |
1.3.7 | 354 | 3/24/2021 | |
1.3.6 | 380 | 3/22/2021 | |
1.3.5 | 302 | 3/22/2021 | |
1.3.4 | 414 | 3/20/2021 | |
1.3.3 | 409 | 3/12/2021 | |
1.3.2 | 407 | 3/10/2021 | |
1.3.1 | 430 | 3/10/2021 | |
1.3.0 | 409 | 3/6/2021 | |
1.2.0 | 375 | 3/3/2021 |