package edgee:components@1.0.1;
interface data-collection {
type dict = list<tuple<string,string>>;
enum event-type { page, track, user }
enum consent { pending, granted, denied }
record event {
uuid: string,
timestamp: s64,
timestamp-millis: s64,
timestamp-micros: s64,
event-type: event-type,
data: data,
context: context,
consent: option<consent>,
}
variant data {
page(page-data),
track(track-data),
user(user-data),
}
record page-data {
name: string,
category: string,
keywords: list<string>,
title: string,
url: string,
path: string,
search: string,
referrer: string,
properties: dict,
}
record user-data {
user-id: string,
anonymous-id: string,
edgee-id: string,
properties: dict,
}
record track-data {
name: string,
properties: dict,
products: list<dict>,
}
record context {
page: page-data,
user: user-data,
client: client,
campaign: campaign,
session: session,
}
record client {
ip: string,
locale: string,
timezone: string,
user-agent: string,
user-agent-architecture: string,
user-agent-bitness: string,
user-agent-version-list: string,
user-agent-full-version-list: string,
user-agent-mobile: string,
user-agent-model: string,
os-name: string,
os-version: string,
screen-width: s32,
screen-height: s32,
screen-density: f32,
continent: string,
country-code: string,
country-name: string,
region: string,
city: string,
}
record campaign {
name: string,
source: string,
medium: string,
term: string,
content: string,
creative-format: string,
marketing-tactic: string,
}
record session {
session-id: string,
previous-session-id: string,
session-count: u32,
session-start: bool,
first-seen: s64,
last-seen: s64,
}
record edgee-request {
method: http-method,
url: string,
headers: dict,
forward-client-headers: bool,
body: string,
}
enum http-method { GET, PUT, POST, DELETE }
@since(version = 1.0.1)
record auth-request {
method: http-method,
url: string,
headers: dict,
token-duration: s64,
response-token-property-name: option<string>, // Which property to cache and send in the db
component-token-setting-name: string, // What the token settings is called in the component
body: string,
}
page: func(e: event, settings: dict) -> result<edgee-request, string>;
track: func(e: event, settings: dict) -> result<edgee-request, string>;
user: func(e: event, settings:dict) -> result<edgee-request, string>;
@since(version = 1.0.1)
authenticate: func(settings: dict) -> result<option<auth-request>, string>;
}