jrd

package
v0.0.0-...-c529bc7 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2013 License: MIT Imports: 1 Imported by: 1

Documentation

Overview

Package jrd provides a simple JRD parser.

Following this JRD spec: http://tools.ietf.org/html/draft-ietf-appsawg-webfinger-14#section-4.4

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JRD

type JRD struct {
	Subject    string                 `json:"subject,omitempty"`
	Aliases    []string               `json:"aliases,omitempty"`
	Properties map[string]interface{} `json:"properties,omitempty"`
	Links      []Link                 `json:"links,omitempty"`
	Expires    string
}

JRD is a JSON Resource Descriptor, specifying properties and related links for a resource.

func ParseJRD

func ParseJRD(blob []byte) (*JRD, error)

ParseJRD parses the JRD using json.Unmarshal.

func (*JRD) GetLinkByRel

func (self *JRD) GetLinkByRel(rel string) *Link

GetLinkByRel returns the first *Link with the specified rel value.

func (*JRD) GetProperty

func (self *JRD) GetProperty(uri string) string

GetProperty Returns the property value as a string. Per spec a property value can be null, empty string is returned in this case.

type Link struct {
	Rel        string                 `json:"rel,omitempty"`
	Type       string                 `json:"type,omitempty"`
	Href       string                 `json:"href,omitempty"`
	Titles     map[string]string      `json:"titles,omitempty"`
	Properties map[string]interface{} `json:"properties,omitempty"`
	Template   string
}

Link is a link to a related resource.

func (*Link) GetProperty

func (self *Link) GetProperty(uri string) string

GetProperty Returns the property value as a string. Per spec a property value can be null, empty string is returned in this case.

Jump to

Keyboard shortcuts

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