umami-api-js 0.1.4 → 0.2.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 +1 -1
- package/dist/namespaces/Admin.d.ts +1 -4
- package/dist/namespaces/Events.d.ts +28 -22
- package/dist/namespaces/Links.d.ts +4 -4
- package/dist/namespaces/Links.js +4 -4
- package/dist/namespaces/Me.d.ts +2 -2
- package/dist/namespaces/Pixels.d.ts +4 -4
- package/dist/namespaces/Pixels.js +4 -4
- package/dist/namespaces/Realtime.d.ts +7 -6
- package/dist/namespaces/Sessions.d.ts +30 -31
- package/dist/namespaces/Teams.d.ts +4 -1
- package/dist/namespaces/Users.d.ts +1 -1
- package/dist/namespaces/WebsiteStats.js +2 -7
- package/dist/namespaces/Websites.d.ts +6 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
A package to interact with [the API of self-hosted instances of Umami](https://umami.is/docs/api). It is a lightweight alternative to [@umami/api-client](https://github.com/umami-software/api-client), forked from [osu-api-v2-js](https://github.com/TTTaevas/osu-api-v2-js).
|
|
2
2
|
|
|
3
|
-
If you are reading this from the [package's documentation](https://umami-api-js.taevas.xyz/), please be aware that the documentation is for **umami-api-js@0.
|
|
3
|
+
If you are reading this from the [package's documentation](https://umami-api-js.taevas.xyz/), please be aware that the documentation is for **umami-api-js@0.2.0**, so make sure your package is up to date! Report any bug on [Codeberg](https://codeberg.org/Taevas/umami-api-js/issues).
|
|
4
4
|
|
|
5
5
|
Please note that this package is expected to work with self-hosted instances of **Umami v3.0.3**, and is *not* expected to work with [Umami Cloud](https://umami.is/docs/cloud), the instance of Umami hosted by its creators.
|
|
@@ -4,10 +4,7 @@ export declare namespace Admin {
|
|
|
4
4
|
/** Returns all users: https://umami.is/docs/api/admin#get-apiadminusers */
|
|
5
5
|
function getUsers(this: API, parameters?: GenericRequestParameters): Promise<Users.DetailedUser[]>;
|
|
6
6
|
/** Returns all websites: https://umami.is/docs/api/admin#get-apiadminwebsites */
|
|
7
|
-
function getWebsites(this: API, parameters?: GenericRequestParameters): Promise<
|
|
8
|
-
/** @remarks TODO Documentation says it can be null but doesn't actually say what else it can be, ***presumed* to be string**, check */
|
|
9
|
-
team: string | null;
|
|
10
|
-
})[]>;
|
|
7
|
+
function getWebsites(this: API, parameters?: GenericRequestParameters): Promise<Websites.WebsiteWithUserTeam[]>;
|
|
11
8
|
/** Returns all teams: https://umami.is/docs/api/admin#get-apiadminteams */
|
|
12
9
|
function getTeams(this: API, parameters?: GenericRequestParameters): Promise<Teams.TeamWithMembersCount[]>;
|
|
13
10
|
}
|
|
@@ -20,12 +20,11 @@ export declare namespace Events {
|
|
|
20
20
|
pageTitle: string | null;
|
|
21
21
|
eventType: number;
|
|
22
22
|
eventName: string;
|
|
23
|
-
hasData?:
|
|
23
|
+
hasData?: boolean;
|
|
24
24
|
}
|
|
25
25
|
/** Gets website event details within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevents */
|
|
26
26
|
function get_WEBSITEID_Events(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps & GenericRequestParameters): Promise<Event[]>;
|
|
27
|
-
|
|
28
|
-
function get_WEBSITEID_Eventdata_EVENTID(this: API, websiteId: Websites.Website["id"], eventId: Event["id"]): Promise<{
|
|
27
|
+
interface Data {
|
|
29
28
|
websiteId: Websites.Website["id"];
|
|
30
29
|
sessionId?: Sessions.Session["id"];
|
|
31
30
|
eventId: Event["id"];
|
|
@@ -37,44 +36,51 @@ export declare namespace Events {
|
|
|
37
36
|
dateValue: Date | null;
|
|
38
37
|
dataType: number;
|
|
39
38
|
createdAt: Date;
|
|
40
|
-
}
|
|
39
|
+
}
|
|
40
|
+
/** Gets event-data for a individual event: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataeventid */
|
|
41
|
+
function get_WEBSITEID_Eventdata_EVENTID(this: API, websiteId: Websites.Website["id"], eventId: Event["id"]): Promise<Data[]>;
|
|
42
|
+
interface DataMultiple {
|
|
43
|
+
eventName: Event["eventName"];
|
|
44
|
+
propertyName: string;
|
|
45
|
+
dataType: number;
|
|
46
|
+
total: number;
|
|
47
|
+
}
|
|
41
48
|
/** Gets event data names, properties, and counts: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataevents (TODO Server returns a 500) */
|
|
42
49
|
function get_WEBSITEID_EventdataEvents(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps & {
|
|
43
50
|
/** Event name filter */
|
|
44
51
|
event?: Event["eventName"];
|
|
45
|
-
}): Promise<
|
|
46
|
-
|
|
52
|
+
}): Promise<DataMultiple[]>;
|
|
53
|
+
interface DataFields {
|
|
47
54
|
propertyName: string;
|
|
48
55
|
dataType: number;
|
|
56
|
+
value: string;
|
|
49
57
|
total: number;
|
|
50
|
-
}
|
|
58
|
+
}
|
|
51
59
|
/** Gets event data property and value counts within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datafields */
|
|
52
|
-
function get_WEBSITEID_EventdataFields(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps): Promise<
|
|
60
|
+
function get_WEBSITEID_EventdataFields(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps): Promise<DataFields[]>;
|
|
61
|
+
interface DataProperties {
|
|
62
|
+
eventName: Event["eventName"] | null;
|
|
53
63
|
propertyName: string;
|
|
54
|
-
dataType: number;
|
|
55
|
-
value: string;
|
|
56
64
|
total: number;
|
|
57
|
-
}
|
|
65
|
+
}
|
|
58
66
|
/** Gets event name and property counts for a website: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-dataproperties */
|
|
59
|
-
function get_WEBSITEID_EventdataProperties(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps): Promise<
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
function get_WEBSITEID_EventdataProperties(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps): Promise<DataProperties[]>;
|
|
68
|
+
interface DataValues {
|
|
69
|
+
value: string;
|
|
62
70
|
total: number;
|
|
63
|
-
}
|
|
71
|
+
}
|
|
64
72
|
/** Gets event data counts for a given event and property: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datavalues */
|
|
65
73
|
function get_WEBSITEID_EventdataValues(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps & {
|
|
66
74
|
/** Event name filter */
|
|
67
75
|
event: Event["eventName"];
|
|
68
76
|
/** Property name */
|
|
69
77
|
propertyName: string;
|
|
70
|
-
}): Promise<
|
|
71
|
-
|
|
72
|
-
total: number;
|
|
73
|
-
}[]>;
|
|
74
|
-
/** Gets aggregated website events, properties, and records within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datastats */
|
|
75
|
-
function get_WEBSITEID_EventdataStats(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps): Promise<{
|
|
78
|
+
}): Promise<DataValues[]>;
|
|
79
|
+
interface DataStats {
|
|
76
80
|
events: number;
|
|
77
81
|
properties: number;
|
|
78
82
|
records: number;
|
|
79
|
-
}
|
|
83
|
+
}
|
|
84
|
+
/** Gets aggregated website events, properties, and records within a given time range: https://umami.is/docs/api/events#get-apiwebsiteswebsiteidevent-datastats */
|
|
85
|
+
function get_WEBSITEID_EventdataStats(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps): Promise<DataStats>;
|
|
80
86
|
}
|
|
@@ -12,11 +12,11 @@ export declare namespace Links {
|
|
|
12
12
|
updatedAt: Date;
|
|
13
13
|
deletedAt: Date | null;
|
|
14
14
|
}
|
|
15
|
-
/** Returns all user links: https://umami.is/docs/api/links#get-apilinks
|
|
15
|
+
/** Returns all user links: https://umami.is/docs/api/links#get-apilinks */
|
|
16
16
|
function get(this: API, parameters?: GenericRequestParameters): Promise<Link[]>;
|
|
17
|
-
/** Gets a link by ID: https://umami.is/docs/api/links#get-apilinkslinkid
|
|
17
|
+
/** Gets a link by ID: https://umami.is/docs/api/links#get-apilinkslinkid */
|
|
18
18
|
function get_LINKID(this: API, linkId: Link["id"]): Promise<Link>;
|
|
19
|
-
/** Updates a link: https://umami.is/docs/api/links#post-apilinkslinkid
|
|
19
|
+
/** Updates a link: https://umami.is/docs/api/links#post-apilinkslinkid */
|
|
20
20
|
function post_LINKID(this: API, linkId: Link["id"], parameters: {
|
|
21
21
|
/** The link's name */
|
|
22
22
|
name?: Link["name"];
|
|
@@ -25,6 +25,6 @@ export declare namespace Links {
|
|
|
25
25
|
/** The link's URL slug, **with a minimum of 8 characters** */
|
|
26
26
|
slug?: Link["slug"];
|
|
27
27
|
}): Promise<Link>;
|
|
28
|
-
/** Deletes a link: https://umami.is/docs/api/links#delete-apilinkslinkid
|
|
28
|
+
/** Deletes a link: https://umami.is/docs/api/links#delete-apilinkslinkid */
|
|
29
29
|
function delete_LINKID(this: API, linkId: Link["id"]): Promise<DeletionResult>;
|
|
30
30
|
}
|
package/dist/namespaces/Links.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/** Operations around Links management: https://umami.is/docs/api/links */
|
|
2
2
|
export var Links;
|
|
3
3
|
(function (Links) {
|
|
4
|
-
/** Returns all user links: https://umami.is/docs/api/links#get-apilinks
|
|
4
|
+
/** Returns all user links: https://umami.is/docs/api/links#get-apilinks */
|
|
5
5
|
async function get(parameters) {
|
|
6
6
|
const response = await this.request("get", ["links"], parameters);
|
|
7
7
|
return response.data;
|
|
8
8
|
}
|
|
9
9
|
Links.get = get;
|
|
10
|
-
/** Gets a link by ID: https://umami.is/docs/api/links#get-apilinkslinkid
|
|
10
|
+
/** Gets a link by ID: https://umami.is/docs/api/links#get-apilinkslinkid */
|
|
11
11
|
async function get_LINKID(linkId) {
|
|
12
12
|
return await this.request("get", ["links", linkId]);
|
|
13
13
|
}
|
|
14
14
|
Links.get_LINKID = get_LINKID;
|
|
15
|
-
/** Updates a link: https://umami.is/docs/api/links#post-apilinkslinkid
|
|
15
|
+
/** Updates a link: https://umami.is/docs/api/links#post-apilinkslinkid */
|
|
16
16
|
async function post_LINKID(linkId, parameters) {
|
|
17
17
|
return await this.request("post", ["links", linkId], parameters);
|
|
18
18
|
}
|
|
19
19
|
Links.post_LINKID = post_LINKID;
|
|
20
|
-
/** Deletes a link: https://umami.is/docs/api/links#delete-apilinkslinkid
|
|
20
|
+
/** Deletes a link: https://umami.is/docs/api/links#delete-apilinkslinkid */
|
|
21
21
|
async function delete_LINKID(linkId) {
|
|
22
22
|
return await this.request("delete", ["links", linkId]);
|
|
23
23
|
}
|
package/dist/namespaces/Me.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { API, Teams, Users, Websites } from "../index.js";
|
|
|
2
2
|
/** All information about your session: https://umami.is/docs/api/me */
|
|
3
3
|
export declare namespace Me {
|
|
4
4
|
interface TokenInformation {
|
|
5
|
-
token:
|
|
6
|
-
authKey: string;
|
|
5
|
+
token: string;
|
|
7
6
|
shareToken: string | null;
|
|
7
|
+
authKey?: string;
|
|
8
8
|
user: Users.User;
|
|
9
9
|
}
|
|
10
10
|
/** Get information based on your auth token: https://umami.is/docs/api/me#get-apime */
|
|
@@ -11,17 +11,17 @@ export declare namespace Pixels {
|
|
|
11
11
|
updatedAt: Date;
|
|
12
12
|
deletedAt: Date | null;
|
|
13
13
|
}
|
|
14
|
-
/** Returns all user pixels: https://umami.is/docs/api/pixels#get-apipixels
|
|
14
|
+
/** Returns all user pixels: https://umami.is/docs/api/pixels#get-apipixels */
|
|
15
15
|
function get(this: API, parameters?: GenericRequestParameters): Promise<Pixel[]>;
|
|
16
|
-
/** Gets a pixel by ID: https://umami.is/docs/api/pixels#get-apipixelspixelid
|
|
16
|
+
/** Gets a pixel by ID: https://umami.is/docs/api/pixels#get-apipixelspixelid */
|
|
17
17
|
function get_PIXELID(this: API, pixelId: Pixel["id"]): Promise<Pixel>;
|
|
18
|
-
/** Updates a pixel: https://umami.is/docs/api/pixels#post-apipixelspixelid
|
|
18
|
+
/** Updates a pixel: https://umami.is/docs/api/pixels#post-apipixelspixelid */
|
|
19
19
|
function post_PIXELID(this: API, pixelId: Pixel["id"], parameters: {
|
|
20
20
|
/** The pixel's name */
|
|
21
21
|
name?: Pixel["name"];
|
|
22
22
|
/** The pixel's URL slug, **with a minimum of 8 characters** */
|
|
23
23
|
slug?: Pixel["slug"];
|
|
24
24
|
}): Promise<Pixel>;
|
|
25
|
-
/** Deletes a pixel: https://umami.is/docs/api/pixels#delete-apipixelspixelid
|
|
25
|
+
/** Deletes a pixel: https://umami.is/docs/api/pixels#delete-apipixelspixelid */
|
|
26
26
|
function delete_PIXELID(this: API, pixelId: Pixel["id"]): Promise<DeletionResult>;
|
|
27
27
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/** Operations around Pixels management: https://umami.is/docs/api/pixels */
|
|
2
2
|
export var Pixels;
|
|
3
3
|
(function (Pixels) {
|
|
4
|
-
/** Returns all user pixels: https://umami.is/docs/api/pixels#get-apipixels
|
|
4
|
+
/** Returns all user pixels: https://umami.is/docs/api/pixels#get-apipixels */
|
|
5
5
|
async function get(parameters) {
|
|
6
6
|
const response = await this.request("get", ["pixels"], parameters);
|
|
7
7
|
return response.data;
|
|
8
8
|
}
|
|
9
9
|
Pixels.get = get;
|
|
10
|
-
/** Gets a pixel by ID: https://umami.is/docs/api/pixels#get-apipixelspixelid
|
|
10
|
+
/** Gets a pixel by ID: https://umami.is/docs/api/pixels#get-apipixelspixelid */
|
|
11
11
|
async function get_PIXELID(pixelId) {
|
|
12
12
|
return await this.request("get", ["pixels", pixelId]);
|
|
13
13
|
}
|
|
14
14
|
Pixels.get_PIXELID = get_PIXELID;
|
|
15
|
-
/** Updates a pixel: https://umami.is/docs/api/pixels#post-apipixelspixelid
|
|
15
|
+
/** Updates a pixel: https://umami.is/docs/api/pixels#post-apipixelspixelid */
|
|
16
16
|
async function post_PIXELID(pixelId, parameters) {
|
|
17
17
|
return await this.request("post", ["pixels", pixelId], parameters);
|
|
18
18
|
}
|
|
19
19
|
Pixels.post_PIXELID = post_PIXELID;
|
|
20
|
-
/** Deletes a pixel: https://umami.is/docs/api/pixels#delete-apipixelspixelid
|
|
20
|
+
/** Deletes a pixel: https://umami.is/docs/api/pixels#delete-apipixelspixelid */
|
|
21
21
|
async function delete_PIXELID(pixelId) {
|
|
22
22
|
return await this.request("delete", ["pixels", pixelId]);
|
|
23
23
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { API, Sessions, Websites } from "../index.js";
|
|
2
2
|
/** Realtime data for your website: https://umami.is/docs/api/realtime */
|
|
3
3
|
export declare namespace Realtime {
|
|
4
|
-
|
|
5
|
-
function get_WEBSITEID(this: API, websiteId: Websites.Website["id"]): Promise<{
|
|
4
|
+
interface Stats {
|
|
6
5
|
countries: {
|
|
7
6
|
[k: string]: number;
|
|
8
7
|
};
|
|
@@ -17,12 +16,12 @@ export declare namespace Realtime {
|
|
|
17
16
|
sessionId: Sessions.Session["id"];
|
|
18
17
|
eventName: string;
|
|
19
18
|
createdAt: Date;
|
|
20
|
-
browser: string;
|
|
21
|
-
os: string;
|
|
19
|
+
browser: string | null;
|
|
20
|
+
os: string | null;
|
|
22
21
|
device: string;
|
|
23
22
|
country: string;
|
|
24
23
|
urlPath: string;
|
|
25
|
-
referrerDomain: string;
|
|
24
|
+
referrerDomain: string | null;
|
|
26
25
|
}[];
|
|
27
26
|
series: {
|
|
28
27
|
views: {
|
|
@@ -41,5 +40,7 @@ export declare namespace Realtime {
|
|
|
41
40
|
countries: number;
|
|
42
41
|
};
|
|
43
42
|
timestamp: number;
|
|
44
|
-
}
|
|
43
|
+
}
|
|
44
|
+
/** Realtime stats within the last 30 minutes: https://umami.is/docs/api/realtime#get-apirealtimewebsiteid */
|
|
45
|
+
function get_WEBSITEID(this: API, websiteId: Websites.Website["id"]): Promise<Stats>;
|
|
45
46
|
}
|
|
@@ -17,19 +17,13 @@ export declare namespace Sessions {
|
|
|
17
17
|
visits: number;
|
|
18
18
|
views: number;
|
|
19
19
|
}
|
|
20
|
-
interface
|
|
20
|
+
interface SessionWithHostnameCreatedate extends Session {
|
|
21
21
|
hostname: string;
|
|
22
22
|
createdAt: Date;
|
|
23
23
|
}
|
|
24
|
-
interface SessionWithDistinctidEventsTotaltime extends Session {
|
|
25
|
-
distinctId: string | null;
|
|
26
|
-
events: number;
|
|
27
|
-
totaltime: number;
|
|
28
|
-
}
|
|
29
24
|
/** Gets website session details within a given time range: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessions */
|
|
30
|
-
function get_WEBSITEID_Sessions(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps & GenericRequestParameters): Promise<
|
|
31
|
-
|
|
32
|
-
function get_WEBSITEID_SessionsStats(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps): Promise<{
|
|
25
|
+
function get_WEBSITEID_Sessions(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps & GenericRequestParameters): Promise<SessionWithHostnameCreatedate[]>;
|
|
26
|
+
interface Stats {
|
|
33
27
|
/** Pages hits */
|
|
34
28
|
pageviews: {
|
|
35
29
|
value: number;
|
|
@@ -50,29 +44,29 @@ export declare namespace Sessions {
|
|
|
50
44
|
events: {
|
|
51
45
|
value: number;
|
|
52
46
|
};
|
|
53
|
-
/**
|
|
54
|
-
* Number of visitors who only visit a single page
|
|
55
|
-
* @remarks While featured in the documentation, it doesn't seem to exist
|
|
56
|
-
*/
|
|
47
|
+
/** Number of visitors who only visit a single page */
|
|
57
48
|
bounces?: {
|
|
58
49
|
value: number;
|
|
59
50
|
};
|
|
60
|
-
/**
|
|
61
|
-
* Time spent on the website
|
|
62
|
-
* @remarks While featured in the documentation, it doesn't seem to exist
|
|
63
|
-
*/
|
|
51
|
+
/** Time spent on the website */
|
|
64
52
|
totaltime?: {
|
|
65
53
|
value: number;
|
|
66
54
|
};
|
|
67
|
-
}
|
|
55
|
+
}
|
|
56
|
+
/** Gets summarized website session statistics: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionsstats */
|
|
57
|
+
function get_WEBSITEID_SessionsStats(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps): Promise<Stats>;
|
|
68
58
|
/** Get collected count of sessions by hour of weekday: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionsweekly */
|
|
69
59
|
function get_WEBSITEID_SessionsWeekly(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps & {
|
|
70
60
|
timezone: string;
|
|
71
61
|
}): Promise<number[][]>;
|
|
62
|
+
interface SessionWithDistinctidEventsTotaltime extends Session {
|
|
63
|
+
distinctId: string | null;
|
|
64
|
+
events: number;
|
|
65
|
+
totaltime: number;
|
|
66
|
+
}
|
|
72
67
|
/** Gets session details for a individual session: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionssessionid */
|
|
73
68
|
function get_WEBSITEID_Sessions_SESSIONID(this: API, websiteId: Websites.Website["id"], sessionId: Session["id"]): Promise<SessionWithDistinctidEventsTotaltime>;
|
|
74
|
-
|
|
75
|
-
function get_WEBSITEID_Sessions_SESSIONID_Activity(this: API, websiteId: Websites.Website["id"], sessionId: Session["id"], parameters: Timestamps): Promise<{
|
|
69
|
+
interface Activity {
|
|
76
70
|
createdAt: Date;
|
|
77
71
|
urlPath: string;
|
|
78
72
|
urlQuery: string;
|
|
@@ -82,9 +76,10 @@ export declare namespace Sessions {
|
|
|
82
76
|
eventName: Events.Event["eventName"] | null;
|
|
83
77
|
visitId: string;
|
|
84
78
|
hasData: boolean;
|
|
85
|
-
}
|
|
86
|
-
/** Gets session
|
|
87
|
-
function
|
|
79
|
+
}
|
|
80
|
+
/** Gets session activity for a individual session: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionssessionidactivity */
|
|
81
|
+
function get_WEBSITEID_Sessions_SESSIONID_Activity(this: API, websiteId: Websites.Website["id"], sessionId: Session["id"], parameters: Timestamps): Promise<Activity[]>;
|
|
82
|
+
interface Properties {
|
|
88
83
|
websiteId: Websites.Website["id"];
|
|
89
84
|
sessionId: Session["id"];
|
|
90
85
|
dataKey: string;
|
|
@@ -93,17 +88,21 @@ export declare namespace Sessions {
|
|
|
93
88
|
numberValue: number | null;
|
|
94
89
|
dateValue: Date | null;
|
|
95
90
|
createdAt: Date;
|
|
96
|
-
}
|
|
97
|
-
/** Gets session
|
|
98
|
-
function
|
|
91
|
+
}
|
|
92
|
+
/** Gets session properties for a individual session: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsessionssessionidproperties (TODO Server returns empty array) */
|
|
93
|
+
function get_WEBSITEID_Sessions_SESSIONID_Properties(this: API, websiteId: Websites.Website["id"], sessionId: Session["id"]): Promise<Properties[]>;
|
|
94
|
+
interface DataProperties {
|
|
99
95
|
propertyName: string;
|
|
100
96
|
total: number;
|
|
101
|
-
}
|
|
97
|
+
}
|
|
98
|
+
/** Gets session data counts by property name: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsession-dataproperties (TODO Server returns empty array) */
|
|
99
|
+
function get_WEBSITEID_SessiondataProperties(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps): Promise<DataProperties[]>;
|
|
100
|
+
interface DataValues {
|
|
101
|
+
value: string;
|
|
102
|
+
total: number;
|
|
103
|
+
}
|
|
102
104
|
/** Gets session data counts for a given property: https://umami.is/docs/api/sessions#get-apiwebsiteswebsiteidsession-datavalues (TODO Server returns empty array) */
|
|
103
105
|
function get_WEBSITEID_SessiondataValues(this: API, websiteId: Websites.Website["id"], parameters: Filters & Timestamps & {
|
|
104
106
|
propertyName: string;
|
|
105
|
-
}): Promise<
|
|
106
|
-
value: string;
|
|
107
|
-
total: number;
|
|
108
|
-
}[]>;
|
|
107
|
+
}): Promise<DataValues[]>;
|
|
109
108
|
}
|
|
@@ -22,9 +22,12 @@ export declare namespace Teams {
|
|
|
22
22
|
user: Users.MinimalUser;
|
|
23
23
|
}
|
|
24
24
|
interface TeamWithMembers extends Team {
|
|
25
|
+
members: TeamMember[];
|
|
26
|
+
}
|
|
27
|
+
interface TeamWithMembersWithUser extends Team {
|
|
25
28
|
members: TeamMemberWithUser[];
|
|
26
29
|
}
|
|
27
|
-
interface TeamWithMembersCount extends
|
|
30
|
+
interface TeamWithMembersCount extends TeamWithMembersWithUser {
|
|
28
31
|
_count: {
|
|
29
32
|
websites: number;
|
|
30
33
|
members: number;
|
|
@@ -14,7 +14,7 @@ export declare namespace Users {
|
|
|
14
14
|
}
|
|
15
15
|
interface MinimalUserWithRoleCreatedAt extends MinimalUserWithRole, MinimalUserWithCreatedAt {
|
|
16
16
|
}
|
|
17
|
-
interface User extends
|
|
17
|
+
interface User extends MinimalUserWithRoleCreatedAt {
|
|
18
18
|
isAdmin: boolean;
|
|
19
19
|
}
|
|
20
20
|
interface DetailedUser extends MinimalUserWithRole, MinimalUserWithCreatedAt {
|
|
@@ -8,9 +8,7 @@ export var WebsiteStats;
|
|
|
8
8
|
WebsiteStats.get_WEBSITEID_Active = get_WEBSITEID_Active;
|
|
9
9
|
/** Gets events within a given time range: https://umami.is/docs/api/website-stats#get-apiwebsiteswebsiteideventsseries */
|
|
10
10
|
async function get_WEBSITEID_EventsSeries(websiteId, parameters) {
|
|
11
|
-
|
|
12
|
-
response.t = new Date(response.t);
|
|
13
|
-
return response;
|
|
11
|
+
return await this.request("get", ["websites", websiteId, "events", "series"], parameters);
|
|
14
12
|
}
|
|
15
13
|
WebsiteStats.get_WEBSITEID_EventsSeries = get_WEBSITEID_EventsSeries;
|
|
16
14
|
/** Gets metrics for a given time range: https://umami.is/docs/api/website-stats#get-apiwebsiteswebsiteidmetrics (TODO UNTESTED) */
|
|
@@ -25,10 +23,7 @@ export var WebsiteStats;
|
|
|
25
23
|
WebsiteStats.get_WEBSITEID_MetricsExpanded = get_WEBSITEID_MetricsExpanded;
|
|
26
24
|
/** Gets pageviews within a given time range: https://umami.is/docs/api/website-stats#get-apiwebsiteswebsiteidpageviews (TODO UNTESTED) */
|
|
27
25
|
async function get_WEBSITEID_Pageviews(websiteId, parameters) {
|
|
28
|
-
|
|
29
|
-
response.pageviews = response.pageviews.map((v) => { v.x = new Date(v.x); return v; });
|
|
30
|
-
response.sessions = response.sessions.map((s) => { s.x = new Date(s.x); return s; });
|
|
31
|
-
return response;
|
|
26
|
+
return await this.request("get", ["websites", websiteId, "pageviews"], parameters);
|
|
32
27
|
}
|
|
33
28
|
WebsiteStats.get_WEBSITEID_Pageviews = get_WEBSITEID_Pageviews;
|
|
34
29
|
/** Gets summarized website statistics: https://umami.is/docs/api/website-stats#get-apiwebsiteswebsiteidstats (TODO UNTESTED) */
|
|
@@ -19,7 +19,12 @@ export declare namespace Websites {
|
|
|
19
19
|
createUser: Users.MinimalUser;
|
|
20
20
|
}
|
|
21
21
|
interface WebsiteWithUser extends Website {
|
|
22
|
-
|
|
22
|
+
/** @remarks Might be undefined if owned by a team? */
|
|
23
|
+
user?: Users.MinimalUser;
|
|
24
|
+
}
|
|
25
|
+
interface WebsiteWithUserTeam extends Website {
|
|
26
|
+
user: Users.MinimalUser | null;
|
|
27
|
+
team: Teams.TeamWithMembers | null;
|
|
23
28
|
}
|
|
24
29
|
/** Returns all user websites: https://umami.is/docs/api/websites#get-apiwebsites */
|
|
25
30
|
function get(this: API, parameters?: GenericRequestParameters & {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "umami-api-js",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Package to easily access the
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Package to easily access the Umami api!",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"keywords": [
|
|
24
24
|
"umami",
|
|
25
25
|
"api",
|
|
26
|
+
"analytics",
|
|
26
27
|
"wrapper",
|
|
27
28
|
"api-wrapper"
|
|
28
29
|
],
|
|
@@ -30,8 +31,10 @@
|
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@types/chai": "^5.2.3",
|
|
32
33
|
"@types/node": "^24.9.2",
|
|
34
|
+
"ajv": "^8.17.1",
|
|
33
35
|
"chai": "^6.2.2",
|
|
34
36
|
"dotenv": "^17.2.3",
|
|
37
|
+
"ts-json-schema-generator": "^2.4.0",
|
|
35
38
|
"typedoc": "^0.28.16",
|
|
36
39
|
"typescript": "^5.9.3"
|
|
37
40
|
}
|