Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Helpers and Extensions

Marco Siccardi edited this page Mar 17, 2018 · 1 revision

Extensions

string ToArrayString(this int[] array)

creates a string from an int array

IEnumerable<CommentWithChildLevel> OrderCommentsByParentAndDate(this WordPressEntitySet<Comment> comments)

orders the WordPressEntitySet<Comment> by parent and date

string ToSlug(this string url)

extracts the slug from a standard WordPress post url (may not work if you have a custom url scheme)

UrlHelper methods

GetEntitySetApiUrl(this string baseUrl, Resource resource = Resource.Posts, int perPage = 10, int count = 10, int pageNr = 1, OrderBy orderby = OrderBy.Date, Order order = Order.Desc)

creates an url to get an EntitySet based on the resource and several parameters, to be passed to custom handlers

GetEntityApiUrl(this string baseUrl, long id, Resource resource = Resource.Posts)

creates an url to get an Entity based on the resource and id, to be passed to custom handlers

GetPostApiUrl(this string baseUrl, Resource resource = Resource.Comments)

creates an url for POST requests on the WordPress API. Currently only support the comments resource

AddParameterToUrl(this string url, string parameterName, string parameterValue)

adds one additional parameter to an EntityApiUrl or an EntitySetApiUrl

AddParametersToUrl(this string url, Dictionary<string, string> parameters)

adds multiple additional parameters to an EntityApiUrl or an EntitySetApiUrl

Clone this wiki locally