Documentation
¶
Index ¶
- Constants
- Variables
- type AvatarURLS
- type Client
- func (client *Client) Comments() *CommentsCollection
- func (client *Client) Create(url string, content interface{}, result interface{}) (*http.Response, []byte, error)
- func (client *Client) Delete(url string, params interface{}, result interface{}) (*http.Response, []byte, error)
- func (client *Client) Get(url string, params interface{}, result interface{}) (*http.Response, []byte, error)
- func (client *Client) List(url string, params interface{}, result interface{}) (*http.Response, []byte, error)
- func (client *Client) Media() *MediaCollection
- func (client *Client) Pages() *PagesCollection
- func (client *Client) PostData(url string, content []byte, contentType string, filename string, ...) (*http.Response, []byte, error)
- func (client *Client) Posts() *PostsCollection
- func (client *Client) Statuses() *StatusesCollection
- func (client *Client) Taxonomies() *TaxonomiesCollection
- func (client *Client) Terms() *TermsCollection
- func (client *Client) Types() *TypesCollection
- func (client *Client) Update(url string, content interface{}, result interface{}) (*http.Response, []byte, error)
- func (client *Client) Users() *UsersCollection
- type Comment
- type CommentsCollection
- func (col *CommentsCollection) Create(new *Comment) (*Comment, *http.Response, []byte, error)
- func (col *CommentsCollection) Delete(id int, params interface{}) (*Comment, *http.Response, []byte, error)
- func (col *CommentsCollection) Get(id int, params interface{}) (*Comment, *http.Response, []byte, error)
- func (col *CommentsCollection) List(params interface{}) ([]Comment, *http.Response, []byte, error)
- func (col *CommentsCollection) Update(id int, post *Comment) (*Comment, *http.Response, []byte, error)
- type Content
- type Excerpt
- type GUID
- type GeneralError
- type Media
- type MediaCollection
- func (col *MediaCollection) Create(options *MediaUploadOptions) (*Media, *http.Response, []byte, error)
- func (col *MediaCollection) Delete(id int, params interface{}) (*Media, *http.Response, []byte, error)
- func (col *MediaCollection) Get(id int, params interface{}) (*Media, *http.Response, []byte, error)
- func (col *MediaCollection) List(params interface{}) ([]Media, *http.Response, []byte, error)
- type MediaDetails
- type MediaDetailsSizes
- type MediaDetailsSizesItem
- type MediaUploadOptions
- type Meta
- type MetaCollection
- func (col *MetaCollection) Create(new *Meta) (*Meta, *http.Response, []byte, error)
- func (col *MetaCollection) Delete(id int, params interface{}) (*MetaDeletedResponse, *http.Response, []byte, error)
- func (col *MetaCollection) Get(id int, params interface{}) (*Meta, *http.Response, []byte, error)
- func (col *MetaCollection) List(params interface{}) ([]Meta, *http.Response, []byte, error)
- func (col *MetaCollection) Update(id int, meta *Meta) (*Meta, *http.Response, []byte, error)
- type MetaDeletedResponse
- type Options
- type Page
- type PagesCollection
- func (col *PagesCollection) Create(new *Page) (*Page, *http.Response, []byte, error)
- func (col *PagesCollection) Delete(id int, params interface{}) (*Page, *http.Response, []byte, error)
- func (col *PagesCollection) Entity(id int) *Page
- func (col *PagesCollection) Get(id int, params interface{}) (*Page, *http.Response, []byte, error)
- func (col *PagesCollection) List(params interface{}) ([]Page, *http.Response, []byte, error)
- func (col *PagesCollection) Update(id int, page *Page) (*Page, *http.Response, []byte, error)
- type Post
- type PostsCollection
- func (col *PostsCollection) Create(new *Post) (*Post, *http.Response, []byte, error)
- func (col *PostsCollection) Delete(id int, params interface{}) (*Post, *http.Response, []byte, error)
- func (col *PostsCollection) Entity(id int) *Post
- func (col *PostsCollection) Get(id int, params interface{}) (*Post, *http.Response, []byte, error)
- func (col *PostsCollection) List(params interface{}) ([]Post, *http.Response, []byte, error)
- func (col *PostsCollection) Update(id int, post *Post) (*Post, *http.Response, []byte, error)
- type PostsTerm
- type PostsTermsCollection
- type PostsTermsTaxonomyCollection
- func (col *PostsTermsTaxonomyCollection) Create(id int) (*PostsTerm, *http.Response, []byte, error)
- func (col *PostsTermsTaxonomyCollection) Delete(id int, params interface{}) (*PostsTerm, *http.Response, []byte, error)
- func (col *PostsTermsTaxonomyCollection) Get(id int, params interface{}) (*PostsTerm, *http.Response, []byte, error)
- func (col *PostsTermsTaxonomyCollection) List(params interface{}) ([]PostsTerm, *http.Response, []byte, error)
- type Revision
- type RevisionsCollection
- func (col *RevisionsCollection) Delete(id int, params interface{}) (bool, *http.Response, []byte, error)
- func (col *RevisionsCollection) Get(id int, params interface{}) (*Revision, *http.Response, []byte, error)
- func (col *RevisionsCollection) List(params interface{}) ([]Revision, *http.Response, []byte, error)
- type Status
- type Statuses
- type StatusesCollection
- type TaxonomiesCollection
- type Taxonomy
- type Term
- type TermsCollection
- type TermsTaxonomyCollection
- func (col *TermsTaxonomyCollection) Create(new *Term) (*Term, *http.Response, []byte, error)
- func (col *TermsTaxonomyCollection) Delete(id int, params interface{}) (*Term, *http.Response, []byte, error)
- func (col *TermsTaxonomyCollection) Get(id int, params interface{}) (*Term, *http.Response, []byte, error)
- func (col *TermsTaxonomyCollection) List(params interface{}) ([]Term, *http.Response, []byte, error)
- func (col *TermsTaxonomyCollection) Update(id int, post *Term) (*Term, *http.Response, []byte, error)
- type Title
- type Type
- type TypeLabels
- type Types
- type TypesCollection
- type User
- type UsersCollection
- func (col *UsersCollection) Create(new *User) (*User, *http.Response, []byte, error)
- func (col *UsersCollection) Delete(id int, params interface{}) (*User, *http.Response, []byte, error)
- func (col *UsersCollection) Get(id int, params interface{}) (*User, *http.Response, []byte, error)
- func (col *UsersCollection) List(params interface{}) ([]User, *http.Response, []byte, error)
- func (col *UsersCollection) Me(params interface{}) (*User, *http.Response, []byte, error)
- func (col *UsersCollection) Update(id int, post *User) (*User, *http.Response, []byte, error)
Constants ¶
View Source
const ( CollectionUsers = "users" CollectionPosts = "posts" CollectionPages = "pages" CollectionMedia = "media" CollectionMeta = "meta" CollectionRevisions = "revisions" CollectionComments = "comments" CollectionTaxonomies = "taxonomies" CollectionTerms = "terms" CollectionStatuses = "statuses" CollectionTypes = "types" )
View Source
const ( PostStatusDraft = "draft" PostStatusPending = "pending" PostStatusPrivate = "private" PostStatusPublish = "publish" PostStatusTrash = "trash" PostTypePost = "post" PostTypePage = "page" CommentStatusOpen = "open" CommentStatusClosed = "closed" CommentStatusApproved = "approved" CommentStatusUnapproved = "unapproved" PingStatusOpen = "open" PingStatusClosed = "closed" PostFormatStandard = "standard" PostFormatAside = "aside" PostFormatGallery = "gallery" PostFormatImage = "image" PostFormatLink = "link" PostFormatStatus = "status" PostFormatQuote = "quote" PostFormatVideo = "video" PostFormatChat = "chat" )
Variables ¶
View Source
var DEBUG bool = (os.Getenv("DEBUG") == "1")
Functions ¶
This section is empty.
Types ¶
type AvatarURLS ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Comments ¶
func (client *Client) Comments() *CommentsCollection
func (*Client) Media ¶
func (client *Client) Media() *MediaCollection
func (*Client) Pages ¶
func (client *Client) Pages() *PagesCollection
func (*Client) Posts ¶
func (client *Client) Posts() *PostsCollection
func (*Client) Statuses ¶
func (client *Client) Statuses() *StatusesCollection
func (*Client) Taxonomies ¶
func (client *Client) Taxonomies() *TaxonomiesCollection
func (*Client) Terms ¶
func (client *Client) Terms() *TermsCollection
func (*Client) Types ¶
func (client *Client) Types() *TypesCollection
func (*Client) Users ¶
func (client *Client) Users() *UsersCollection
type Comment ¶
type Comment struct {
ID int `json:"id,omitempty"`
AvatarURL string `json:"avatar_url,omitempty"`
AvatarURLs AvatarURLS `json:"avatar_urls,omitempty"`
Author int `json:"author,omitempty"`
AuthorEmail string `json:"author_email,omitempty"`
AuthorIP string `json:"author_ip,omitempty"`
AuthorName string `json:"author_name,omitempty"`
AuthorURL string `json:"author_url,omitempty"`
AuthorUserAgent string `json:"author_user_agent,omitempty"`
Content Content `json:"content,omitempty"`
Date string `json:"date,omitempty"`
DateGMT string `json:"date_gmt,omitempty"`
Karma int `json:"karma,omitempty"`
Link string `json:"link,omitempty"`
Parent int `json:"parent,omitempty"`
Post int `json:"post,omitempty"`
Status string `json:"status,omitempty"`
Type string `json:"type,omitempty"`
}
type CommentsCollection ¶
type CommentsCollection struct {
// contains filtered or unexported fields
}
type GeneralError ¶
type GeneralError struct {
Code string `json:"code"`
Message string `json:"message"`
Data int `json:"data"` // Unsure if this is consistent
}
func UnmarshallServerError ¶
func UnmarshallServerError(body []byte) ([]GeneralError, error)
UnmarshallServerError A helper function to unmarshall error response from server
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"`
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 string `json:"caption,omitempty"`
Description string `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"`
}
type MediaCollection ¶
type MediaCollection struct {
// contains filtered or unexported fields
}
func (*MediaCollection) Create ¶
func (col *MediaCollection) Create(options *MediaUploadOptions) (*Media, *http.Response, []byte, error)
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"`
}
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"`
}
type MediaDetailsSizesItem ¶
type MediaUploadOptions ¶
type MetaCollection ¶
type MetaCollection struct {
// contains filtered or unexported fields
}
func (*MetaCollection) Delete ¶
func (col *MetaCollection) Delete(id int, params interface{}) (*MetaDeletedResponse, *http.Response, []byte, error)
type MetaDeletedResponse ¶
type MetaDeletedResponse struct {
Message string `json:"message,omitempty"`
}
type Page ¶
type Page 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"`
Password string `json:"password,omitempty"`
Slug string `json:"slug,omitempty"`
Status string `json:"status,omitempty"`
Type string `json:"type,omitempty"`
Parent int `json:"parent,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"`
MenuOrder int `json:"menu_order,omitempty"`
Template string `json:"template,omitempty"`
// contains filtered or unexported fields
}
func (*Page) Meta ¶
func (entity *Page) Meta() *MetaCollection
func (*Page) Revisions ¶
func (entity *Page) Revisions() *RevisionsCollection
type PagesCollection ¶
type PagesCollection struct {
// contains filtered or unexported fields
}
func (*PagesCollection) Entity ¶
func (col *PagesCollection) Entity(id int) *Page
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"`
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"`
// contains filtered or unexported fields
}
func (*Post) Meta ¶
func (entity *Post) Meta() *MetaCollection
func (*Post) Revisions ¶
func (entity *Post) Revisions() *RevisionsCollection
func (*Post) Terms ¶
func (entity *Post) Terms() *PostsTermsCollection
type PostsCollection ¶
type PostsCollection struct {
// contains filtered or unexported fields
}
func (*PostsCollection) Entity ¶
func (col *PostsCollection) Entity(id int) *Post
type PostsTerm ¶
type PostsTerm struct {
ID int `json:"id,omitempty"`
Count int `json:"integer,omitempty"`
Description string `json:"description,omitempty"`
Link string `json:"link,omitempty"`
Name string `json:"name"`
Slug string `json:"slug,omitempty"`
Taxonomy string `json:"taxonomy,omitempty"`
Parent int `json:"parent,omitempty"`
}
type PostsTermsCollection ¶
type PostsTermsCollection struct {
// contains filtered or unexported fields
}
func (*PostsTermsCollection) Category ¶
func (col *PostsTermsCollection) Category() *PostsTermsTaxonomyCollection
func (*PostsTermsCollection) Tag ¶
func (col *PostsTermsCollection) Tag() *PostsTermsTaxonomyCollection
type PostsTermsTaxonomyCollection ¶
type PostsTermsTaxonomyCollection struct {
// contains filtered or unexported fields
}
type Revision ¶
type Revision struct {
ID int `json:"id,omitempty"`
Author string `json:"author,omitempty"` // TODO: File a WP-API bug, why am I getting string instead of int?
Date string `json:"date,omitempty"`
DateGMT string `json:"dateGMT,omitempty"`
GUID string `json:"guid,omitempty"`
Modified string `json:"modified,omitempty"`
ModifiedGMT string `json:"modifiedGMT,omitempty"`
Parent int `json:"parent,omitempty"`
Slug string `json:"slug,omitempty"`
Title string `json:"title,omitempty"`
Content string `json:"content,omitempty"`
Excerpt string `json:"excerpt,omitempty"`
}
type RevisionsCollection ¶
type RevisionsCollection struct {
// contains filtered or unexported fields
}
func (*RevisionsCollection) Delete ¶
func (col *RevisionsCollection) Delete(id int, params interface{}) (bool, *http.Response, []byte, error)
TODO: file an issue for inconsistent response
type StatusesCollection ¶
type StatusesCollection struct {
// contains filtered or unexported fields
}
type TaxonomiesCollection ¶
type TaxonomiesCollection struct {
// contains filtered or unexported fields
}
type Taxonomy ¶
type Taxonomy struct {
Description string `json:"description,omitempty"`
Hierarchical bool `json:"hierarchical,omitempty"`
Labels map[string]interface{} `json:"labels,omitempty"`
Name string `json:"name,omitempty"`
Slug string `json:"slug,omitempty"`
ShowCloud bool `json:"show_cloud,omitempty"`
Types []string `json:"types,omitempty"`
}
type Term ¶
type Term struct {
ID int `json:"id,omitempty"`
Count int `json:"integer,omitempty"`
Description string `json:"description,omitempty"`
Link string `json:"link,omitempty"`
Name string `json:"name"`
Slug string `json:"slug,omitempty"`
Taxonomy string `json:"taxonomy,omitempty"`
Parent int `json:"parent,omitempty"`
}
type TermsCollection ¶
type TermsCollection struct {
// contains filtered or unexported fields
}
func (*TermsCollection) Category ¶
func (col *TermsCollection) Category() *TermsTaxonomyCollection
func (*TermsCollection) Tag ¶
func (col *TermsCollection) Tag() *TermsTaxonomyCollection
type TermsTaxonomyCollection ¶
type TermsTaxonomyCollection struct {
// contains filtered or unexported fields
}
type Type ¶
type Type struct {
Description string `json:"description,omitempty"`
Hierarchical bool `json:"hierarchical,omitempty"`
Name string `json:"name,omitempty"`
Slug string `json:"slug,omitempty"`
Labels TypeLabels `json:"labels,omitempty"`
}
type TypeLabels ¶
type TypeLabels struct {
Name string `json:"name,omitempty"`
SingularName string `json:"singular_name,omitempty"`
AddNew string `json:"add_new,omitempty"`
AddNewItem string `json:"add_new_item,omitempty"`
EditItem string `json:"edit_item,omitempty"`
NewItem string `json:"new_item,omitempty"`
ViewItem string `json:"view_item,omitempty"`
SearchItems string `json:"search_items,omitempty"`
NotFound string `json:"not_found,omitempty"`
NotFoundInTrash string `json:"not_found_in_trash,omitempty"`
ParentItemColon string `json:"parent_item_colon,omitempty"`
AllItems string `json:"all_items,omitempty"`
MenuName string `json:"menu_name,omitempty"`
NameAdminBar string `json:"name_admin_bar,omitempty"`
}
type TypesCollection ¶
type TypesCollection struct {
// contains filtered or unexported fields
}
type User ¶
type User struct {
ID int `json:"id,omitempty"`
AvatarURL string `json:"avatar_url,omitempty"`
AvatarURLs AvatarURLS `json:"avatar_urls,omitempty"`
Capabilities map[string]interface{} `json:"capabilities,omitempty"`
Description string `json:"description,omitempty"`
Email string `json:"email,omitempty"`
ExtraCapabilities map[string]interface{} `json:"extra_capabilities,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Link string `json:"link,omitempty"`
Name string `json:"name,omitempty"`
Nickname string `json:"nickname,omitempty"`
RegisteredDate string `json:"registered_date,omitempty"`
Roles []string `json:"roles,omitempty"`
Slug string `json:"slug,omitempty"`
URL string `json:"url,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.