wordpress

package module
v0.0.0-...-92eb46f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2023 License: MIT Imports: 10 Imported by: 0

README

go-wp-api

Golang client library for WP-API (Wordpress REST API)

Installation

go get github.com/sogko/go-wordpress

Usage

Quick example
package main

import (
	"github.com/sogko/go-wordpress"
	"net/http"
)

func main() {

  // create wp-api client
  client := wordpress.NewClient(&wordpress.Options{
    BaseAPIURL: API_BASE_URL, // example: `http://192.168.99.100:32777/wp-json/wp/v2`
    Username:   USER,
    Password:   PASSWORD,
  })
  	
  // for eg, to get current user (GET /users/me)
  currentUser, resp, body, _ := client.Users().Me()
  if resp.StatusCode != http.StatusOK {
    // handle error
  }
  
  // `body` will contain raw JSON body in []bytes
  
  // Or you can use your own structs (for custom endpoints, for example)
  // Below is the equivalent of `client.Posts().Get(100, nil)`
  var obj MyCustomPostStruct
  resp, body, err := client.Get("/posts/100", nil, &obj)
  // ...
  
  log.Println("Current user", currentUser)
}

For more examples, see package tests.

For list of supported/implemented endpoints, see Endpoints.md

Test

Note: Before running the tests, ensure that you have set up your test environment

Prerequisites
Setting up test environment
  • Install prequisits (see above)
  • Import ./test-data/go-wordpress.wordpress.2015-08-23.xml to your local test Wordpress installation
  • Upload at least one media to your Wordpress installation (Admin > Media > Upload)
  • Edit one (1) most recent Post to create a revision
  • Edit one (1) most recent Page to create a revision

Running test


# Set test enviroment
export WP_API_URL=http://192.168.99.100:32777/wp-json/wp/v2
export WP_USER=<user>
export WP_PASSWD=<password>

cd <path_to_package>/github.com/sogko/go-wordpress
go test

TODO

  • godoc documentation, so its easier for library users to map the REST APIs to library calls
  • Test comments API endpoint. (Currently, already implemented but not tested due to WP-API issues with creating comments reliably)
  • Support OAuth authentication

Documentation

Index

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 AvatarURLS struct {
	Size24 string `json:"24,omitempty"`
	Size48 string `json:"48,omitempty"`
	Size96 string `json:"96,omitempty"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(options *Options) *Client

func (*Client) Comments

func (client *Client) Comments() *CommentsCollection

func (*Client) Create

func (client *Client) Create(url string, content interface{}, result interface{}) (*http.Response, []byte, error)

func (*Client) Delete

func (client *Client) Delete(url string, params interface{}, result interface{}) (*http.Response, []byte, error)

func (*Client) Get

func (client *Client) Get(url string, params interface{}, result interface{}) (*http.Response, []byte, error)

func (*Client) List

func (client *Client) List(url string, params interface{}, result interface{}) (*http.Response, []byte, error)

func (*Client) Media

func (client *Client) Media() *MediaCollection

func (*Client) Pages

func (client *Client) Pages() *PagesCollection

func (*Client) PostData

func (client *Client) PostData(url string, content []byte, contentType string, filename string, result interface{}) (*http.Response, []byte, error)

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) Update

func (client *Client) Update(url string, content interface{}, result interface{}) (*http.Response, []byte, error)

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
}

func (*CommentsCollection) Create

func (col *CommentsCollection) Create(new *Comment) (*Comment, *http.Response, []byte, error)

func (*CommentsCollection) Delete

func (col *CommentsCollection) Delete(id int, params interface{}) (*Comment, *http.Response, []byte, error)

func (*CommentsCollection) Get

func (col *CommentsCollection) Get(id int, params interface{}) (*Comment, *http.Response, []byte, error)

func (*CommentsCollection) List

func (col *CommentsCollection) List(params interface{}) ([]Comment, *http.Response, []byte, error)

func (*CommentsCollection) Update

func (col *CommentsCollection) Update(id int, post *Comment) (*Comment, *http.Response, []byte, error)

type Content

type Content struct {
	Raw      string `json:"raw,omitempty"`
	Rendered string `json:"rendered,omitempty"`
}

type Excerpt

type Excerpt struct {
	Raw      string `json:"raw,omitempty"`
	Rendered string `json:"rendered,omitempty"`
}

type GUID

type GUID struct {
	Raw      string `json:"raw,omitempty"`
	Rendered string `json:"rendered,omitempty"`
}

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      MediaCaption     `json:"caption,omitempty"`
	Description  MediaDescription `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 MediaCaption

type MediaCaption struct {
	Raw      string `json:"raw,omitempty"`
	Rendered string `json:"rendered,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)

func (*MediaCollection) Delete

func (col *MediaCollection) Delete(id int, params interface{}) (*Media, *http.Response, []byte, error)

func (*MediaCollection) Get

func (col *MediaCollection) Get(id int, params interface{}) (*Media, *http.Response, []byte, error)

func (*MediaCollection) List

func (col *MediaCollection) List(params interface{}) ([]Media, *http.Response, []byte, error)

type MediaDescription

type MediaDescription struct {
	Raw      string `json:"raw,omitempty"`
	Rendered string `json:"rendered,omitempty"`
}

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"`
}

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"`
}

