design

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2020 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Feed = MediaType("application/vnd.feedpushr.feed.v1+json", func() {
	Description("A RSS feed")
	TypeName("Feed")
	ContentType("application/json")
	Attributes(func() {
		Attribute("id", String, "ID of feed (MD5 of the xmlUrl)", func() {
			Example("5bfb841c028281c0051828c115fd1f50")
		})
		Attribute("xmlUrl", String, "URL of the XML feed", func() {
			Example("http://www.hashicorp.com/feed.xml")
		})
		Attribute("htmlUrl", String, "URL of the feed website", func() {
			Example("http://www.hashicorp.com/blog")
		})
		Attribute("hubUrl", String, "URL of the PubSubHubbud hub", func() {
			Example("http://pubsubhubbub.appspot.com")
		})
		Attribute("text", String, "Text attribute of the Feed", func() {
			Example("RSS Feed")
		})
		Attribute("title", String, "Title of the Feed", func() {
			Example("Hashicorp Blog")
		})
		Attribute("tags", ArrayOf(String), "List of tags", func() {
			Example([]string{"foo", "bar"})
		})
		Attribute("status", String, "Aggregation status", func() {
			Enum("running", "stopped")
		})
		Attribute("lastCheck", DateTime, "Last aggregation pass")
		Attribute("nextCheck", DateTime, "Next aggregation pass")
		Attribute("errorMsg", String, "Last aggregation error")
		Attribute("errorCount", Integer, "Number of consecutive aggregation errors")
		Attribute("nbProcessedItems", Integer, "Total number of processed items")
		Attribute("cdate", DateTime, "Date of creation")
		Attribute("mdate", DateTime, "Date of modification")

		Required("id", "xmlUrl", "title", "cdate", "mdate")
	})

	View("default", func() {
		Attribute("id")
		Attribute("xmlUrl")
		Attribute("htmlUrl")
		Attribute("hubUrl")
		Attribute("title")
		Attribute("text")
		Attribute("tags")
		Attribute("status")
		Attribute("lastCheck")
		Attribute("nextCheck")
		Attribute("errorMsg")
		Attribute("errorCount")
		Attribute("nbProcessedItems")
		Attribute("cdate")
		Attribute("mdate")
	})

	View("tiny", func() {
		Description("tiny is the view used to list feeds")
		Attribute("id")
		Attribute("xmlUrl")
		Attribute("title")
		Attribute("tags")
		Attribute("cdate")
	})

	View("link", func() {
		Attribute("id")
		Attribute("xmlUrl")
	})
})

Feed is the feed resource media type.

View Source
var FeedsPage = MediaType("application/vnd.feedpushr.feeds-page.v1+json", func() {
	Description("A pagignated list of feeds")
	TypeName("FeedsPage")
	ContentType("application/json")
	Attributes(func() {
		Attribute("total", Integer, "Total number of feeds", func() {
			Example(99)
		})
		Attribute("current", Integer, "Current page number", func() {
			Example(1)
		})
		Attribute("limit", Integer, "Max number of feeds by page", func() {
			Example(100)
		})
		Attribute("data", CollectionOf(Feed), "List of feeds")
		Required("total", "current", "limit", "data")
	})

	View("default", func() {
		Attribute("total")
		Attribute("current")
		Attribute("limit")
		Attribute("data")
	})
})

FeedsPage is a page of feeds media type.

View Source
var Filter = MediaType("application/vnd.feedpushr.filter.v1+json", func() {
	Description("A filter")
	TypeName("Filter")
	ContentType("application/json")
	Attributes(func() {
		Attribute("id", Integer, "ID of the filter", func() {
			Example(1)
		})
		Attribute("alias", String, "Alias of the filter", func() {
			Example("foo")
		})
		Attribute("name", String, "Name of the filter", func() {
			Example("fetch")
		})
		Attribute("desc", String, "Description of the filter", func() {
			Example("This filter will...")
		})
		Attribute("props", HashOf(String, Any), "Filter properties", NoExample)
		Attribute("condition", String, "Conditional expression of the filter", func() {
			Example("\"foo\" in Tags")
		})
		Attribute("enabled", Boolean, "Status", func() {
			Default(false)
		})
		Required("id", "alias", "name", "desc", "condition")
	})

	View("default", func() {
		Attribute("id")
		Attribute("alias")
		Attribute("name")
		Attribute("desc")
		Attribute("props")
		Attribute("condition")
		Attribute("enabled")
	})
})

Filter is the filter resource media type.

