Versions in this module Expand all Collapse all v1 v1.0.2 Jun 18, 2024 v1.0.1 Jun 18, 2024 v1.0.0 Jun 18, 2024 Changes in this version + const CommentStatusApproved + const CommentStatusClosed + const CommentStatusOpen + const CommentStatusUnapproved + const PingStatusClosed + const PingStatusOpen + const PostFormatAside + const PostFormatChat + const PostFormatGallery + const PostFormatImage + const PostFormatLink + const PostFormatQuote + const PostFormatStandard + const PostFormatStatus + const PostFormatVideo + const PostStatusDraft + const PostStatusPending + const PostStatusPrivate + const PostStatusPublish + const PostStatusTrash + const PostTypePage + const PostTypePost + const TimeLayout + const TimeWithZoneLayout + var DefaultHTTPClient = &http.Client + var DefaultHTTPTransport = &http.Transport + var ErrURLContainsWPV2 = errors.New("url must not contain /wp/v2") + var Location = time.UTC + type AvatarURLS struct + Size24 string + Size48 string + Size96 string + type BasicAuthTransport struct + Password string + Transport http.RoundTripper + Username string + func (t *BasicAuthTransport) Client() *http.Client + func (t *BasicAuthTransport) RoundTrip(req *http.Request) (*http.Response, error) + type CategoriesService service + func (c *CategoriesService) Create(ctx context.Context, newCategory *Category) (*Category, *Response, error) + func (c *CategoriesService) Delete(ctx context.Context, id int, params interface{}) (*Category, *Response, error) + func (c *CategoriesService) Get(ctx context.Context, id int, params interface{}) (*Category, *Response, error) + func (c *CategoriesService) List(ctx context.Context, opts *CategoryListOptions) ([]*Category, *Response, error) + func (c *CategoriesService) Update(ctx context.Context, id int, post *Category) (*Category, *Response, error) + type Category struct + Count int + Description string + ID int + Link string + Name string + Parent int + Slug string + Taxonomy string + type CategoryListOptions struct + HideEmpty bool + Parent int + Post int + Slug []string + type Client struct + Categories *CategoriesService + Comments *CommentsService + Location *time.Location + Media *MediaService + Pages *PagesService + Posts *PostsService + Settings *SettingsService + Statuses *StatusesService + Tags *TagsService + Taxonomies *TaxonomiesService + Terms *TermsService + Types *TypesService + UserAgent string + Users *UsersService + func NewClient(baseURL string, httpClient *http.Client) (*Client, error) + func (c *Client) BasicInfo(ctx context.Context) (*RootInfo, *Response, error) + func (c *Client) Create(ctx context.Context, url string, content interface{}, result interface{}) (*Response, error) + func (c *Client) Delete(ctx context.Context, url string, params interface{}, result interface{}) (*Response, error) + func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error) + func (c *Client) Get(ctx context.Context, url string, params interface{}, result interface{}) (*Response, error) + func (c *Client) List(ctx context.Context, url string, params interface{}, result interface{}) (*Response, error) + func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) + func (c *Client) PostData(ctx context.Context, urlStr string, content []byte, contentType string, ...) (*Response, error) + func (c *Client) Update(ctx context.Context, url string, content interface{}, result interface{}) (*Response, error) + type Comment struct + Author int + AuthorEmail string + AuthorIP string + AuthorName string + AuthorURL string + AuthorUserAgent string + AvatarURL string + AvatarURLs AvatarURLS + Content RenderedString + Date Time + DateGMT Time + ID int + Karma int + Link string + Parent int + Post int + Status string + Type string + type CommentListOptions struct + After *time.Time + Author []int + AuthorEmail string + AuthorExclude []int + Before *time.Time + Parent []int + ParentExclude []int + Password string + Post []int + Status string + Type string + type CommentsService service + func (c *CommentsService) Create(ctx context.Context, newComment *Comment) (*Comment, *Response, error) + func (c *CommentsService) Delete(ctx context.Context, id int, params interface{}) (*Comment, *Response, error) + func (c *CommentsService) Get(ctx context.Context, id int, params interface{}) (*Comment, *Response, error) + func (c *CommentsService) List(ctx context.Context, opts *CommentListOptions) ([]*Comment, *Response, error) + func (c *CommentsService) Update(ctx context.Context, id int, post *Comment) (*Comment, *Response, error) + type DeleteResponse struct + Deleted bool + Previous json.RawMessage + type DiscoveredAPI struct + BaseURL string + BasicInfo *RootInfo + Client *Client + DiscoveredURL string + ViaHTML bool + ViaHeader bool + func DiscoverAPI(baseURL string, getRootInfo bool) (*DiscoveredAPI, error) + type Error struct + Code string + Data struct{ ... } + Message string + Response *http.Response + func (e *Error) Error() string + type ListOptions struct + Context string + Exclude []int + Include []int + Offset int + Order string + OrderBy string + Page int + PerPage int + Search string + type Media struct + AltText string + Author int + Caption RenderedString + Date Time + DateGMT Time + Description RenderedString + GUID RenderedString + ID int + Link string + MediaDetails MediaDetails + MediaStatus string + MediaType string + Modified Time + ModifiedGMT Time + Password string + PingStatus string + Post int + Slug string + SourceURL string + Status string + Title RenderedString + Type string + type MediaDetails struct + File string + Height int + ImageMeta map[string]interface{} + Raw string + Rendered string + Sizes MediaDetailsSizes + Width int + type MediaDetailsSizes struct + Full MediaDetailsSizesItem + Large MediaDetailsSizesItem + Medium MediaDetailsSizesItem + SiteLogo MediaDetailsSizesItem + Thumbnail MediaDetailsSizesItem + type MediaDetailsSizesItem struct + File string + Height int + MimeType string + SourceURL string + Width int + type MediaListOptions struct + After *time.Time + Author []int + AuthorExclude []int + Before *time.Time + MediaType string + MimeType string + Parent []int + ParentExclude []int + Slug []string + Status []string + type MediaService service + func (c *MediaService) Create(ctx context.Context, options *MediaUploadOptions) (*Media, *Response, error) + func (c *MediaService) Delete(ctx context.Context, id int, params interface{}) (*Media, *Response, error) + func (c *MediaService) Get(ctx context.Context, id int, params interface{}) (*Media, *Response, error) + func (c *MediaService) List(ctx context.Context, opts *MediaListOptions) ([]*Media, *Response, error) + type MediaUploadOptions struct + ContentType string + Data []byte + Filename string + type Page struct + Author int + CommentStatus string + Content RenderedString + Date Time + DateGMT Time + Excerpt RenderedString + FeaturedImage int + GUID RenderedString + ID int + Link string + MenuOrder int + Modified Time + ModifiedGMT Time + Parent int + Password string + PingStatus string + Slug string + Status string + Template string + Title RenderedString + Type string + func (entity *Page) Populate(ctx context.Context, params interface{}) (*Page, *Response, error) + func (entity *Page) Revisions() *RevisionsService + type PageListOptions struct + After *time.Time + Author []int + AuthorExclude []int + Before *time.Time + MenuOrder int + Parent []int + ParentExclude []int + Slug []string + Status []string + type PagesService service + func (c *PagesService) Create(ctx context.Context, newPage *Page) (*Page, *Response, error) + func (c *PagesService) Delete(ctx context.Context, id int, params interface{}) (*Page, *Response, error) + func (c *PagesService) Entity(id int) *Page + func (c *PagesService) Get(ctx context.Context, id int, params interface{}) (*Page, *Response, error) + func (c *PagesService) List(ctx context.Context, opts *PageListOptions) ([]*Page, *Response, error) + func (c *PagesService) Update(ctx context.Context, id int, page *Page) (*Page, *Response, error) + type Post struct + Author int + Categories []int + CommentStatus string + Content RenderedString + Date Time + DateGMT Time + Excerpt RenderedString + FeaturedMedia int + Format string + GUID RenderedString + ID int + Link string + Modified Time + ModifiedGMT Time + Password string + PingStatus string + Slug string + Status string + Sticky bool + Subtitle string + Tags []int + Template string + Title RenderedString + Type string + func (entity *Post) Populate(ctx context.Context, params interface{}) (*Post, *Response, error) + func (entity *Post) Revisions() *RevisionsService + func (entity *Post) Terms() *PostsTermsService + type PostListOptions struct + After *time.Time + Author []int + AuthorExclude []int + Before *time.Time + Categories []int + CategoriesExclude []int + Slug []string + Status []string + Sticky bool + Tags []int + TagsExclude []int + type PostsService service + func (c *PostsService) Create(ctx context.Context, newPost *Post) (*Post, *Response, error) + func (c *PostsService) Delete(ctx context.Context, id int, params interface{}) (*Post, *Response, error) + func (c *PostsService) Entity(id int) *Post + func (c *PostsService) Get(ctx context.Context, id int, params interface{}) (*Post, *Response, error) + func (c *PostsService) List(ctx context.Context, opts *PostListOptions) ([]*Post, *Response, error) + func (c *PostsService) Update(ctx context.Context, id int, post *Post) (*Post, *Response, error) + type PostsTerm struct + Count int + Description string + ID int + Link string + Name string + Parent int + Slug string + Taxonomy string + type PostsTermsService struct + func (c *PostsTermsService) Category() *PostsTermsTaxonomyService + func (c *PostsTermsService) List(ctx context.Context, taxonomy string, params interface{}) ([]*PostsTerm, *Response, error) + func (c *PostsTermsService) Tag() *PostsTermsTaxonomyService + type PostsTermsTaxonomyService struct + func (c *PostsTermsTaxonomyService) Create(ctx context.Context, id int) (*PostsTerm, *Response, error) + func (c *PostsTermsTaxonomyService) Delete(ctx context.Context, id int, params interface{}) (*PostsTerm, *Response, error) + func (c *PostsTermsTaxonomyService) Get(ctx context.Context, id int, params interface{}) (*PostsTerm, *Response, error) + func (c *PostsTermsTaxonomyService) List(ctx context.Context, params interface{}) ([]*PostsTerm, *Response, error) + type RenderedString struct + Raw string + Rendered string + type Response struct + NextPage int + PreviousPage int + TotalPages int + TotalRecords int + type Revision struct + Author int + Content RenderedString + Date Time + DateGMT Time + Excerpt RenderedString + GUID RenderedString + ID int + Modified Time + ModifiedGMT Time + Parent int + Slug string + Title RenderedString + type RevisionsService struct + func (c *RevisionsService) Delete(ctx context.Context, id int, params interface{}) (*Revision, *Response, error) + func (c *RevisionsService) Get(ctx context.Context, id int, params interface{}) (*Revision, *Response, error) + func (c *RevisionsService) List(ctx context.Context, params interface{}) ([]*Revision, *Response, error) + type RootInfo struct + Authentication interface{} + Description string + GMTOffset int + HomeURL string + Location *time.Location + Name string + Namespaces []string + PermalinkStructure string + TimezoneString string + URL string + type Settings struct + DateFormat string + DefaultCategory int + DefaultCommentStatus string + DefaultPingStatus string + DefaultPostFormat string + Description string + Email string + Language string + PostsPerPage int + StartOfWeek int + TimeFormat string + Timezone string + Title string + URL string + UseSmilies bool + type SettingsService service + func (c *SettingsService) List(ctx context.Context) (*Settings, *Response, error) + type Status struct + Name string + Private bool + Public bool + Queryable bool + ShowInList bool + Slug string + type Statuses struct + Draft Status + Future Status + Pending Status + Private Status + Publish Status + type StatusesService service + func (c *StatusesService) Get(ctx context.Context, slug string, params interface{}) (*Status, *Response, error) + func (c *StatusesService) List(ctx context.Context, params interface{}) (*Statuses, *Response, error) + type Tag struct + Count int + Description string + ID int + Link string + Name string + Slug string + Taxonomy string + type TagListOptions struct + HideEmpty bool + Post int + Slug []string + type TagsService service + func (c *TagsService) Create(ctx context.Context, newTag *Tag) (*Tag, *Response, error) + func (c *TagsService) Delete(ctx context.Context, id int, params interface{}) (*Tag, *Response, error) + func (c *TagsService) Get(ctx context.Context, id int, params interface{}) (*Tag, *Response, error) + func (c *TagsService) List(ctx context.Context, opts *TagListOptions) ([]*Tag, *Response, error) + func (c *TagsService) Update(ctx context.Context, id int, post *Tag) (*Tag, *Response, error) + type TaxonomiesService service + func (c *TaxonomiesService) Get(ctx context.Context, slug string, params interface{}) (*Taxonomy, *Response, error) + func (c *TaxonomiesService) List(ctx context.Context, params interface{}) (map[string]Taxonomy, *Response, error) + type Taxonomy struct + Description string + Hierarchical bool + Labels map[string]interface{} + Name string + ShowCloud bool + Slug string + Types []string + type Term struct + Count int + Description string + ID int + Link string + Name string + Parent int + Slug string + Taxonomy string + type TermsService service + func (c *TermsService) Category() *TermsTaxonomyService + func (c *TermsService) List(ctx context.Context, taxonomy string, params interface{}) ([]*Term, *Response, error) + func (c *TermsService) Tag() *TermsTaxonomyService + type TermsTaxonomyService struct + func (c *TermsTaxonomyService) Create(ctx context.Context, newTerm *Term) (*Term, *Response, error) + func (c *TermsTaxonomyService) Delete(ctx context.Context, id int, params interface{}) (*Term, *Response, error) + func (c *TermsTaxonomyService) Get(ctx context.Context, id int, params interface{}) (*Term, *Response, error) + func (c *TermsTaxonomyService) List(ctx context.Context, params interface{}) ([]*Term, *Response, error) + func (c *TermsTaxonomyService) Update(ctx context.Context, id int, post *Term) (*Term, *Response, error) + type Time struct + func (t *Time) MarshalJSON() ([]byte, error) + func (t *Time) UnmarshalJSON(b []byte) error + type Type struct + Description string + Hierarchical bool + Labels TypeLabels + Name string + Slug string + type TypeLabels struct + AddNew string + AddNewItem string + AllItems string + EditItem string + MenuName string + Name string + NameAdminBar string + NewItem string + NotFound string + NotFoundInTrash string + ParentItemColon string + SearchItems string + SingularName string + ViewItem string + type Types struct + Attachment Type + Page Type + Post Type + type TypesService service + func (c *TypesService) Get(ctx context.Context, slug string, params interface{}) (*Type, *Response, error) + func (c *TypesService) List(ctx context.Context, params interface{}) (*Types, *Response, error) + type User struct + AvatarURL string + AvatarURLs AvatarURLS + Capabilities map[string]interface{} + Description string + Email string + ExtraCapabilities map[string]interface{} + FirstName string + ID int + LastName string + Link string + Locale string + Name string + Nickname string + Password string + RegisteredDate Time + Roles []string + Slug string + URL string + Username string + type UserListOptions struct + Roles []string + Slug []string + type UsersService service + func (c *UsersService) Create(ctx context.Context, newUser *User) (*User, *Response, error) + func (c *UsersService) Delete(ctx context.Context, id int, params interface{}) (*User, *Response, error) + func (c *UsersService) Get(ctx context.Context, id int, params interface{}) (*User, *Response, error) + func (c *UsersService) List(ctx context.Context, opts *UserListOptions) ([]*User, *Response, error) + func (c *UsersService) Me(ctx context.Context, params interface{}) (*User, *Response, error) + func (c *UsersService) Update(ctx context.Context, id int, user *User) (*User, *Response, error)