type MediaUploadOptions

type MediaUploadOptions struct {
	Filename    string
	ContentType string
	Data        []byte
}

type Meta

type Meta struct {
	ID    int    `json:"id,omitempty"`
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

type MetaCollection

type MetaCollection struct {
	// contains filtered or unexported fields
}

func (*MetaCollection) Create

func (col *MetaCollection) Create(new *Meta) (*Meta, *http.Response, []byte, error)

func (*MetaCollection) Delete

func (col *MetaCollection) Delete(id int, params interface{}) (*MetaDeletedResponse, *http.Response, []byte, error)

func (*MetaCollection) Get

func (col *MetaCollection) Get(id int, params interface{}) (*Meta, *http.Response, []byte, error)

func (*MetaCollection) List

func (col *MetaCollection) List(params interface{}) ([]Meta, *http.Response, []byte, error)

func (*MetaCollection) Update

func (col *MetaCollection) Update(id int, meta *Meta) (*Meta, *http.Response, []byte, error)

type MetaDeletedResponse

type MetaDeletedResponse struct {
	Message string `json:"message,omitempty"`
}

type Options

type Options struct {
	BaseAPIURL string

	// Basic Auth
	Username string
	Password string
}

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) Populate

func (entity *Page) Populate(params interface{}) (*Page, *http.Response, []byte, error)

func (*Page) Revisions

func (entity *Page) Revisions() *RevisionsCollection

type PagesCollection

type PagesCollection struct {
	// contains filtered or unexported fields
}

func (*PagesCollection) Create

func (col *PagesCollection) Create(new *Page) (*Page, *http.Response, []byte, error)

func (*PagesCollection) Delete

func (col *PagesCollection) Delete(id int, params interface{}) (*Page, *http.Response, []byte, error)

func (*PagesCollection) Entity

func (col *PagesCollection) Entity(id int) *Page

func (*PagesCollection) Get

func (col *PagesCollection) Get(id int, params interface{}) (*Page, *http.Response, []byte, error)

func (*PagesCollection) List

func (col *PagesCollection) List(params interface{}) ([]Page, *http.Response, []byte, error)

func (*PagesCollection) Update

func (col *PagesCollection) Update(id int, page *Page) (*Page, *http.Response, []byte, error)

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) Populate

func (entity *Post) Populate(params interface{}) (*Post, *http.Response, []byte, error)

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) Create

func (col *PostsCollection) Create(new *Post) (*Post, *http.Response, []byte, error)

func (*PostsCollection) Delete

func (col *PostsCollection) Delete(id int, params interface{}) (*Post, *http.Response, []byte, error)

func (*PostsCollection) Entity

func (col *PostsCollection) Entity(id int) *Post

func (*PostsCollection) Get

func (col *PostsCollection) Get(id int, params interface{}) (*Post, *http.Response, []byte, error)

func (*PostsCollection) List

func (col *PostsCollection) List(params interface{}) ([]Post, *http.Response, []byte, error)

func (*PostsCollection) Update

func (col *PostsCollection) Update(id int, post *Post) (*Post, *http.Response, []byte, error)

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 (*PostsTermsCollection) List

func (col *PostsTermsCollection) List(taxonomy string, params interface{}) ([]PostsTerm, *http.Response, []byte, error)

func (*PostsTermsCollection) Tag

type PostsTermsTaxonomyCollection

type PostsTermsTaxonomyCollection struct {
	// contains filtered or unexported fields
}

func (*PostsTermsTaxonomyCollection) Create

func (*PostsTermsTaxonomyCollection) Delete

func (col *PostsTermsTaxonomyCollection) Delete(id int, params interface{}) (*PostsTerm, *http.Response, []byte, error)

func (*PostsTermsTaxonomyCollection) Get

func (col *PostsTermsTaxonomyCollection) Get(id int, params interface{}) (*PostsTerm, *http.Response, []byte, error)