View Source
var FilterSpec = MediaType("application/vnd.feedpushr.filter-spec.v1+json", func() {
	Description("The filter specification")
	TypeName("FilterSpec")
	ContentType("application/json")
	Attributes(func() {
		Attribute("name", String, "Name of the filter", func() {
			Example("title")
		})
		Attribute("desc", String, "Description of the filter", func() {
			Example("Add a prefix to the tittle...")
		})
		Attribute("props", CollectionOf("application/vnd.feedpushr.prop-spec.v1+json"))
		Required("name", "desc", "props")
	})

	View("default", func() {
		Attribute("name")
		Attribute("desc")
		Attribute("props")
	})
})

FilterSpec is the filter specification media type.

View Source
var HALLink = MediaType("application/vnd.feedpushr.hal-links.v1+json", func() {
	Description("HAL link")
	TypeName("HALLink")
	ContentType("application/json")
	Attributes(func() {
		Attribute("href", String, "Link's destination", func() {
			Example("url")
		})
		Required("href")
	})

	View("default", func() {
		Attribute("href")
	})
})

HALLink is the HAL link media type.

View Source
var Info = MediaType("application/vnd.feedpushr.info.v1+json", func() {
	Description("API info")
	TypeName("Info")
	ContentType("application/json")
	Attributes(func() {
		Attribute("name", String, "Service name", func() {
			Example("feedpushr")
		})
		Attribute("desc", String, "Service description", func() {
			Example("Feed aggregator daemon with sugar on top")
		})
		Attribute("version", String, "Service version", func() {
			Example("v2.0.0")
		})
		Attribute("_links", HashOf(String, HALLink), "HAL links")
		Required("name", "desc", "version", "_links")
	})

	View("default", func() {
		Attribute("name")
		Attribute("desc")
		Attribute("version")
		Attribute("_links")
	})
})

Info is the API info media type.

View Source
var Output = MediaType("application/vnd.feedpushr.output.v1+json", func() {
	Description("The output channel")
	TypeName("Output")
	ContentType("application/json")
	Attributes(func() {
		Attribute("id", Integer, "ID of the output", func() {
			Example(1)
		})
		Attribute("alias", String, "Alias of the output channel", func() {
			Example("foo")
		})
		Attribute("name", String, "Name of the output channel", func() {
			Example("fetch")
		})
		Attribute("desc", String, "Description of the output channel", func() {
			Example("New articles are sent as JSON document to...")
		})
		Attribute("props", HashOf(String, Any), "Output channel properties", NoExample)
		Attribute("condition", String, "Conditional expression of the filter", func() {
			Example("\"foo\" in Tags")
		})
		Attribute("enabled", Boolean, "Status", func() {
			Default(false)
		})
		Required("id", "alias", "name", "desc", "condition")
	})

	View("default", func() {
		Attribute("id")
		Attribute("name")
		Attribute("alias")
		Attribute("desc")
		Attribute("props")
		Attribute("condition")
		Attribute("enabled")
	})
})

Output is the output resource media type.

View Source
var OutputSpec = MediaType("application/vnd.feedpushr.output-spec.v1+json", func() {
	Description("The output channel specification")
	TypeName("OutputSpec")
	ContentType("application/json")
	Attributes(func() {
		Attribute("name", String, "Name of the output channel", func() {
			Example("fetch")
		})
		Attribute("desc", String, "Description of the output channel", func() {
			Example("New articles are sent as JSON document to...")
		})
		Attribute("props", CollectionOf("application/vnd.feedpushr.prop-spec.v1+json"))
		Required("name", "desc", "props")
	})

	View("default", func() {
		Attribute("name")
		Attribute("desc")
		Attribute("props")
	})
})

OutputSpec is the output specification media type.

View Source
var PropSpec = MediaType("application/vnd.feedpushr.prop-spec.v1+json", func() {
	Description("The specification of a property")
	TypeName("PropSpec")
	ContentType("application/json")
	Attributes(func() {
		Attribute("name", String, "Name of the property", func() {
			Example("url")
		})
		Attribute("desc", String, "Description of the output channel", func() {
			Example("New articles are sent as JSON document to...")
		})
		Attribute("type", String, "Property type ('text', 'url', ...)", func() {
			Example("text")
		})
		Attribute("options", HashOf(String, String), "Property options")
		Required("name", "desc", "type")
	})

	View("default", func() {
		Attribute("name")
		Attribute("desc")
		Attribute("type")
		Attribute("options")
	})
})

PropSpec is the property specification media type.

View Source
var SubscriptionPayload = Type("SubscriptionPayload", func() {
	Attribute("alias", func() {
		MinLength(2)
		Example("Best app ever")
	})
	Attribute("uri", func() {
		MinLength(5)
		Example("https://api:KEY@api.nunux.org/keeper/v2/documents")
	})
})

SubscriptionPayload defines the data structure used in the create subscription request body.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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