jsonapi

package
v0.0.0-...-c6890f0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: MIT Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API is a handle to an instance of the API.

func NewAPI

func NewAPI(url string) *API

NewAPI creates a new instance of an API with the specified URL.

func (*API) CreatePost

func (a *API) CreatePost(title string, body string, userID int) (Post, error)

func (*API) GetPosts

func (a *API) GetPosts() ([]Post, error)

GetPosts retrieves a collection of post entries from the API and returns them, or an error.

type Post

type Post struct {
	UserID int    `json:"userId"`
	ID     int    `json:"id"`
	Title  string `json:"title"`
	// Since the type in the message has the same name as this, we don't define a tag explicitly
	Body string
}

Post represents a single post

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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