design

package
v0.0.0-...-efb7428 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SegmentPattern        = `^[a-zA-Z0-9_\-@.]+$`
	UserPattern           = `^[a-zA-Z0-9_\-@.]+$`
	CacheParamDescription = `` /* 241-byte string literal not displayed */

	FieldsParamDescription = `JSON-encoded object of overriden pairs, e.g.:

	{
		"utm_campaign": "custom-campaign-id",
		// ...
	}`
)

set of constants reused within multiple actions

Variables

View Source
var Article = MediaType("application/vnd.article+json", func() {
	Attributes(func() {
		Attribute("id", String, "ID of article")
		Attribute("category", String, "Page category (homepage, world news...")
		Attribute("tags", ArrayOf(String), "List of tags (breaking news, trump...")
		Attribute("author_id", String, "ID of author")
		Attribute("locked", Boolean, "Flag whether content was locked for the visitor")
		Attribute("variants", HashOf(String, String), "Hash of key-value pairs bearing A/B test variant information (what's A/B-tested / variant label)")
	})
	View("default", func() {
		Attribute("id")
		Attribute("category")
		Attribute("tags")
		Attribute("author_id")
		Attribute("locked")
		Attribute("variants")
	})
	Required("id")
})
View Source
var Avg = MediaType("application/vnd.avg+json", func() {
	Description("Avg")
	Attributes(func() {
		Attribute("tags", HashOf(String, String))
		Attribute("avg", Number)
		Attribute("time_histogram", CollectionOf(TimeHistogram))
	})
	View("default", func() {
		Attribute("tags")
		Attribute("avg")
		Attribute("time_histogram")
	})
	Required("tags", "avg")
})
View Source
var Commerce = MediaType("application/vnd.commerce+json", func() {
	Description("Commerce event")
	Attributes(func() {
		Attribute("id", String)
		Attribute("step", String, func() {
			Enum("checkout", "payment", "purchase", "refund")
		})
		Attribute("checkout", CommerceCheckout)
		Attribute("payment", CommercePayment)
		Attribute("purchase", CommercePayment)
		Attribute("refund", CommercePayment)

		Attribute("source", Source, "UTM source metadata")
		Attribute("article", Article)
		Attribute("system", System)
		Attribute("user", User)
	})
	View("default", func() {
		Attribute("id")
		Attribute("step")

		Attribute("checkout")
		Attribute("payment")
		Attribute("purchase")
		Attribute("refund")

		Attribute("source")
		Attribute("article")
		Attribute("system")
		Attribute("user")
	})
	Required("id", "step", "system", "user")
})
View Source
var CommerceCheckout = MediaType("application/vnd.commerce.checkout+json", func() {
	Attributes(func() {
		Attribute("funnel_id", String, "ID of funnel user is being routed trough")
	})
	View("default", func() {
		Attribute("funnel_id")
	})
	Required("funnel_id")
})
View Source
var CommerceOptionsFilterBy = Type("CommerceOptionsFilterBy", func() {
	Description("Tags and values used to filter results")

	Attribute("tag", String, "Tag used to filter results")
	Attribute("values", ArrayOf(String), "Values of TAG used to filter result")
	Attribute("inverse", Boolean, "If true, condition will be inversed")

	Required("tag", "values")
})
View Source
var CommerceOptionsPayload = Type("CommerceOptionsPayload", func() {
	Description("Parameters to filter commerce counts")

	Attribute("filter_by", ArrayOf(CommerceOptionsFilterBy), "Selection of data filtering type")
	Attribute("group_by", ArrayOf(String), "Select tags by which should be data grouped")
	Attribute("time_after", DateTime, "Include all pageviews that happened after specified RFC3339 datetime")
	Attribute("time_before", DateTime, "Include all pageviews that happened before specified RFC3339 datetime")
	Attribute("time_histogram", OptionsTimeHistogram, "Attribute containing values for splitting result into time-based buckets")
	Attribute("step", String, "Filter particular step", func() {
		Enum("checkout", "payment", "purchase", "refund")
	})
})
View Source
var CommercePayment = MediaType("application/vnd.commerce.payment+json", func() {

	Attributes(func() {
		Attribute("funnel_id", String, "ID of funnel user is being routed trough")
		Attribute("transaction_id", String, "Public ID of transaction (variable symbol)")
		Attribute("product_ids", ArrayOf(String), "Public IDs of selected products")
		Attribute("revenue", Revenue, "Amount of money for given payment")
	})
	View("default", func() {
		Attribute("funnel_id")
		Attribute("transaction_id")
		Attribute("product_ids")
		Attribute("revenue")
	})
	Required("funnel_id", "revenue", "transaction_id", "product_ids")
})
View Source
var Commerces = MediaType("application/vnd.commerces+json", func() {
	Description("Commerce events")
	Attributes(func() {
		Attribute("tags", HashOf(String, String))
		Attribute("commerces", CollectionOf(Commerce))
	})
	View("default", func() {
		Attribute("tags")
		Attribute("commerces")
	})
	Required("tags", "commerces")
})
View Source
var ConcurrentsOptionsPayload = Type("ConcurrentsOptionsPayload", func() {
	Description("Parameters to filter concurrent views")

	Attribute("time_after", DateTime, "Include all pageviews that happened after specified RFC3339 datetime")
	Attribute("time_before", DateTime, "Include all pageviews that happened before specified RFC3339 datetime")
	Attribute("filter_by", ArrayOf(PageviewOptionsFilterBy), "Selection of data filtering type")
	Attribute("group_by", ArrayOf(String), "Select tags by which should be data grouped")
})
View Source
var Count = MediaType("application/vnd.count+json", func() {
	Description("Count")
	Attributes(func() {
		Attribute("tags", HashOf(String, String))
		Attribute("count", Integer)
		Attribute("time_histogram", CollectionOf(TimeHistogram))
		Attribute("count_histogram", CollectionOf(CountHistogram))
	})
	View("default", func() {
		Attribute("tags")
		Attribute("count")
		Attribute("time_histogram")
		Attribute("count_histogram")
	})
	Required("tags", "count")
})
View Source
var CountHistogram = MediaType("application/vnd.count.histogram+json", func() {
	Description("Count histogram data")
	Attributes(func() {
		Attribute("bucket_key", Number)
		Attribute("value", Number)
	})
	View("default", func() {
		Attribute("bucket_key")
		Attribute("value")
	})
	Required("bucket_key", "value")
})
View Source
var Event = MediaType("application/vnd.event+json", func() {
	Description("Generic event")
	Attributes(func() {
		Attribute("id", String)
		Attribute("category", String)
		Attribute("action", String)
		Attribute("system", System)
		Attribute("user", User)
		Attribute("article_id", String)
		Attribute("utm_source", String)
		Attribute("utm_campaign", String)
		Attribute("utm_medium", String)
		Attribute("utm_content", String)
	})
	View("default", func() {
		Attribute("id")
		Attribute("category")
		Attribute("action")
		Attribute("system")
		Attribute("user")
		Attribute("article_id", String)
		Attribute("utm_source")
		Attribute("utm_campaign")
		Attribute("utm_medium")
		Attribute("utm_content")
	})
	Required("id", "system", "category", "action")
})
View Source
var EventCount = MediaType("application/vnd.event.count+json", func() {
	Description("Count")
	Attributes(func() {
		Attribute("count", Integer)
	})
	View("default", func() {
		Attribute("count")
	})
	Required("count")
})
View Source
var EventOptionsFilterBy = Type("EventOptionsFilterBy", func() {
	Description("Tags and values used to filter results")

	Attribute("tag", String, "Tag used to filter results")
	Attribute("values", ArrayOf(String), "Values of TAG used to filter result")
	Attribute("inverse", Boolean, "If true, condition will be inversed")

	Required("tag", "values")
})
View Source
var EventOptionsPayload = Type("EventOptionsPayload", func() {
	Description("Parameters to filter event counts")

	Attribute("filter_by", ArrayOf(EventOptionsFilterBy), "Selection of data filtering type")
	Attribute("group_by", ArrayOf(String), "Select tags by which should be data grouped")
	Attribute("time_after", DateTime, "Include all pageviews that happened after specified RFC3339 datetime")
	Attribute("time_before", DateTime, "Include all pageviews that happened before specified RFC3339 datetime")
	Attribute("time_histogram", OptionsTimeHistogram, "Attribute containing values for splitting result into buckets")

	Attribute("action", String, "Event action")
	Attribute("category", String, "Event category")
})
View Source
var Events = MediaType("application/vnd.events+json", func() {
	Description("Events")
	Attributes(func() {
		Attribute("tags", HashOf(String, String))
		Attribute("events", CollectionOf(Event))
	})
	View("default", func() {
		Attribute("tags")
		Attribute("events")
	})
	Required("tags", "events")
})
View Source
var Flags = MediaType("application/vnd.flags+json", func() {
	Attributes(func() {
		Attribute("pageviews", ArrayOf(String), "Pageviews category flags")
		Attribute("commerce", ArrayOf(String), "Commerce category flags")
		Attribute("events", ArrayOf(String), "Events category flags")
	})
	View("default", func() {
		Attribute("pageviews")
		Attribute("commerce")
		Attribute("events")
	})
	Required("pageviews", "commerce", "events")
})
View Source
var ListCommerceOptionsPayload = Type("ListCommerceOptionsPayload", func() {
	Description("Parameters to filter pageview list")

	Attribute("select_fields", ArrayOf(String), "List of fields to select")
	Attribute("conditions", CommerceOptionsPayload, "Condition definition")

	Required("conditions")
})
View Source
var ListEventOptionsPayload = Type("ListEventOptionsPayload", func() {
	Description("Parameters to filter events list")

	Attribute("select_fields", ArrayOf(String), "List of fields to select")
	Attribute("conditions", EventOptionsPayload, "Condition definition")

	Required("conditions")
})
View Source
var ListPageviewOptionsPayload = Type("ListPageviewOptionsPayload", func() {
	Description("Parameters to filter pageview list")

	Attribute("select_fields", ArrayOf(String), "List of fields to select")
	Attribute("load_timespent", Boolean, "If true, load timespent for each pageview", func() {
		Default(false)
	})
	Attribute("conditions", PageviewOptionsPayload, "Condition definition")

	Required("conditions")
})
View Source
var OptionsCountHistogram = Type("OptionsCountHistogram", func() {
	Description("Values used to split results in count buckets")

	Attribute("field", String, "Name of the field for aggregation")
	Attribute("interval", Number, "Interval of buckets")

	Required("field", "interval")
})
View Source
var OptionsTimeHistogram = Type("OptionsTimeHistogram", func() {
	Description("Values used to split results in time buckets")

	Attribute("interval", String, "Interval of buckets")
	Attribute("offset", String, "Offset of buckets")
	Attribute("time_zone", String, "Timezone ID as specified in the IANA timezone database, such as`America/Los_Angeles`")

	Required("interval", "offset")
})
View Source
var Pageview = MediaType("application/vnd.pageview+json", func() {
	Description("Pageview event")
	Attributes(func() {
		Attribute("id", String)
		Attribute("system", System)
		Attribute("user", User)
		Attribute("article", Article)
	})
	View("default", func() {
		Attribute("id")
		Attribute("system")
		Attribute("user")
		Attribute("article")
	})
	Required("system")
})
View Source
var PageviewOptionsFilterBy = Type("PageviewOptionsFilterBy", func() {
	Description("Tags and values used to filter results")

	Attribute("tag", String, "Tag used to filter results (use tag name: user_id, article_id, ...)")
	Attribute("values", ArrayOf(String), "Values of TAG used to filter result")
	Attribute("inverse", Boolean, "If true, condition will be inversed")

	Required("tag", "values")
})
View Source
var PageviewOptionsPayload = Type("PageviewOptionsPayload", func() {
	Description("Parameters to filter pageview counts")

	Attribute("filter_by", ArrayOf(PageviewOptionsFilterBy), "Selection of data filtering type")
	Attribute("group_by", ArrayOf(String), "Select tags by which should be data grouped")
	Attribute("time_after", DateTime, "Include all pageviews that happened after specified RFC3339 datetime")
	Attribute("time_before", DateTime, "Include all pageviews that happened before specified RFC3339 datetime")
	Attribute("time_histogram", OptionsTimeHistogram, "Attribute containing values for splitting result into time-based buckets")
	Attribute("count_histogram", OptionsCountHistogram, "Attribute containing values for splitting result into count-based buckets based on provided Field")
})
View Source
var Pageviews = MediaType("application/vnd.pageviews+json", func() {
	Description("Pageviews")
	Attributes(func() {
		Attribute("tags", HashOf(String, String))
		Attribute("pageviews", CollectionOf(Pageview))
	})
	View("default", func() {
		Attribute("tags")
		Attribute("pageviews")
	})
	Required("tags", "pageviews")
})
View Source
var RelatedSegments = MediaType("application/vnd.segments.related+json", func() {
	Description("Related segments")
	Attributes(func() {
		Attribute("segments", CollectionOf(Segment))
	})
	View("default", func() {
		Attribute("segments", func() {
			View("extended")
		})
	})
	Required("segments")
})
View Source
var Revenue = MediaType("application/vnd.revenue+json", func() {
	Attributes(func() {
		Attribute("amount", Number, "Numeric amount of money")
		Attribute("currency", String, "ISO 4217 representation of currency")
	})
	View("default", func() {
		Attribute("amount")
		Attribute("currency")
	})
	Required("amount", "currency")
})
View Source
var RuleOverrides = Type("RuleOverrides", func() {
	Description("Additional parameters to override all rules configuration")

	Attribute("fields", HashOf(String, String), "Field values")
})
View Source
var Segment = MediaType("application/vnd.segment+json", func() {
	Description("Segment")
	Attributes(func() {
		Attribute("id", Integer, "ID of segment")
		Attribute("code", String, "Code-friendly identificator of segment")
		Attribute("name", String, "User-friendly name of segment")
		Attribute("group", SegmentGroup)
		Attribute("criteria", Any, "Criteria used to build segment")
		Attribute("url", String, "URL to segment")

		Attribute("table_name", String)
		Attribute("fields", ArrayOf(String))
		Attribute("group_id", Integer)
	})
	View("default", func() {
		Attribute("id")
		Attribute("code")
		Attribute("name")
		Attribute("group")
		Attribute("criteria")
	})
	View("tiny", func() {
		Attribute("id")
		Attribute("code")
		Attribute("name")
		Attribute("group")
	})
	View("extended", func() {
		Attribute("id")
		Attribute("code")
		Attribute("name")
		Attribute("group")
		Attribute("url")
	})
	View("segmenter", func() {
		Attribute("id")
		Attribute("code")
		Attribute("name")
		Attribute("table_name")
		Attribute("group")

		Attribute("criteria")
		Attribute("fields")
		Attribute("group_id")
	})
	Required("id", "code", "name", "group")
})
View Source
var SegmentBlueprint = MediaType("application/vnd.segment.blueprint+json", func() {
	Description("Segment blueprint")
	Attributes(func() {
		Attribute("blueprint", CollectionOf(SegmentBlueprintTable))
	})
	View("default", func() {
		Attribute("blueprint")
	})
	Required("blueprint")
})
View Source
var SegmentBlueprintTable = MediaType("application/vnd.segment.blueprint.table+json", func() {
	Description("Blueprint of one table available for segment")
	Attributes(func() {
		Attribute("table", String, "Table name")
		Attribute("fields", ArrayOf(String), "Fields of table")
		Attribute("criteria", CollectionOf(SegmentBlueprintTableCriterion), "Processing criteria for fields of table")
	})
	View("default", func() {
		Attribute("table")
		Attribute("fields")
		Attribute("criteria")
	})
	Required("table", "fields", "criteria")
})
View Source
var SegmentBlueprintTableCriterion = MediaType("application/vnd.segment.blueprint.table.criterion+json", func() {
	Description("Criterion for one field of table available for segment")
	Attributes(func() {
		Attribute("key", String, "Field of table to which is this criterion related")
		Attribute("label", String, "Human readable name of field")
		Attribute("params", Any, "Criteria of field parameters")
		Attribute("fields", ArrayOf(String), "Field parameters")
	})
	View("default", func() {
		Attribute("key")
		Attribute("label")
		Attribute("params")
		Attribute("fields")
	})
	Required("key", "label", "params")
})
View Source
var SegmentCheck = MediaType("application/vnd.segment.check+json", func() {
	Description("Segment check")
	Attributes(func() {
		Attribute("check", Boolean, "Flag whether user is in the segment or not")
		Attribute("cache", HashOf(Integer, SegmentRuleCache), "Cache object for third party (remplib.js) to use indexed by SegmentRule-based key")
		Attribute("event_rules", HashOf(String, ArrayOf(Integer)), "Map of which rules should be incremented for selected events.")
		Attribute("overridable_fields", HashOf(Integer, ArrayOf(String)), "Array of overridable fields belonging to rules.")
		Attribute("flags", HashOf(Integer, HashOf(String, String)), "Array of flags belonging to rules.")
	})
	View("default", func() {
		Attribute("check")
		Attribute("cache")
		Attribute("event_rules")
		Attribute("overridable_fields")
		Attribute("flags")
	})
	Required("check", "cache", "event_rules", "overridable_fields", "flags")
})
View Source
var SegmentCount = MediaType("application/vnd.segment.count+json", func() {
	Description("Segment count")
	Attributes(func() {
		Attribute("count", Integer, "Number of users in segment based on provided criteria")
		Attribute("status", String, "Status of count. If everything is fine, returns `ok`.")
	})
	View("default", func() {
		Attribute("count")
		Attribute("status")
	})
	Required("count", "status")
})
View Source
var SegmentCreateCriteria = Type("SegmentCreateCriteria", func() {
	Description("Segment's criteria")

	Attribute("nodes", ArrayOf(SegmentCreateCriteriaOperator), "Criteria operators")
	Attribute("version", String, "Version of criteria format")

	Required("nodes", "version")
})
View Source
var SegmentCreateCriteriaNode = Type("SegmentCreateCriteriaOperatorNode", func() {
	Description("Single node of Segment's criteria")

	Attribute("type", String, "Type of criterion", func() {

		Enum("criteria")
	})
	Attribute("key", String, "Key of criterion's type")
	Attribute("negation", Boolean, "Use true if this criterion should be negated")
	Attribute("values", Any)
})
View Source
var SegmentCreateCriteriaOperator = Type("SegmentCreateCriteriaOperator", func() {
	Description("Single operator node of Segment's criteria")

	Attribute("type", String, "Type of criterion", func() {
		Enum("operator")
	})
	Attribute("operator", String, "Operator for following criteria nodes", func() {
		Enum("AND", "OR")
	})
	Attribute("nodes", ArrayOf(SegmentCreateCriteriaNode), "Criteria nodes")

	Required("type", "operator", "nodes")
})
View Source
var SegmentGroup = MediaType("application/vnd.segment.group+json", func() {
	Description("Segment group")
	Attributes(func() {
		Attribute("id", Integer, "Internal ID of segment group")
		Attribute("name", String, "User-friendly name of segment group")
		Attribute("sorting", Integer, "Sort order index")
	})
	View("default", func() {
		Attribute("id")
		Attribute("name")
		Attribute("sorting")
	})
	Required("id", "name", "sorting")
})
View Source
var SegmentGroupsFallback = MediaType("application/vnd.segment.groups.fallback", func() {
	Attributes(func() {
		Attribute("status", String, "OK flag to check before reading the data")
		Attribute("groups", CollectionOf(SegmentGroup))
	})
	View("default", func() {
		Attribute("status")
		Attribute("groups")
	})
	Required("status", "groups")
})
View Source
var SegmentPayload = Type("SegmentPayload", func() {
	Description("Request parameters for segment creation")

	Attribute("name", String, "Name of segment")
	Attribute("table_name", String, "Name of table above which this segment is calculated")
	Attribute("group_id", Integer, "ID of parent group")
	Attribute("fields", ArrayOf(String), "List of fields to select")

	Attribute("criteria", SegmentCreateCriteria, "Segment's criteria")

	Required("name", "table_name", "group_id", "fields", "criteria")
})
View Source
var SegmentRuleCache = Type("SegmentRuleCache", func() {
	Description("Internal cache object with count of event")

	Param("s", DateTime, "Date of last sync with DB.")
	Param("c", Integer, "Count of events occurred within timespan of segment rule.")

	Required("s", "c")
})
View Source
var SegmentTinyPayload = Type("SegmentTinyPayload", func() {
	Description("Request parameters for endpoints segments/count and segments/related")

	Attribute("table_name", String, "Name of table above which this segment is calculated")
	Attribute("criteria", SegmentCreateCriteria, "Segment's criteria")
})
View Source
var SegmentersSegment = MediaType("application/vnd.segmenters.segment.+json", func() {
	Description("Segment returned for segmenter")
	Attributes(func() {
		Attribute("status", String)
		Attribute("segment", Segment)
	})
	View("default", func() {
		Attribute("status")
		Attribute("segment", func() {
			View("segmenter")
		})
	})
	Required("status", "segment")
})
View Source
var Source = MediaType("application/vnd.source+json", func() {
	Attributes(func() {
		Attribute("utm_source", String, "Origin of user (e.g. remp_campaign)")
		Attribute("utm_medium", String, "Medium through which the came (e.g. overlay, inline)")
		Attribute("utm_campaign", String, "Reference to specific campaign (e.g. campaign ID")
		Attribute("utm_content", String, "Reference to specific campaign mean (e.g. banner ID)")
	})
	View("default", func() {
		Attribute("utm_source")
		Attribute("utm_medium")
		Attribute("utm_campaign")
		Attribute("utm_content")
	})
})
View Source
var Sum = MediaType("application/vnd.sum+json", func() {
	Description("Sum")
	Attributes(func() {
		Attribute("tags", HashOf(String, String))
		Attribute("sum", Number)
		Attribute("time_histogram", CollectionOf(TimeHistogram))
	})
	View("default", func() {
		Attribute("tags")
		Attribute("sum")
		Attribute("time_histogram")
	})
	Required("tags", "sum")
})
View Source
var System = MediaType("application/vnd.system+json", func() {
	Attributes(func() {
		Attribute("property_token", UUID, "Property token")
		Attribute("time", DateTime, "Time of occurrence")
	})
	View("default", func() {
		Attribute("property_token")
		Attribute("time")
	})
	Required("property_token", "time")
})
View Source
var TimeHistogram = MediaType("application/vnd.time.histogram+json", func() {
	Description("Time histogram data")
	Attributes(func() {
		Attribute("time", DateTime)
		Attribute("value", Number)
	})
	View("default", func() {
		Attribute("time")
		Attribute("value")
	})
	Required("time", "value")
})
View Source
var User = MediaType("application/vnd.user+json", func() {
	Attributes(func() {
		Attribute("id", String, "ID of reader")
		Attribute("subscriber", Boolean, "Flag whether user is subscriber (has paid for access)")
		Attribute("browser_id", String, "Anonymized ID of user's browser")
		Attribute("url", String, "URL of the content/conversion point", func() {
			Format("uri")
		})
		Attribute("user_agent", String, "User agent of client")
		Attribute("ip_address", String, "IP address of client", func() {
			Format("ip")
		})
		Attribute("source", Source, "UTM source metadata")
		Attribute("remp_session_id", String, "ID of reader's session")
		Attribute("remp_pageview_id", String, "ID of pageview")
		Attribute("referer", String, "Value of HTTP referer header (if present)")
		Attribute("timespent", Integer, "Number of seconds spent during pageview (if recorded)")
	})
	View("default", func() {
		Attribute("id")
		Attribute("subscriber")
		Attribute("browser_id")
		Attribute("url")
		Attribute("user_agent")
		Attribute("ip_address")
		Attribute("source")
		Attribute("remp_session_id")
		Attribute("remp_pageview_id")
		Attribute("referer")
		Attribute("timespent")
	})
	Required("remp_pageview_id")
})

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