jsonld

package
Version: v0.0.0-...-21d4feb Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CollectionResource

type CollectionResource struct {
	Resource

	TotalItems   uint   `json:"totalItems"`
	ItemPerPage  uint   `json:"itemPerPage,omitempty"`
	CurrentPage  uint   `json:"currentPage,omitempty"`
	FirstPage    string `json:"firstPage,omitempty"`
	NextPage     string `json:"nextPage,omitempty"`
	PreviousPage string `json:"previousPage,omitempty"`
	LastPage     string `json:"lastPage,omitempty"`
}

CollectionResource represents the JSON-LD header

func NewCollection

func NewCollection(context, id string) *CollectionResource

NewCollection returns a JSONLD Collection resource

func (*CollectionResource) SetPaginator

func (j *CollectionResource) SetPaginator(r *http.Request, paginator *api.Pagination)

SetPaginator defines values of the JSONLD Collection according to pagination request.

type Error

type Error struct {
	Resource
	StatusCode  int    `json:"statusCode,omitempty"`
	Code        string `json:"code,omitempty"`
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
}

Error is the error holder

func NewError

func NewError(context, id, code, title string) *Error

NewError returns a json-ld error holder

func (*Error) Write

func (j *Error) Write(w http.ResponseWriter)

Write error to socket

type Resource

type Resource struct {
	Context string `json:"@context,omitempty"`
	NodeID  string `json:"@id,omitempty"`
	Type    string `json:"@type,omitempty"`
}

Resource represents the JSON-LD header

func NewResource

func NewResource(context, id, _type string) *Resource

NewResource returns a JSONLD resource

type Status

type Status struct {
	Resource
	StatusCode  int    `json:"statusCode,omitempty"`
	Code        string `json:"code,omitempty"`
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
}

Status is the response holder

func NewStatus

func NewStatus(context, id, title string) *Status

NewStatus returns a status

func (*Status) Write

func (j *Status) Write(w http.ResponseWriter)

Write status to socket

Source Files

Jump to

Keyboard shortcuts

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