Documentation ¶
Index ¶
Constants ¶
const ( CollectionUsers = "users" CollectionPosts = "posts" CollectionPages = "pages" CollectionMedia = "media" CollectionMeta = "meta" CollectionRevisions = "revisions" CollectionComments = "comments" CollectionTaxonomies = "taxonomies" CollectionTerms = "terms" CollectionStatuses = "statuses" CollectionTypes = "types" )
Collection names for WordPress that are used in the API after the base URL.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a WordPress API client.
func (*Client) Get ¶
Get sends a GET request to the specified WordPress URL and returns the response body. The base URL is prepended to the URL, for example: https://wordpress/wp-json/wp/v2/posts/21
func (*Client) GetAndUnmarshal ¶
GetAndUnmarshal performs an HTTP GET request to the specified WordPress URL, unmarshal the response body into the provided struct type, and returns any error.
type Content ¶
type Content struct { Raw string `json:"raw,omitempty"` Rendered string `json:"rendered,omitempty"` }
Content represents a WordPress content.
type Excerpt ¶
type Excerpt struct { Raw string `json:"raw,omitempty"` Rendered string `json:"rendered,omitempty"` }
Excerpt represents a WordPress excerpt.
type Media ¶
type Media struct { ID int `json:"id,omitempty"` Date string `json:"date,omitempty"` DateGMT string `json:"date_gmt,omitempty"` GUID GUID `json:"guid,omitempty"` Link string `json:"link,omitempty"` Modified string `json:"modified,omitempty"` ModifiedGMT string `json:"modifiedGMT,omitempty"` //nolint Password string `json:"password,omitempty"` Slug string `json:"slug,omitempty"` Status string `json:"status,omitempty"` Type string `json:"type,omitempty"` Title Title `json:"title,omitempty"` Author int `json:"author,omitempty"` MediaStatus string `json:"comment_status,omitempty"` PingStatus string `json:"ping_status,omitempty"` AltText string `json:"alt_text,omitempty"` Caption any `json:"caption,omitempty"` Description any `json:"description,omitempty"` MediaType string `json:"media_type,omitempty"` MediaDetails MediaDetails `json:"media_details,omitempty"` Post int `json:"post,omitempty"` SourceURL string `json:"source_url,omitempty"` }
Media represents a media item in WordPress.
type MediaDetails ¶
type MediaDetails struct { Raw string `json:"raw,omitempty"` Rendered string `json:"rendered,omitempty"` Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` File string `json:"file,omitempty"` Sizes MediaDetailsSizes `json:"sizes,omitempty"` ImageMeta map[string]interface{} `json:"image_meta,omitempty"` }
MediaDetails represents details of a media item.
type MediaDetailsSizes ¶
type MediaDetailsSizes struct { Thumbnail MediaDetailsSizesItem `json:"thumbnail,omitempty"` Medium MediaDetailsSizesItem `json:"medium,omitempty"` Large MediaDetailsSizesItem `json:"large,omitempty"` SiteLogo MediaDetailsSizesItem `json:"site-logo,omitempty"` //nolint }
MediaDetailsSizes represents different sizes of a media item.
type MediaDetailsSizesItem ¶
type MediaDetailsSizesItem struct { File string `json:"file,omitempty"` Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` MimeType string `json:"mime_type,omitempty"` SourceURL string `json:"source_url,omitempty"` }
MediaDetailsSizesItem represents details of a specific size of a media item.
type MediaUploadOptions ¶
MediaUploadOptions represents options for uploading media.
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options represents options for configuring the WordPress client.
func (Options) WithBaseURL ¶
WithBaseURL sets the base URL for the WordPress client.
func (Options) WithBasicAuth ¶
WithBasicAuth sets the basic authentication credentials for the WordPress client.
type Post ¶
type Post struct { ID int `json:"id,omitempty"` Date string `json:"date,omitempty"` DateGMT string `json:"date_gmt,omitempty"` GUID GUID `json:"guid,omitempty"` Link string `json:"link,omitempty"` Modified string `json:"modified,omitempty"` ModifiedGMT string `json:"modifiedGMT,omitempty"` //nolint Password string `json:"password,omitempty"` Slug string `json:"slug,omitempty"` Status string `json:"status,omitempty"` Type string `json:"type,omitempty"` Title Title `json:"title,omitempty"` Content Content `json:"content,omitempty"` Author int `json:"author,omitempty"` Excerpt Excerpt `json:"excerpt,omitempty"` FeaturedImage int `json:"featured_image,omitempty"` CommentStatus string `json:"comment_status,omitempty"` PingStatus string `json:"ping_status,omitempty"` Format string `json:"format,omitempty"` Sticky bool `json:"sticky,omitempty"` }
Post represents a WordPress post.