func (c *Client) GetUserCollections() (*[]Collection, error) {
	colls := &[]Collection{}
	env, err := c.get("/me/collections", colls)
	if err != nil {
		return nil, err
	}
	var ok bool
	if colls, ok = env.Data.(*[]Collection); !ok {
		return nil, fmt.Errorf("Wrong data returned from API.")
	}
	status := env.Code
	if status != http.StatusOK {
		if c.isNotLoggedIn(status) {
			return nil, fmt.Errorf("Not authenticated.")
		}
		return nil, fmt.Errorf("Problem getting collections: %d. %v\n", status, err)
	}
	return colls, nil
}
GetUserCollections retrieves the authenticated user's collections.
See https://developers.write.as/docs/api/#retrieve-user-39-s-collections
package writeas
import (
	"fmt"
	"net/http"
)
type (
	Collection struct {
		Alias       string `json:"alias"`
		Title       string `json:"title"`
		Description string `json:"description"`
		StyleSheet  string `json:"style_sheet"`
		Private     bool   `json:"private"`
		Views       int64  `json:"views"`
		Domain      string `json:"domain,omitempty"`
		Email       string `json:"email,omitempty"`
		URL         string `json:"url,omitempty"`
		TotalPosts int `json:"total_posts"`
		Posts *[]Post `json:"posts,omitempty"`
	}
	CollectionParams struct {
		Alias       string `json:"alias"`
		Title       string `json:"title"`
		Description string `json:"description,omitempty"`
	}
)
func (c *Client) CreateCollection(sp *CollectionParams) (*Collection, error) {
	p := &Collection{}
	env, err := c.post("/collections", sp, p)
	if err != nil {
		return nil, err
	}
	var ok bool
	if p, ok = env.Data.(*Collection); !ok {
		return nil, fmt.Errorf("Wrong data returned from API.")
	}
	status := env.Code
	if status != http.StatusCreated {
		if status == http.StatusBadRequest {
			return nil, fmt.Errorf("Bad request: %s", env.ErrorMessage)
		} else if status == http.StatusForbidden {
			return nil, fmt.Errorf("Casual or Pro user required.")
		} else if status == http.StatusConflict {
			return nil, fmt.Errorf("Collection name is already taken.")
		} else if status == http.StatusPreconditionFailed {
			return nil, fmt.Errorf("Reached max collection quota.")
		}
		return nil, fmt.Errorf("Problem getting post: %d. %v\n", status, err)
	}
	return p, nil
}
func (c *Client) GetCollection(alias string) (*Collection, error) {
	coll := &Collection{}
	env, err := c.get(fmt.Sprintf("/collections/%s", alias), coll)
	if err != nil {
		return nil, err
	}
	var ok bool
	if coll, ok = env.Data.(*Collection); !ok {
		return nil, fmt.Errorf("Wrong data returned from API.")
	}
	status := env.Code
	if status == http.StatusOK {
		return coll, nil
	} else if status == http.StatusNotFound {
		return nil, fmt.Errorf("Collection not found.")
	} else {
		return nil, fmt.Errorf("Problem getting collection: %d. %v\n", status, err)
	}
}
func (c *Client) GetCollectionPosts(alias string) (*[]Post, error) {
	coll := &Collection{}
	env, err := c.get(fmt.Sprintf("/collections/%s/posts", alias), coll)
	if err != nil {
		return nil, err
	}
	var ok bool
	if coll, ok = env.Data.(*Collection); !ok {
		return nil, fmt.Errorf("Wrong data returned from API.")
	}
	status := env.Code
	if status == http.StatusOK {
		return coll.Posts, nil
	} else if status == http.StatusNotFound {
		return nil, fmt.Errorf("Collection not found.")
	} else {
		return nil, fmt.Errorf("Problem getting collection: %d. %v\n", status, err)
	}
}
func (c *Client) GetCollectionPost(alias, slug string) (*Post, error) {
	post := Post{}
	env, err := c.get(fmt.Sprintf("/collections/%s/posts/%s", alias, slug), &post)
	if err != nil {
		return nil, err
	}
	if _, ok := env.Data.(*Post); !ok {
		return nil, fmt.Errorf("Wrong data returned from API.")
	}
	if env.Code == http.StatusOK {
		return &post, nil
	} else if env.Code == http.StatusNotFound {
		return nil, fmt.Errorf("Post %s not found in collection %s", slug, alias)
	}
	return nil, fmt.Errorf("Problem getting post %s from collection %s: %d. %v\n", slug, alias, env.Code, err)
}