umami-api-js 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/index.d.ts +224 -52
- package/dist/index.js +168 -49
- package/dist/namespaces/Admin.d.ts +8 -27
- package/dist/namespaces/Admin.js +4 -10
- package/dist/namespaces/Events.d.ts +15 -15
- package/dist/namespaces/Events.js +22 -22
- package/dist/namespaces/Links.d.ts +28 -0
- package/dist/namespaces/Links.js +25 -0
- package/dist/namespaces/Me.d.ts +44 -0
- package/dist/namespaces/Me.js +21 -0
- package/dist/namespaces/Pixels.d.ts +25 -0
- package/dist/namespaces/Pixels.js +25 -0
- package/dist/namespaces/Realtime.d.ts +3 -3
- package/dist/namespaces/Realtime.js +4 -4
- package/dist/namespaces/Reports.d.ts +146 -0
- package/dist/namespaces/Reports.js +70 -0
- package/dist/namespaces/Sessions.d.ts +17 -17
- package/dist/namespaces/Sessions.js +25 -25
- package/dist/namespaces/Teams.d.ts +25 -25
- package/dist/namespaces/Teams.js +37 -37
- package/dist/namespaces/Users.d.ts +19 -34
- package/dist/namespaces/Users.js +24 -24
- package/dist/namespaces/WebsiteStats.d.ts +90 -0
- package/dist/namespaces/WebsiteStats.js +34 -0
- package/dist/namespaces/Websites.d.ts +19 -17
- package/dist/namespaces/Websites.js +19 -19
- package/package.json +7 -5
- package/.forgejo/workflows/release.yaml +0 -33
package/dist/namespaces/Admin.js
CHANGED
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Operations around admin management: https://umami.is/docs/api/admin */
|
|
2
2
|
export var Admin;
|
|
3
3
|
(function (Admin) {
|
|
4
|
-
/** Returns all users: https://umami.is/docs/api/admin
|
|
4
|
+
/** Returns all users: https://umami.is/docs/api/admin#get-apiadminusers */
|
|
5
5
|
async function getUsers(parameters) {
|
|
6
6
|
const response = await this.request("get", ["admin", "users"], parameters);
|
|
7
7
|
return response.data;
|
|
8
8
|
}
|
|
9
9
|
Admin.getUsers = getUsers;
|
|
10
|
-
/**
|
|
11
|
-
* Returns all websites: https://umami.is/docs/api/admin-api#get-apiadminwebsites
|
|
12
|
-
* @remarks TODO Possibly doesn't work? (throws 400 on my end)
|
|
13
|
-
*/
|
|
10
|
+
/** Returns all websites: https://umami.is/docs/api/admin#get-apiadminwebsites */
|
|
14
11
|
async function getWebsites(parameters) {
|
|
15
12
|
const response = await this.request("get", ["admin", "websites"], parameters);
|
|
16
13
|
return response.data;
|
|
17
14
|
}
|
|
18
15
|
Admin.getWebsites = getWebsites;
|
|
19
|
-
/**
|
|
20
|
-
* Returns all teams: https://umami.is/docs/api/admin-api#get-apiadminteams
|
|
21
|
-
* @remarks TODO Possibly doesn't work? (throws 404 on my end)
|
|
22
|
-
*/
|
|
16
|
+
/** Returns all teams: https://umami.is/docs/api/admin#get-apiadminteams */
|
|
23
17
|
async function getTeams(parameters) {
|
|
24
18
|
const response = await this.request("get", ["admin", "teams"], parameters);
|
|
25
19
|
return response.data;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { API, Filters, GenericRequestParameters, Timestamps } from "../index.js";
|
|
2
|
-
/**
|
|
2
|
+
/** Operations around Events and Event data: https://umami.is/docs/api/events */
|
|
3
3
|
export declare namespace Events {
|
|
4
|
-
/** Gets website event details within a given time range: https://umami.is/docs/api/events
|
|
5
|
-
function
|
|
4
|
+
/** Gets website event details within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevents (TODO UNTESTED) */
|
|
5
|
+
function get_WEBSITEID_Events(this: API, websiteId: string, parameters: Filters & Timestamps & GenericRequestParameters): Promise<{
|
|
6
6
|
id: string;
|
|
7
7
|
websiteId: string;
|
|
8
8
|
sessionId: string;
|
|
@@ -23,8 +23,8 @@ export declare namespace Events {
|
|
|
23
23
|
eventName: string;
|
|
24
24
|
hasData: number;
|
|
25
25
|
}[]>;
|
|
26
|
-
/** Gets event-data for a individual event https://umami.is/docs/api/events
|
|
27
|
-
function
|
|
26
|
+
/** Gets event-data for a individual event: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataeventid (TODO UNTESTED) */
|
|
27
|
+
function get_WEBSITEID_Eventdata_EVENTID(this: API, websiteId: string, eventId: string): Promise<{
|
|
28
28
|
websiteId: string;
|
|
29
29
|
sessionId: string;
|
|
30
30
|
eventId: string;
|
|
@@ -37,8 +37,8 @@ export declare namespace Events {
|
|
|
37
37
|
dataType: number;
|
|
38
38
|
createdAt: Date;
|
|
39
39
|
}[]>;
|
|
40
|
-
/** Gets event data names, properties, and counts: https://umami.is/docs/api/events
|
|
41
|
-
function
|
|
40
|
+
/** Gets event data names, properties, and counts: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataevents (TODO UNTESTED) */
|
|
41
|
+
function get_WEBSITEID_EventdataEvents(this: API, websiteId: string, parameters: Filters & Timestamps & {
|
|
42
42
|
/** Event name filter */
|
|
43
43
|
event?: string;
|
|
44
44
|
}): Promise<{
|
|
@@ -47,21 +47,21 @@ export declare namespace Events {
|
|
|
47
47
|
dataType: number;
|
|
48
48
|
total: number;
|
|
49
49
|
}[]>;
|
|
50
|
-
/** Gets event data property and value counts within a given time range: https://umami.is/docs/api/events
|
|
51
|
-
function
|
|
50
|
+
/** Gets event data property and value counts within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datafields (TODO UNTESTED) */
|
|
51
|
+
function get_WEBSITEID_EventdataFields(this: API, websiteId: string, parameters: Filters & Timestamps): Promise<{
|
|
52
52
|
propertyName: string;
|
|
53
53
|
dataType: number;
|
|
54
54
|
value: string;
|
|
55
55
|
total: number;
|
|
56
56
|
}[]>;
|
|
57
|
-
/** Gets event name and property counts for a website: https://umami.is/docs/api/events
|
|
58
|
-
function
|
|
57
|
+
/** Gets event name and property counts for a website: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataproperties (TODO UNTESTED) */
|
|
58
|
+
function get_WEBSITEID_EventdataProperties(this: API, websiteId: string, parameters: Filters & Timestamps): Promise<{
|
|
59
59
|
eventName: string;
|
|
60
60
|
propertyName: string;
|
|
61
61
|
total: number;
|
|
62
62
|
}[]>;
|
|
63
|
-
/** Gets event data counts for a given event and property: https://umami.is/docs/api/events
|
|
64
|
-
function
|
|
63
|
+
/** Gets event data counts for a given event and property: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datavalues (TODO UNTESTED) */
|
|
64
|
+
function get_WEBSITEID_EventdataValues(this: API, websiteId: string, parameters: Filters & Timestamps & {
|
|
65
65
|
/** Event name filter */
|
|
66
66
|
event: string;
|
|
67
67
|
/** Property name */
|
|
@@ -70,8 +70,8 @@ export declare namespace Events {
|
|
|
70
70
|
value: string;
|
|
71
71
|
total: number;
|
|
72
72
|
}>;
|
|
73
|
-
/** Gets aggregated website events, properties, and records within a given time range https://umami.is/docs/api/events
|
|
74
|
-
function
|
|
73
|
+
/** Gets aggregated website events, properties, and records within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datastats (TODO UNTESTED) */
|
|
74
|
+
function get_WEBSITEID_EventdataStats(this: API, websiteId: string, parameters: Filters & Timestamps): Promise<{
|
|
75
75
|
events: number;
|
|
76
76
|
properties: number;
|
|
77
77
|
records: number;
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Operations around Events and Event data: https://umami.is/docs/api/events */
|
|
2
2
|
export var Events;
|
|
3
3
|
(function (Events) {
|
|
4
|
-
/** Gets website event details within a given time range: https://umami.is/docs/api/events
|
|
5
|
-
async function
|
|
4
|
+
/** Gets website event details within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevents (TODO UNTESTED) */
|
|
5
|
+
async function get_WEBSITEID_Events(websiteId, parameters) {
|
|
6
6
|
const response = await this.request("get", ["websites", websiteId, "events"], parameters);
|
|
7
7
|
return response.data;
|
|
8
8
|
}
|
|
9
|
-
Events.
|
|
10
|
-
/** Gets event-data for a individual event https://umami.is/docs/api/events
|
|
11
|
-
async function
|
|
9
|
+
Events.get_WEBSITEID_Events = get_WEBSITEID_Events;
|
|
10
|
+
/** Gets event-data for a individual event: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataeventid (TODO UNTESTED) */
|
|
11
|
+
async function get_WEBSITEID_Eventdata_EVENTID(websiteId, eventId) {
|
|
12
12
|
return await this.request("get", ["websites", websiteId, "event-data", eventId]);
|
|
13
13
|
}
|
|
14
|
-
Events.
|
|
15
|
-
/** Gets event data names, properties, and counts: https://umami.is/docs/api/events
|
|
16
|
-
async function
|
|
14
|
+
Events.get_WEBSITEID_Eventdata_EVENTID = get_WEBSITEID_Eventdata_EVENTID;
|
|
15
|
+
/** Gets event data names, properties, and counts: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataevents (TODO UNTESTED) */
|
|
16
|
+
async function get_WEBSITEID_EventdataEvents(websiteId, parameters) {
|
|
17
17
|
return await this.request("get", ["websites", websiteId, "event-data", "events"], parameters);
|
|
18
18
|
}
|
|
19
|
-
Events.
|
|
20
|
-
/** Gets event data property and value counts within a given time range: https://umami.is/docs/api/events
|
|
21
|
-
async function
|
|
19
|
+
Events.get_WEBSITEID_EventdataEvents = get_WEBSITEID_EventdataEvents;
|
|
20
|
+
/** Gets event data property and value counts within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datafields (TODO UNTESTED) */
|
|
21
|
+
async function get_WEBSITEID_EventdataFields(websiteId, parameters) {
|
|
22
22
|
return await this.request("get", ["websites", websiteId, "event-data", "fields"], parameters);
|
|
23
23
|
}
|
|
24
|
-
Events.
|
|
25
|
-
/** Gets event name and property counts for a website: https://umami.is/docs/api/events
|
|
26
|
-
async function
|
|
24
|
+
Events.get_WEBSITEID_EventdataFields = get_WEBSITEID_EventdataFields;
|
|
25
|
+
/** Gets event name and property counts for a website: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataproperties (TODO UNTESTED) */
|
|
26
|
+
async function get_WEBSITEID_EventdataProperties(websiteId, parameters) {
|
|
27
27
|
return await this.request("get", ["websites", websiteId, "event-data", "properties"], parameters);
|
|
28
28
|
}
|
|
29
|
-
Events.
|
|
30
|
-
/** Gets event data counts for a given event and property: https://umami.is/docs/api/events
|
|
31
|
-
async function
|
|
29
|
+
Events.get_WEBSITEID_EventdataProperties = get_WEBSITEID_EventdataProperties;
|
|
30
|
+
/** Gets event data counts for a given event and property: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datavalues (TODO UNTESTED) */
|
|
31
|
+
async function get_WEBSITEID_EventdataValues(websiteId, parameters) {
|
|
32
32
|
return await this.request("get", ["websites", websiteId, "event-data", "values"], parameters);
|
|
33
33
|
}
|
|
34
|
-
Events.
|
|
35
|
-
/** Gets aggregated website events, properties, and records within a given time range https://umami.is/docs/api/events
|
|
36
|
-
async function
|
|
34
|
+
Events.get_WEBSITEID_EventdataValues = get_WEBSITEID_EventdataValues;
|
|
35
|
+
/** Gets aggregated website events, properties, and records within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datastats (TODO UNTESTED) */
|
|
36
|
+
async function get_WEBSITEID_EventdataStats(websiteId, parameters) {
|
|
37
37
|
return await this.request("get", ["websites", websiteId, "event-data", "stats"], parameters);
|
|
38
38
|
}
|
|
39
|
-
Events.
|
|
39
|
+
Events.get_WEBSITEID_EventdataStats = get_WEBSITEID_EventdataStats;
|
|
40
40
|
})(Events || (Events = {}));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { API, GenericObject, GenericRequestParameters } from "../index.js";
|
|
2
|
+
/** Operations around Links management: https://umami.is/docs/api/links */
|
|
3
|
+
export declare namespace Links {
|
|
4
|
+
interface Link extends GenericObject {
|
|
5
|
+
name: string;
|
|
6
|
+
url: string;
|
|
7
|
+
slug: string;
|
|
8
|
+
userId: string;
|
|
9
|
+
teamid: string | null;
|
|
10
|
+
}
|
|
11
|
+
/** Returns all user links: https://umami.is/docs/api/links#get-apilinks (TODO UNTESTED) */
|
|
12
|
+
function get(this: API, parameters?: GenericRequestParameters): Promise<Link[]>;
|
|
13
|
+
/** Gets a link by ID: https://umami.is/docs/api/links#get-apilinkslinkid (TODO UNTESTED) */
|
|
14
|
+
function get_LINKID(this: API, linkId: Link["id"]): Promise<Link>;
|
|
15
|
+
/** Updates a link: https://umami.is/docs/api/links#post-apilinkslinkid (TODO UNTESTED) */
|
|
16
|
+
function post_LINKID(this: API, linkId: Link["id"], parameters: {
|
|
17
|
+
/** The link's name */
|
|
18
|
+
name?: string;
|
|
19
|
+
/** The link's destination URL */
|
|
20
|
+
url?: string;
|
|
21
|
+
/** The link's URL slug, **with a minimum of 8 characters** */
|
|
22
|
+
slug?: string;
|
|
23
|
+
}): Promise<Link>;
|
|
24
|
+
/** Deletes a link: https://umami.is/docs/api/links#delete-apilinkslinkid (TODO UNTESTED) */
|
|
25
|
+
function delete_LINKID(this: API, linkId: Link["id"]): Promise<{
|
|
26
|
+
ok: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Operations around Links management: https://umami.is/docs/api/links */
|
|
2
|
+
export var Links;
|
|
3
|
+
(function (Links) {
|
|
4
|
+
/** Returns all user links: https://umami.is/docs/api/links#get-apilinks (TODO UNTESTED) */
|
|
5
|
+
async function get(parameters) {
|
|
6
|
+
const response = await this.request("get", ["links"], parameters);
|
|
7
|
+
return response.data;
|
|
8
|
+
}
|
|
9
|
+
Links.get = get;
|
|
10
|
+
/** Gets a link by ID: https://umami.is/docs/api/links#get-apilinkslinkid (TODO UNTESTED) */
|
|
11
|
+
async function get_LINKID(linkId) {
|
|
12
|
+
return await this.request("get", ["links", linkId]);
|
|
13
|
+
}
|
|
14
|
+
Links.get_LINKID = get_LINKID;
|
|
15
|
+
/** Updates a link: https://umami.is/docs/api/links#post-apilinkslinkid (TODO UNTESTED) */
|
|
16
|
+
async function post_LINKID(linkId, parameters) {
|
|
17
|
+
return await this.request("post", ["links", linkId], parameters);
|
|
18
|
+
}
|
|
19
|
+
Links.post_LINKID = post_LINKID;
|
|
20
|
+
/** Deletes a link: https://umami.is/docs/api/links#delete-apilinkslinkid (TODO UNTESTED) */
|
|
21
|
+
async function delete_LINKID(linkId) {
|
|
22
|
+
return await this.request("delete", ["links", linkId]);
|
|
23
|
+
}
|
|
24
|
+
Links.delete_LINKID = delete_LINKID;
|
|
25
|
+
})(Links || (Links = {}));
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { API, GenericObject, MinimalUser, Role, TeamRole } from "../index.js";
|
|
2
|
+
/** All information about your session: https://umami.is/docs/api/me */
|
|
3
|
+
export declare namespace Me {
|
|
4
|
+
/** Get information based on your auth token: https://umami.is/docs/api/me#get-apime (TODO UNTESTED) */
|
|
5
|
+
function get(this: API): Promise<{
|
|
6
|
+
token: string;
|
|
7
|
+
authKey: string;
|
|
8
|
+
shareToken: string | null;
|
|
9
|
+
user: {
|
|
10
|
+
id: string;
|
|
11
|
+
username: string;
|
|
12
|
+
role: Role;
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
isAdmin: boolean;
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
17
|
+
/** Get all your teams: https://umami.is/docs/api/me#get-apimeteams (TODO UNTESTED) */
|
|
18
|
+
function getTeams(this: API): Promise<(GenericObject & {
|
|
19
|
+
name: string;
|
|
20
|
+
accessCode: string;
|
|
21
|
+
logoUrl: string | null;
|
|
22
|
+
members: (Omit<GenericObject, "deletedAt"> & {
|
|
23
|
+
teamId: string;
|
|
24
|
+
userId: string;
|
|
25
|
+
role: TeamRole;
|
|
26
|
+
user: MinimalUser;
|
|
27
|
+
})[];
|
|
28
|
+
_count: {
|
|
29
|
+
websites: number;
|
|
30
|
+
members: number;
|
|
31
|
+
};
|
|
32
|
+
})[]>;
|
|
33
|
+
/** Get all your websites: https://umami.is/docs/api/me#get-apimeteams (TODO UNTESTED) */
|
|
34
|
+
function getWebsites(this: API): Promise<(GenericObject & {
|
|
35
|
+
name: string;
|
|
36
|
+
domain: string;
|
|
37
|
+
shareId: string | null;
|
|
38
|
+
resetAt: Date | null;
|
|
39
|
+
userId: string;
|
|
40
|
+
teamId: string | null;
|
|
41
|
+
createdBy: string;
|
|
42
|
+
user: MinimalUser;
|
|
43
|
+
})[]>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** All information about your session: https://umami.is/docs/api/me */
|
|
2
|
+
export var Me;
|
|
3
|
+
(function (Me) {
|
|
4
|
+
/** Get information based on your auth token: https://umami.is/docs/api/me#get-apime (TODO UNTESTED) */
|
|
5
|
+
async function get() {
|
|
6
|
+
return await this.request("get", ["me"]);
|
|
7
|
+
}
|
|
8
|
+
Me.get = get;
|
|
9
|
+
/** Get all your teams: https://umami.is/docs/api/me#get-apimeteams (TODO UNTESTED) */
|
|
10
|
+
async function getTeams() {
|
|
11
|
+
const response = await this.request("get", ["me", "teams"]);
|
|
12
|
+
return response.data;
|
|
13
|
+
}
|
|
14
|
+
Me.getTeams = getTeams;
|
|
15
|
+
/** Get all your websites: https://umami.is/docs/api/me#get-apimeteams (TODO UNTESTED) */
|
|
16
|
+
async function getWebsites() {
|
|
17
|
+
const response = await this.request("get", ["me", "websites"]);
|
|
18
|
+
return response.data;
|
|
19
|
+
}
|
|
20
|
+
Me.getWebsites = getWebsites;
|
|
21
|
+
})(Me || (Me = {}));
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { API, GenericObject, GenericRequestParameters } from "../index.js";
|
|
2
|
+
/** Operations around Pixels management: https://umami.is/docs/api/pixels */
|
|
3
|
+
export declare namespace Pixels {
|
|
4
|
+
interface Pixel extends GenericObject {
|
|
5
|
+
name: string;
|
|
6
|
+
slug: string;
|
|
7
|
+
userId: string;
|
|
8
|
+
teamid: string | null;
|
|
9
|
+
}
|
|
10
|
+
/** Returns all user pixels: https://umami.is/docs/api/pixels#get-apipixels (TODO UNTESTED) */
|
|
11
|
+
function get(this: API, parameters?: GenericRequestParameters): Promise<Pixel[]>;
|
|
12
|
+
/** Gets a pixel by ID: https://umami.is/docs/api/pixels#get-apipixelspixelid (TODO UNTESTED) */
|
|
13
|
+
function get_PIXELID(this: API, pixelId: Pixel["id"]): Promise<Pixel>;
|
|
14
|
+
/** Updates a pixel: https://umami.is/docs/api/pixels#post-apipixelspixelid (TODO UNTESTED) */
|
|
15
|
+
function post_PIXELID(this: API, pixelId: Pixel["id"], parameters: {
|
|
16
|
+
/** The pixel's name */
|
|
17
|
+
name?: string;
|
|
18
|
+
/** The pixel's URL slug, **with a minimum of 8 characters** */
|
|
19
|
+
slug?: string;
|
|
20
|
+
}): Promise<Pixel>;
|
|
21
|
+
/** Deletes a pixel: https://umami.is/docs/api/pixels#delete-apipixelspixelid (TODO UNTESTED) */
|
|
22
|
+
function delete_PIXELID(this: API, pixelId: Pixel["id"]): Promise<{
|
|
23
|
+
ok: boolean;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Operations around Pixels management: https://umami.is/docs/api/pixels */
|
|
2
|
+
export var Pixels;
|
|
3
|
+
(function (Pixels) {
|
|
4
|
+
/** Returns all user pixels: https://umami.is/docs/api/pixels#get-apipixels (TODO UNTESTED) */
|
|
5
|
+
async function get(parameters) {
|
|
6
|
+
const response = await this.request("get", ["pixels"], parameters);
|
|
7
|
+
return response.data;
|
|
8
|
+
}
|
|
9
|
+
Pixels.get = get;
|
|
10
|
+
/** Gets a pixel by ID: https://umami.is/docs/api/pixels#get-apipixelspixelid (TODO UNTESTED) */
|
|
11
|
+
async function get_PIXELID(pixelId) {
|
|
12
|
+
return await this.request("get", ["pixels", pixelId]);
|
|
13
|
+
}
|
|
14
|
+
Pixels.get_PIXELID = get_PIXELID;
|
|
15
|
+
/** Updates a pixel: https://umami.is/docs/api/pixels#post-apipixelspixelid (TODO UNTESTED) */
|
|
16
|
+
async function post_PIXELID(pixelId, parameters) {
|
|
17
|
+
return await this.request("post", ["pixels", pixelId], parameters);
|
|
18
|
+
}
|
|
19
|
+
Pixels.post_PIXELID = post_PIXELID;
|
|
20
|
+
/** Deletes a pixel: https://umami.is/docs/api/pixels#delete-apipixelspixelid (TODO UNTESTED) */
|
|
21
|
+
async function delete_PIXELID(pixelId) {
|
|
22
|
+
return await this.request("delete", ["pixels", pixelId]);
|
|
23
|
+
}
|
|
24
|
+
Pixels.delete_PIXELID = delete_PIXELID;
|
|
25
|
+
})(Pixels || (Pixels = {}));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { API } from "../index.js";
|
|
2
|
-
/**
|
|
2
|
+
/** Realtime data for your website: https://umami.is/docs/api/realtime */
|
|
3
3
|
export declare namespace Realtime {
|
|
4
|
-
/** Realtime stats within the last 30 minutes: https://umami.is/docs/api/realtime
|
|
5
|
-
function
|
|
4
|
+
/** Realtime stats within the last 30 minutes: https://umami.is/docs/api/realtime#get-apirealtimewebsiteid (TODO UNTESTED) */
|
|
5
|
+
function get_WEBSITEID(this: API, websiteId: string): Promise<{
|
|
6
6
|
countries: {
|
|
7
7
|
[k: string]: number;
|
|
8
8
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Realtime data for your website: https://umami.is/docs/api/realtime */
|
|
2
2
|
export var Realtime;
|
|
3
3
|
(function (Realtime) {
|
|
4
|
-
/** Realtime stats within the last 30 minutes: https://umami.is/docs/api/realtime
|
|
5
|
-
async function
|
|
4
|
+
/** Realtime stats within the last 30 minutes: https://umami.is/docs/api/realtime#get-apirealtimewebsiteid (TODO UNTESTED) */
|
|
5
|
+
async function get_WEBSITEID(websiteId) {
|
|
6
6
|
return await this.request("post", ["realtime", websiteId]);
|
|
7
7
|
}
|
|
8
|
-
Realtime.
|
|
8
|
+
Realtime.get_WEBSITEID = get_WEBSITEID;
|
|
9
9
|
})(Realtime || (Realtime = {}));
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { API, Filters, GenericRequestParameters, NameValue, Report, Timestamps, XTY } from "../index.js";
|
|
2
|
+
/** Using reports throught the api: https://umami.is/docs/api/reports */
|
|
3
|
+
export declare namespace Reports {
|
|
4
|
+
type ReportType = {
|
|
5
|
+
type: "attribution" | "breakdown" | "funnel" | "goal" | "journey" | "retention" | "revenue" | "utm";
|
|
6
|
+
};
|
|
7
|
+
interface UTM {
|
|
8
|
+
utm: string;
|
|
9
|
+
views: number;
|
|
10
|
+
}
|
|
11
|
+
/** Get all reports by website ID: https://umami.is/docs/api/reports#get-apireports (TODO UNTESTED) */
|
|
12
|
+
function get(this: API, websiteId: string, parameters: ReportType & Omit<GenericRequestParameters, "search">): Promise<Report[]>;
|
|
13
|
+
/** Creates a report: https://umami.is/docs/api/reports#post-apireports (TODO UNTESTED) */
|
|
14
|
+
function post(this: API, websiteId: string, parameters: ReportType & {
|
|
15
|
+
/** Name of report */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Description of report */
|
|
18
|
+
description?: string;
|
|
19
|
+
/** Parameters for report */
|
|
20
|
+
parameters?: any;
|
|
21
|
+
}): Promise<Report>;
|
|
22
|
+
/** Gets a report by ID: https://umami.is/docs/api/reports#get-apireportsreportid (TODO UNTESTED) */
|
|
23
|
+
function get_REPORTID(this: API, reportId: string): Promise<Report>;
|
|
24
|
+
/** Updates a report: https://umami.is/docs/api/reports#post-apireportsreportid (TODO UNTESTED) */
|
|
25
|
+
function post_REPORTID(this: API, reportId: string, websiteId: string, parameters: ReportType & {
|
|
26
|
+
/** Name of report */
|
|
27
|
+
name: string;
|
|
28
|
+
/** Description of report */
|
|
29
|
+
description?: string;
|
|
30
|
+
/** Parameters for report */
|
|
31
|
+
parameters?: any;
|
|
32
|
+
}): Promise<Report>;
|
|
33
|
+
/** Deletes a report: https://umami.is/docs/api/reports#delete-apireportsreportid (TODO UNTESTED) */
|
|
34
|
+
function delete_REPORTID(this: API, reportId: string): Promise<{
|
|
35
|
+
ok: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
/** See how users engage with your marketing and what drives conversions: https://umami.is/docs/api/reports#post-apireportsattribution (TODO UNTESTED) */
|
|
38
|
+
function postAttribution(this: API, websiteId: string, parameters: ReportType & Filters & Timestamps & {
|
|
39
|
+
/** Attribution model */
|
|
40
|
+
model: "firstClick" | "lastClick";
|
|
41
|
+
/** Conversion type */
|
|
42
|
+
type: ("path" | "event")[];
|
|
43
|
+
/** Conversion step */
|
|
44
|
+
step: string;
|
|
45
|
+
}): Promise<{
|
|
46
|
+
referrer: NameValue[];
|
|
47
|
+
paidAds: NameValue[];
|
|
48
|
+
utm_source: NameValue[];
|
|
49
|
+
utm_medium: NameValue[];
|
|
50
|
+
utm_campaign: NameValue[];
|
|
51
|
+
utm_content: NameValue[];
|
|
52
|
+
utm_term: NameValue[];
|
|
53
|
+
total: {
|
|
54
|
+
pageviews: number;
|
|
55
|
+
visitors: number;
|
|
56
|
+
visits: number;
|
|
57
|
+
};
|
|
58
|
+
}>;
|
|
59
|
+
/** Dive deeper into your data by using segments and filters: https://umami.is/docs/api/reports#post-apireportsbreakdown (TODO UNTESTED) */
|
|
60
|
+
function postBreakdown(this: API, websiteId: string, parameters: ReportType & Filters & Timestamps & {
|
|
61
|
+
fields: ("path" | "title" | "query" | "referrer" | "browser" | "os" | "device" | "country" | "region" | "city" | "hostname" | "tag" | "event")[];
|
|
62
|
+
}): Promise<{
|
|
63
|
+
views: number;
|
|
64
|
+
visitors: number;
|
|
65
|
+
visits: number;
|
|
66
|
+
bounces: number;
|
|
67
|
+
totaltime: number;
|
|
68
|
+
os: string;
|
|
69
|
+
country: string;
|
|
70
|
+
}[]>;
|
|
71
|
+
/** Understand the conversion and drop-off rate of users: https://umami.is/docs/api/reports#post-apireportsfunnel (TODO UNTESTED) */
|
|
72
|
+
function postFunnel(this: API, websiteId: string, parameters: ReportType & Filters & Timestamps & {
|
|
73
|
+
/** Type of event and conversion step */
|
|
74
|
+
steps: {
|
|
75
|
+
type: "path" | "event";
|
|
76
|
+
value: string;
|
|
77
|
+
}[];
|
|
78
|
+
/** Window of days between funnel steps to be considered a conversion */
|
|
79
|
+
window: number;
|
|
80
|
+
}): Promise<{
|
|
81
|
+
type: string;
|
|
82
|
+
value: string;
|
|
83
|
+
visitors: number;
|
|
84
|
+
previous: number;
|
|
85
|
+
dropped: number;
|
|
86
|
+
dropoff: number | null;
|
|
87
|
+
remaining: number;
|
|
88
|
+
}[]>;
|
|
89
|
+
/** Track your goals for pageviews and events: https://umami.is/docs/api/reports#post-apireportsgoals (TODO UNTESTED) */
|
|
90
|
+
function postGoals(this: API, websiteId: string, parameters: ReportType & Filters & Timestamps & {
|
|
91
|
+
/** Conversion type */
|
|
92
|
+
type: ("path" | "event")[];
|
|
93
|
+
/** Conversion step value */
|
|
94
|
+
value: string;
|
|
95
|
+
}): Promise<{
|
|
96
|
+
num: number;
|
|
97
|
+
total: number;
|
|
98
|
+
}>;
|
|
99
|
+
/** Understand how users nagivate through your website: https://umami.is/docs/api/reports#post-apireportsjourney (TODO UNTESTED) */
|
|
100
|
+
function postJourney(this: API, websiteId: string, parameters: ReportType & Filters & Timestamps & {
|
|
101
|
+
/** Number of steps from 3 to 7 */
|
|
102
|
+
steps: number;
|
|
103
|
+
/** Starting step URL or event name */
|
|
104
|
+
startStep: string;
|
|
105
|
+
/** Ending step URL or event name */
|
|
106
|
+
endStep?: string;
|
|
107
|
+
}): Promise<{
|
|
108
|
+
items: (string | null)[];
|
|
109
|
+
count: number;
|
|
110
|
+
}[]>;
|
|
111
|
+
/** Measure your website stickiness by tracking how often users return: https://umami.is/docs/api/reports#post-apireportsretention (TODO UNTESTED) */
|
|
112
|
+
function postRetention(this: API, websiteId: string, parameters: ReportType & Filters & Timestamps & {
|
|
113
|
+
/** Timezone (ex. America/Los_Angeles) */
|
|
114
|
+
timezone: string;
|
|
115
|
+
}): Promise<{
|
|
116
|
+
date: Date;
|
|
117
|
+
day: number;
|
|
118
|
+
visitors: number;
|
|
119
|
+
returnVisitors: number;
|
|
120
|
+
percentage: number;
|
|
121
|
+
}[]>;
|
|
122
|
+
/** Get currency for given range. Needed for Revenue and optional in Attribution reports: https://umami.is/docs/api/reports#post-apireportsrevenue (TODO UNTESTED) */
|
|
123
|
+
function postRevenue(this: API, websiteId: string, parameters: ReportType & Filters & Timestamps & {
|
|
124
|
+
/** Timezone (ex. America/Los_Angeles) */
|
|
125
|
+
timezone: string;
|
|
126
|
+
/** Currency code (ISO 4217) */
|
|
127
|
+
currency: string;
|
|
128
|
+
}): Promise<{
|
|
129
|
+
chart: XTY[];
|
|
130
|
+
country: NameValue[];
|
|
131
|
+
total: {
|
|
132
|
+
sum: number;
|
|
133
|
+
count: number;
|
|
134
|
+
unique_count: number;
|
|
135
|
+
average: number;
|
|
136
|
+
};
|
|
137
|
+
}>;
|
|
138
|
+
/** Track your campaigns through UTM parameters: https://umami.is/docs/api/reports#post-apireportsutm (TODO UNTESTED) */
|
|
139
|
+
function postUTM(this: API, websiteId: string, parameters: ReportType & Filters & Timestamps): Promise<{
|
|
140
|
+
utm_source: UTM[];
|
|
141
|
+
utm_medium: UTM[];
|
|
142
|
+
utm_campaign: UTM[];
|
|
143
|
+
utm_term: UTM[];
|
|
144
|
+
utm_content: UTM[];
|
|
145
|
+
}>;
|
|
146
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/** Using reports throught the api: https://umami.is/docs/api/reports */
|
|
2
|
+
export var Reports;
|
|
3
|
+
(function (Reports) {
|
|
4
|
+
/** Get all reports by website ID: https://umami.is/docs/api/reports#get-apireports (TODO UNTESTED) */
|
|
5
|
+
async function get(websiteId, parameters) {
|
|
6
|
+
const response = await this.request("get", ["reports"], { websiteId, ...parameters });
|
|
7
|
+
return response.data;
|
|
8
|
+
}
|
|
9
|
+
Reports.get = get;
|
|
10
|
+
/** Creates a report: https://umami.is/docs/api/reports#post-apireports (TODO UNTESTED) */
|
|
11
|
+
async function post(websiteId, parameters) {
|
|
12
|
+
return await this.request("post", ["reports"], { websiteId, ...parameters });
|
|
13
|
+
}
|
|
14
|
+
Reports.post = post;
|
|
15
|
+
/** Gets a report by ID: https://umami.is/docs/api/reports#get-apireportsreportid (TODO UNTESTED) */
|
|
16
|
+
async function get_REPORTID(reportId) {
|
|
17
|
+
return await this.request("get", ["reports", reportId]);
|
|
18
|
+
}
|
|
19
|
+
Reports.get_REPORTID = get_REPORTID;
|
|
20
|
+
/** Updates a report: https://umami.is/docs/api/reports#post-apireportsreportid (TODO UNTESTED) */
|
|
21
|
+
async function post_REPORTID(reportId, websiteId, parameters) {
|
|
22
|
+
return await this.request("get", ["reports", reportId], { websiteId, ...parameters });
|
|
23
|
+
}
|
|
24
|
+
Reports.post_REPORTID = post_REPORTID;
|
|
25
|
+
/** Deletes a report: https://umami.is/docs/api/reports#delete-apireportsreportid (TODO UNTESTED) */
|
|
26
|
+
async function delete_REPORTID(reportId) {
|
|
27
|
+
return await this.request("delete", ["reports", reportId]);
|
|
28
|
+
}
|
|
29
|
+
Reports.delete_REPORTID = delete_REPORTID;
|
|
30
|
+
/** See how users engage with your marketing and what drives conversions: https://umami.is/docs/api/reports#post-apireportsattribution (TODO UNTESTED) */
|
|
31
|
+
async function postAttribution(websiteId, parameters) {
|
|
32
|
+
return await this.request("post", ["reports", "attribution"], { websiteId, ...parameters });
|
|
33
|
+
}
|
|
34
|
+
Reports.postAttribution = postAttribution;
|
|
35
|
+
/** Dive deeper into your data by using segments and filters: https://umami.is/docs/api/reports#post-apireportsbreakdown (TODO UNTESTED) */
|
|
36
|
+
async function postBreakdown(websiteId, parameters) {
|
|
37
|
+
return await this.request("post", ["reports", "breakdown"], { websiteId, ...parameters });
|
|
38
|
+
}
|
|
39
|
+
Reports.postBreakdown = postBreakdown;
|
|
40
|
+
/** Understand the conversion and drop-off rate of users: https://umami.is/docs/api/reports#post-apireportsfunnel (TODO UNTESTED) */
|
|
41
|
+
async function postFunnel(websiteId, parameters) {
|
|
42
|
+
return await this.request("post", ["reports", "funnel"], { websiteId, ...parameters });
|
|
43
|
+
}
|
|
44
|
+
Reports.postFunnel = postFunnel;
|
|
45
|
+
/** Track your goals for pageviews and events: https://umami.is/docs/api/reports#post-apireportsgoals (TODO UNTESTED) */
|
|
46
|
+
async function postGoals(websiteId, parameters) {
|
|
47
|
+
return await this.request("post", ["reports", "goals"], { websiteId, ...parameters });
|
|
48
|
+
}
|
|
49
|
+
Reports.postGoals = postGoals;
|
|
50
|
+
/** Understand how users nagivate through your website: https://umami.is/docs/api/reports#post-apireportsjourney (TODO UNTESTED) */
|
|
51
|
+
async function postJourney(websiteId, parameters) {
|
|
52
|
+
return await this.request("post", ["reports", "journey"], { websiteId, ...parameters });
|
|
53
|
+
}
|
|
54
|
+
Reports.postJourney = postJourney;
|
|
55
|
+
/** Measure your website stickiness by tracking how often users return: https://umami.is/docs/api/reports#post-apireportsretention (TODO UNTESTED) */
|
|
56
|
+
async function postRetention(websiteId, parameters) {
|
|
57
|
+
return await this.request("post", ["reports", "retention"], { websiteId, ...parameters });
|
|
58
|
+
}
|
|
59
|
+
Reports.postRetention = postRetention;
|
|
60
|
+
/** Get currency for given range. Needed for Revenue and optional in Attribution reports: https://umami.is/docs/api/reports#post-apireportsrevenue (TODO UNTESTED) */
|
|
61
|
+
async function postRevenue(websiteId, parameters) {
|
|
62
|
+
return await this.request("post", ["reports", "revenue"], { websiteId, ...parameters });
|
|
63
|
+
}
|
|
64
|
+
Reports.postRevenue = postRevenue;
|
|
65
|
+
/** Track your campaigns through UTM parameters: https://umami.is/docs/api/reports#post-apireportsutm (TODO UNTESTED) */
|
|
66
|
+
async function postUTM(websiteId, parameters) {
|
|
67
|
+
return await this.request("post", ["reports", "utm"], { websiteId, ...parameters });
|
|
68
|
+
}
|
|
69
|
+
Reports.postUTM = postUTM;
|
|
70
|
+
})(Reports || (Reports = {}));
|