func (*PostsTermsTaxonomyCollection) List

func (col *PostsTermsTaxonomyCollection) List(params interface{}) ([]PostsTerm, *http.Response, []byte, error)

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

func (*RevisionsCollection) Get

func (col *RevisionsCollection) Get(id int, params interface{}) (*Revision, *http.Response, []byte, error)

func (*RevisionsCollection) List

func (col *RevisionsCollection) List(params interface{}) ([]Revision, *http.Response, []byte, error)

type Status

type Status struct {
	Name       string `json:"name,omitempty"`
	Private    bool   `json:"private,omitempty"`
	Public     bool   `json:"public,omitempty"`
	Queryable  bool   `json:"queryable,omitempty"`
	ShowInList bool   `json:"show_in_list,omitempty"`
	Slug       string `json:"slug,omitempty"`
}

type Statuses

type Statuses struct {
	Publish Status `json:"publish,omitempty"`
	Future  Status `json:"future,omitempty"`
	Draft   Status `json:"draft,omitempty"`
	Pending Status `json:"pending,omitempty"`
	Private Status `json:"private,omitempty"`
}

type StatusesCollection

type StatusesCollection struct {
	// contains filtered or unexported fields
}

func (*StatusesCollection) Get

func (col *StatusesCollection) Get(slug string, params interface{}) (*Status, *http.Response, []byte, error)

func (*StatusesCollection) List

func (col *StatusesCollection) List(params interface{}) (*Statuses, *http.Response, []byte, error)

type TaxonomiesCollection

type TaxonomiesCollection struct {
	// contains filtered or unexported fields
}

func (*TaxonomiesCollection) Get

func (col *TaxonomiesCollection) Get(slug string, params interface{}) (*Taxonomy, *http.Response, []byte, error)

func (*TaxonomiesCollection) List

func (col *TaxonomiesCollection) List(params interface{}) (map[string]Taxonomy, *http.Response, []byte, error)

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) List

func (col *TermsCollection) List(taxonomy string, params interface{}) ([]Term, *http.Response, []byte, error)

func (*TermsCollection) Tag

type TermsTaxonomyCollection

type TermsTaxonomyCollection struct {
	// contains filtered or unexported fields
}

func (*TermsTaxonomyCollection) Create

func (col *TermsTaxonomyCollection) Create(new *Term) (*Term, *http.Response, []byte, error)

func (*TermsTaxonomyCollection) Delete

func (col *TermsTaxonomyCollection) Delete(id int, params interface{}) (*Term, *http.Response, []byte, error)

func (*TermsTaxonomyCollection) Get

func (col *TermsTaxonomyCollection) Get(id int, params interface{}) (*Term, *http.Response, []byte, error)

func (*TermsTaxonomyCollection) List

func (col *TermsTaxonomyCollection) List(params interface{}) ([]Term, *http.Response, []byte, error)

func (*TermsTaxonomyCollection) Update

func (col *TermsTaxonomyCollection) Update(id int, post *Term) (*Term, *http.Response, []byte, error)

type Title

type Title struct {
	Raw      string `json:"raw,omitempty"`
	Rendered string `json:"rendered,omitempty"`
}

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 Types

type Types struct {
	Post       Type `json:"post,omitempty"`
	Page       Type `json:"page,omitempty"`
	Attachment Type `json:"attachment,omitempty"`
}

type TypesCollection

type TypesCollection struct {
	// contains filtered or unexported fields
}

func (*TypesCollection) Get

func (col *TypesCollection) Get(slug string, params interface{}) (*Type, *http.Response, []byte, error)

func (*TypesCollection) List

func (col *TypesCollection) List(params interface{}) (*Types, *http.Response, []byte, error)

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"`
}

type UsersCollection

type UsersCollection struct {
	// contains filtered or unexported fields
}

func (*UsersCollection) Create

func (col *UsersCollection) Create(new *User) (*User, *http.Response, []byte, error)

func (*UsersCollection) Delete

func (col *UsersCollection) Delete(id int, params interface{}) (*User, *http.Response, []byte, error)

func (*UsersCollection) Get

func (col *UsersCollection) Get(id int, params interface{}) (*User, *http.Response, []byte, error)

func (*UsersCollection) List

func (col *UsersCollection) List(params interface{}) ([]User, *http.Response, []byte, error)

func (*UsersCollection) Me

func (col *UsersCollection) Me(params interface{}) (*User, *http.Response, []byte, error)

func (*UsersCollection) Update

func (col *UsersCollection) Update(id int, post *User) (*User, *http.Response, []byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL